Red Hat Linux 253 实验(服务管理)(4)

2019-05-27 17:41

root@server1... Connecting to [127.0.0.1] via relay...

220 localhost.localdomain ESMTP Sendmail 8.12.8/8.12.8; Mon, 22 Sep 2003 14:29:24 +0800

>>> EHLO localhost.localdomain

250-localhost.localdomain Hello station1 [127.0.0.1], pleased to meet you ...

>>> MAIL From: SIZE=52 AUTH=root@localhost.localdomain

250 2.1.0 ... Sender ok >>> RCPT To: >>> DATA

250 2.1.5 ... Recipient ok 354 Enter mail, end with \>>> .

250 2.0.0 h8M6TOU5026513 Message accepted for delivery

root@192.168.241.182... Sent (h8M6TOU5026513 Message accepted for delivery) Closing connection to [127.0.0.1] >>> QUIT

221 2.0.0 localhost.localdomain closing connection

如果SMTP交换向上面一样正确,那么消息将被转发到您的工作站上的本地的转发服务器上,并且mailq –Ac将会报告一个空的对列。接下来检查mail(不使用参数)来检查一下消息是否从本地的转发到server1。这样对列也应该是空的。

您的消息是不是在/var/log/maillog中正确的记录呢?在下面的步骤中,监视文件/var/log/maillog。下面的命令将会十分的有用:

xterm –e tail –f /var/log/maillog &

对于postfix:

A.运行?service sendmail stop?,接下来使用redhat-switch-mail使得postfix成为活跃的MTA。您也可以使用如下的命令行:

alternatives –set mta /usr/sbin/sendmail.postfix

B.确保postfix在合适的运行级别有效:

chkconfig -–list postfix

postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off

C.确定hostname命令正确的返回您的主机名称。应该是您的FQDN。

如果sendmail返回您的主机名称为localhost,您可能错误配置了/etc/hosts文件。检查您的/etc/hosts文件,删除所有的但记住留下localhost的指向,然后再试一遍。如果/etc/hosts文件是正确的,那么检查一下在/etc/sysconfig/netwoek中的HOSTNAME的定义。当这些值都正确的时候,启动postfix服务。

D.确定postfix在启动的时候没有错误

和sendmail一样,Red Hat Linux的安装使用提供的syslog工具来记录所有的信息到文件/var/log/maillog中去。检查此文件中的最后查找任何错误信息。

试图向root@server1发送简单的邮件并且检查/var/log/maillog的记录文件 mail –s `echo $USER` root@server1 < /etc/redhat-release

应该如下所示:

Sep 22 02:51:50 station1 postfix/pickup[2865]: A20ED348389: uid=0 from= Sep 22 02:51:50 station1 postfix/cleanup[3534]: A20ED348389: message-id=<2003092 2065150.A20ED348389@station1.example.com>

Sep 22 02:51:50 station1 postfix/nqmgr[2866]: A20ED348389: from=, size=341, nrcpt=1 (queue active)

Sep 22 02:51:51 station1 postfix/smtp[3536]: A20ED348389: to=, relay=192.168.241.182[192.168.241.182], delay=1, status=sent (250 Message q ueued)

步骤3:添加新的别名

对于sendmail:

在sendmail决定消息的接受者的目的地的之前,其先试图在别名中查找。sendmail的主要的别名配置文件是/etc/aliases。为了优化查找,sendmail为其别名记录建立了一个哈希表数据库/etc/aliases.db.该文件通过newalias命令产生(该命令是sendmail –bi的同名)

下列命令将增加用户student(如果不存在的话)

useradd student

在/etc/aliases 行加入如下的行:

me: student wizards: root, me

methere: student@stationX.example.com

现在运行newalias 命令来更新数据库,尝试发送邮件给您定义的收件人:

newalias

echo “hello there” | mail –s “hello” me echo “hello there” | mail –s “hello” wizards echo “hello there” | mail –s “hello” methere

您是否得到了期望的结果?是否所有的位于wizards的收件人都受到了邮件?如果没有,su – 到不是root的用户再试一次。

在postfix决定消息的接受者的目的地的之前,其先试图在别名中查找。postfix的主要的别名配置文件是/etc/postfix/aliases。为了优化查找,postfix为其别名记录建立了一个哈希表别名数据库/etc/postfix/aliases.db(和sendmail类似).该文件通过newalias命令产生。

下列命令将增加用户student(如果不存在的话)

useradd student

在/etc/postfix/aliases 行加入如下的行: 注意:注释root别名的那一行为postfix

