Chinaunix首页 | 论坛 | 博客
  • 博客访问: 108591
  • 博文数量: 46
  • 博客积分: 2081
  • 博客等级: 大尉
  • 技术积分: 292
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-29 14:51
文章分类

全部博文(46)

文章存档

2012年(1)

2011年(38)

2010年(7)

分类:

2011-06-28 17:40:54

原文地址:Linux 下的postfix 习题 作者:badb0y

1)关闭sendmail服务,安装postfix,启动postfix

参考答案:
service sendmail stop
rpm -ivh postfix-2.0.11-4.i386.rpm
service postfix restart

2.1)配置/etc/postfix/main.cf,设定主机名称为t1.ckhitler.org
2.2)发信时显示出”发信源主机”项目,即邮件上面的mail from的那个位址
2.3)监控postfix的所有网卡
2.4)设定能收信的主机名称,为t1.ckhitler.org,localhost
2.5)规定信任的用户端为127.0.0.0/8,192.168.6.0/24
2.6)规范relay的下一部MTA主机位址,指定为$mydestination
2.7)设定邮件别名(alias_maps,alias_database),指定别名文件为/etc/postfix/aliases
2.8)重启服务
2.9)测试邮件收发

参考答案:
vi /etc/postfix/main.cf

myhostname = t1.ckhitler.org
myorigin = $myhostname
inet_interfaces = all
mydestination = $myhostname,localhost
mynetworks = 127.0.0.0/8, 192.168.6.0/24
relay_domains = $mydestination
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases

保存退出

service postfix restart

发送邮件给root
echo “testing…”|mail -s “from ckhitler” root

检查邮件
mail

3)检查 postfix 的设定

参考答案:
postconf -n

4)检查 postfix 相关的档案、权限等是否正确

参考答案:
postfix check

5)强制将目前正在邮件队列的邮件发出

参考答案:
postfix flush

6)重新读入设定档,/etc/postfix/main.cf

参考答案:
postfix reload

7)查看队列

参考答案:
postqueue -p

 

8.1)设定邮件主机使用权限与过滤机制/etc/postfix/access,允许192.168.6.0/24发送relay
8.2)拒绝192.168.7.0/24发送relay
8.3)重建资料库
8.4)在main.cf中的mynetworks中加入access的设定
8.5)重新读入main.cf配置,并测试邮件发送

参考答案:
vi /etc/postfix/access
192.168.6               ACCEPT
192.168.7               REJECT

postmap hash:/etc/postfix/access

vi /etc/postfix/main.cf
mynetworks = 127.0.0.0/8, 192.168.6.0/24, hash:/etc/postfix/access

postfix reload

echo “testing…”|mail -s “from second” root

9.1)新建用户test
9.2)设定邮件别名,使发给root的邮件也发给用户test一份
9.3)重建aliases资料库
9.4)发送邮件给root,查看test用户是否收到邮件
9.5)查看发送的日志

参考答案:
vi /etc/postfix/aliases
root:           root,postfix,test
保存退出

postalias hash:/etc/postfix/aliases

echo “testing…”|mail -s “from thired” root
mail

tail -f /var/log/maillog

10.1)邮件转发 ~/.forward,转发给kchen@ceno.cnt和root@t1.ckhitler.org
10.2)设定forward为644权限
10.3)查看kchen@ceno.cn和root@t1.ckhitler.org的邮箱

参考答案:
cd
vi .forward
kchen@ceno.cn
保存退出

chmod 644 .forward

echo “testing…”|mail -s “from fourth” root@t1.ckhitler.org

 

11)查看postfix的邮件队列

参考答案:
postqueue -p
mailq

 

12.1)关闭postfix服务
12.2)给root用户发一封测试邮件,
12.3)查看队列
12.4)到/var/spool/postfix/maildrop目录下,查看队列文件

参考答案:
service postfix stop
echo “test” |mail -s “testing queue” root
postqueue -p
cd /var/spool/postfix/maildrop
cat 418E91A2A86

 

13.1)重启postfix服务
13.2)强制将队列中的邮件发出

参考答案:
service postfix restart
postfix flush

 

14.1)安装mysql-devel包,安装dovecot服务
14.2)编辑dovecot.conf文档,加入pop3协议,并所有IP地址的监听
14.3)重启dovecot服务,观察110端口

参考答案:
rpm -ivh mysql-devel-3.23.58-16.RHEL3.1.i386.rpm
wget ftp://194.199.20.114/linux/dag/redhat/el3/en/i386/dag/RPMS/dovecot-0.99.13-1.1.el3.rf.i386.rpm
rpm -ivh dovecot-0.99.13-1.1.el3.rf.i386.rpm
vi /etc/dovecot.conf
protocols = pop3
pop3_listen = *

service dovecot start
netstat -anp|grep 110

 

15.1)测试邮件收发,发给root一封邮件
15.2)查看是否收到测试邮件
15.3)查看~/mbox的邮件
15.4)用uuencode发送以/etc/passwd文件的附件给root用户
15.5)查看root用户邮件,下载passwd文件,并解码

参考答案:
mail root@t1.ckhitler.org
mail
mail -f ~/mbox
uuencode /etc/passwd passwd|mail -s “passwd” root@t1.ckhitler.org
mail
s 2 encode
uudecode encode -o passwd

阅读(679) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~