转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 数据库 >> SyBase >> 正文
Red Hat Linux 253 实验翻译(KevinZ)         ★★★★

Red Hat Linux 253 实验翻译(KevinZ)

作者:闵涛 文章来源:闵涛的学习笔记 点击数:4037 更新时间:2009/4/22 23:08:07

步骤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 <root@mailgrid.ods.org>
data
354 ok, send it; end with <CRLF>.<CRLF>
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 <root@station3.example.com >
data
354 ok, send it; end with <CRLF>.<CRLF>
Subject: Relayed
this was faked any relayed!
.
250 Message queued
quit
221 Goodbye
Connection closed by foreign host.

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

对于postfix:

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

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

[root@station1 root]# telnet station1 25
Trying 127.0.0.1...
Connected to station1 (127.0.0.1).
Escape character is ''''^]''''.
220 station1.example.com ESMTP Postfix
helo mail.craker.org
250 station1.example.com
mail from:spammer@craker.org
250 Ok
rcpt to: root@station1.example.com
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: Faked
this was faked!
.
250 Ok: queued as 4FFA2348389
quit
221 Bye
Connection closed by foreign host.

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

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

[root@station1 root]# telnet station1 25
Trying 127.0.0.1...
Connected to station1 (127.0.0.1).
Escape character is ''''^]''''.
220 station1.example.com ESMTP Postfix
helo mail.craker.org
250 station1.example.com
mail from: spammer@cracker.org
250 Ok
rcpt to: root@station3.example.com
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject: Relayed
this was faked and relayed!
.
250 Ok: queued as 69C7B348389
quit
221 Bye
Connection closed by foreign host.

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

步骤B:不允许转发

对于sendmail

通过替换新的sendmail.cf为接受传入的信件的配置文件来恢复缺省的sendmail的配置,并且重新启动sendmail:

mv /etc/mail/sendmail.cf.accept-mail /etc/mail/sendmail.cf
service sendmail restart

让您的伙伴再从stationY转发垃圾邮件。您的sendmail还是一个转发器么?任何一个转发的都会产生如下的消息:

550 root@station3.example.com .. Relaying denied

对于postfix

编辑文件/etc/postfix/main.cf取消转发。

查找并且取消注释下面的行,并且重新启动postfix

mynetworks_style = host

让您的伙伴再从stationY转发垃圾邮件。您的postfix还是一个转发器么?任何一个转发的都会产生如下的消息:

554 <root@station3.example.com>: Recipient address rejected: Relay access denied

步骤C:选择性的转发

对于sendmail

对于特定的主机,域或者网络,编辑/etc/mail/access并且重新启动sendmail。为了允许所有在example.com域中的机器可以把您的机器作为邮件转发服务器,你在/etc/mail/acces中添加如example.com域。和您的伙伴使用场景A中的命令进行测试。

对于postfix

对于特定的主机,域或者网络,编辑/etc/postfix/main.cf并且重新启动postfix。对于特定的主机允许通过您的机器进行转发,找到并且取消注释该行:

mynetworks_style = host

然后添加新行来允许转发的主机和网络,在这里允许station1和本地转发

mynetworks = 192.168.0.1, 127.0.0.0/8

和您的伙伴使用场景A中的命令进行测试。


步骤5:安装POP3服务器和客户端

在这个步骤中,你将配制您的机器stationX作为邮件的POP3服务器,使得您的在stationY的伙伴扮演POP客户端的角色。

步骤A:安装POP3服务器

配置一个POP3服务器比较简单,只需要两个步骤:

l 安装相关的RPM软件包
l 在xinetd中允许服务

安装相关的RPM软件包
POP守护进程和其他的具有相同功能的守护进程,例如IMAP守护进程绑定在软件包imap中。再如xinetd,krb5-libs*和imap软件包来检查imap软件包含有什么软件。

三个守护进程被包括进来:imapd,ipop2d和ipop3d。POP3被用在很多Internet服务提供商,POP2提供是为了向后兼容。IMAP守护进程提供了根加复杂的能力,包括了在服务器端的文件夹的管理。


在xinetd中允许服务

对于本实验,我们仅选定POP3服务。ipop3d通过xinetd在请求的时候被启动。为了激活,运行下面的命令:

service xinetd start
chkconfig ipop3 on

查看一下/etc/xinetd.d/ipop3。显式的重新启动xinetd并不是必需的,由于chkconfig发送给xinetd 一个USR2信号告诉他重新调入其配置。

确认服务

运行下面的命令确认服务已经被正确的安装。下面的命令只是一个指导:

echo “mail to be poped” | mail –s “Hello student” student

[root@station1 root]# telnet localhost 110
Trying 127.0.0.1...
Connected to station1 (127.0.0.1).
+OK POP3 station1 v2001.78rh server ready
USER student
+OK User name accepted, password please
PASS student
+OK Mailbox open, 1 messages
STAT
+OK 1 440
TOP 1 99999
+OK Top of message follows
Return-Path: <root@station1.example.com>
Delivered-To: student@station1.example.com
Received: by station1.example.com (Postfix, from userid 0)
id 72314348390; Mon, 22 Sep 2003 08:02:27 -0400 (EDT)
To: student@station1.example.com
Subject: Hello student
Message-Id: <20030922120227.72314348390@station1.example.com>
Date: Mon, 22 Sep 2003 08:02:27 -0400 (EDT)
From: root@station1.example.com (root)
Status:

mail to be poped
.
DELE 1
+OK Message deleted
QUIT
+OK Sayonara
Connection closed by foreign host.

如果一切顺利的话,您现在有一个安装好的POP服务器了。

步骤B :使用POP客户端

所有的现在的邮件用户代理(MUA),例如netscape,elm,Outlook,pine和mutt都是使用POP的,可以被用作POP的客户端。每一个的配置都有所不同。同样有一个流行字符界面的的POP客户端叫做fetchmail。fetchmail是高度的可配置的,可以查询多个邮箱,可以作为守护进程运行,这样使得其每五分钟查询用户的邮箱。fetchmail在主机上递送邮件到邮件传送代理(MTA),例如sendmail。我们将勾画出以后如何安装fetchmail和使用其来查询我们装过的POP服务器。

从CD或者从ftp://server1/pub/RedHat/RPMS来安装fetchmail软件包

注意到有很多选项可以影响fetchmail的行为。建立一个~/.fetchmailrc文件如下所示:

~student/.fetchmailrc
poll stationX.exmaple.com with protocol pop3: user studentXX there is user studentXX here password “password”

由于密码存储在该文件中,因此fetchmail将会拒绝运行除非您把该文件的属性设定为对于仅仅文件的所有者只读。注意还可以使用chown改变由root创建的文件的所有者为studentXX。

chmod 600 ~student/.fetchmailrc
chown student.student ~student/.fetchmailrc

尝试使用studentXX登陆到POP3邮箱

echo “hello student” | mail –s “Hola” student
su – student
fetchmail –v
exit

fetchmail能不能接收到student的POP邮件?将递送student的邮件到哪里?比从本地获取POP邮件有意义么?

让您的伙伴在另外一台机器上建立相同的~/.fetchmailrc文件(或者配置其它诸如mozilla的MTA)试图从您的服务器上进行收信。
复习的问题


1. m4宏语言提供给sendmail管理哪些东西?把所有的在xyz.com的用户邮件导向到本地用户xzplogin该使用什么语法?该在什么文件的和处填上这句话?

2. mailq命令用来作什么?您如何使用?

3. 当命令sendmail –q发出以后,sendmail将会试图仍在队列中等待的邮件。何时使用该命令是有用的?

4. 如果去除FEATURE(

上一页  [1] [2] [3] [4] [5] [6]  下一页


[C语言系列]C# 和 Linux 时间戳转换  [Web开发]PHP flock文件锁介绍
[Web开发]flock() Linux下的文件锁  [电脑应用]Linux下的六个免费的虚拟主机管理系统介绍
[电脑应用]Linux数据库大比拚  [操作系统]在Windows中玩转Linux操作系统
[办公软件]在RedHat Linux 9里安装gaim0.80  [办公软件]掌握 Linux 调试技术
[办公软件]理解 Linux 配置文件  [聊天工具]Real10 & Xpdf installation on Linux Box
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Sql Server  · MySql
    · Access  · ORACLE
    · SyBase  · 其他
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台