me: student wizards: root, me

methere: student@stationX.example.com

现在运行newalias 命令来更新数据库,尝试发送邮件给您定义的收件人:

newalias

echo “hello there” | mail –s “hello” me echo “hello there” | mail –s “hello” wizards echo “hello there” | mail –s “hello” methere

您是否得到了期望的结果?是否所有的位于wizards的收件人都受到了邮件?

步骤4.控制转发

转发允许邮件通过使用中间的“转发”及其传递到其目的地。尽管这个功能曾经有用,但是转发已经成为Internet上垃圾邮件的源泉了。人们希望发送主动提供的的邮件的时候希望使用转发机制,从而使得邮件发源地很难被侦测出来。

下列步骤将使用下面的主机。替换X,Y和Z为适合的工作站的号码:

stationX:源机器,邮件从这里发出 stationY:转发机器,这里邮件从发送者送出 stationZ:目的机器,邮件的最终目的

该步骤假设您是stationX,转发机器,与某人的stationY合作,该机器为邮件的源头。在该步骤中,注意

/var/log/maillog的变化。下列命令将会显得十分的有用。

对于sendmail 步骤A:允许转发

您具有控制允许谁在您的机器上转发的能力。通过控制您的机器的混杂转发,您可以使得任何人都能够将您的机器作为转发的主机。(我们对于这种的尝试表示反对,也希望通过该实验显示出其缺陷)。配置/etc/mail/sendmail.mc, 通过加入如下行使得m4前置处理器允许混杂转发:

/etc/mail/sendmail.mc

(…其他的内容…)FEATURE(promiscuous_relay)dnl

使用m4前置处理机通过这个模板文件生成一个新的sendmail配置文件,然后将新生成的文件与通过sendmail RPM软件包提供的进行比较

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.test-relay diff /etc/mail/sendmail.test-relay /etc/mail/sendmail.cf

使用混杂转发以后会有多大的不同呢?现在将新建立的sendmail.test放置在恰当的位置上,重新启动sendmail.

mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.accept-mail cp /etc/mail/sendmail.test-relay /etc/mail/sendmail.cf service sendmail restart

让您的伙伴扮演恶意的垃圾邮件的发送者,该人能够通过telnet到您的机器上的smtp(sendmail)的25号断口,进行垃圾邮件发送地址的欺骗,在stationY键入如下命令:

这个例子对于stationY(源机器)=station2,并且stationX(转发,在这里目的机器)=station1

[root@station1 root]# telnet station1 25 Trying station1.example.com...

Connected to station1.example.com (station1.example.com). Escape character is '^]'.

220 station1.example.com (IMail 8.00 8-1) NT-ESMTP Server X1 helo mail.cracker.org

250 hello station1.example.com mail from: spammer@cracker.org 250 ok

rcpt to:root@station1.example.com 250 ok its for data

354 ok, send it; end with .

Subject: Faked this was faked! .

250 Message queued quit

221 Goodbye

Connection closed by foreign host.

垃圾邮件现在送到您的机器上了。下一步,看看您的伙伴能不能从您的机器转发给第三台机器:

这个例子对于stationY(源机器)=station2,并且stationX(转发,在这里目的机器)=station1,并且stationZ(目的机器)=station3

[root@station1 root]# telnet station1 25 Trying station1.example.com...

Connected to station1.example.com (station1.example.com). Escape character is '^]'.

220 station1.example.com (IMail 8.00 9-1) NT-ESMTP Server X1 helo mail.craker.org

250 hello station1.example.com mail from: spammer@craker.org 250 ok

rcpt to root@station3.example.com

250 ok its for data

354 ok, send it; end with . Subject: Relayed

this was faked any relayed! .

250 Message queued quit

221 Goodbye

Connection closed by foreign host.

由于您的机器已经被配置成为允许混杂转发,垃圾邮件可以通过您的机器进行邮件转发。

对于postfix:

您具有控制允许谁在您的机器上转发的能力。缺省的postfix允许在子网上的任何人通过您的机器进行转发。胆汁并不是在每一个环境中都安全的。例如,您的机器和其他机器在一起,如果您的本地子网里有一台机器被其他人控制,那么其他的机器都会有麻烦。

让您的伙伴扮演恶意的垃圾邮件的发送者,该人能够通过telnet到您的机器上的postfix的25号断口,


Red Hat Linux 253 实验(服务管理)(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:年产10万吨煤制乙醇生产工艺设计

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: