Linux下的Postfix邮件服务器
Linux网络服务配置-Postfix邮件系统(二)

查询、收取新邮件
17/28
其他扩展设置2-1
通过别名设置邮件组
一般使用 /etc/aliases 文件 aliases文件的记录格式
• 别名: 地址1, 地址2, 地址3, ……
执行newaliases命令,以更新别名设置 1.指定查询表存放位置
[root@mail ~]# vi /etc/postfix/main.cf …… alias_maps = hash:/etc/aliases [root@mail ~] # postfix reload 2.配置别名查询表 [root@mail ~]# vi /etc/aliases postfix/postfix-script: refreshing the Postfix mail system …… student:zhangsan, lisi, mike, john teacher:vicky, tsengyia 3.更新别名数据库 [root@mail ~]# newaliases
8/28
测试SMTP发信认证2-2
测试SMTP发信认证——Outlook2007
通过”工具”“账户设置” “发送服务器”,勾选“我 的发送服务器(SMTP)要求验证”
使用SMTP认证
未使用SMTP认证
9/28
小结
请思考:
如何启用Postfix的SMTP认证功能? 配置参数smtpd_recipient_restrictions的功能是什么?
22/28
实验案例:配置Postfix扩展功能3-2
学员练习1
创建SASL配置文件,并启动saslauthd服务 添加Postfix对SMTP认证的支持,并测试
如何在Linux系统上搭建邮件代理服务器

如何在Linux系统上搭建邮件代理服务器随着互联网的发展,电子邮件已经成为我们日常生活和工作中不可或缺的一部分。
为了更好地管理和保护我们的电子邮件,搭建邮件代理服务器是非常有必要的。
在本文中,我将介绍如何在Linux系统上搭建邮件代理服务器,并提供一些实用的技巧和建议。
一、选择适合的邮件代理服务器软件在搭建邮件代理服务器之前,首先需要选择适合的邮件代理服务器软件。
常见的邮件代理服务器软件有Postfix、Sendmail和Exim等。
在选择之前,我们需要考虑以下几个方面:1.稳定性和安全性:选择一个稳定且有良好安全记录的邮件代理服务器软件是非常重要的,以确保您的电子邮件安全。
2.易于配置和管理:选择一个易于配置和管理的邮件代理服务器软件将帮助您节省时间和精力。
3.可扩展性:选择一个具有良好扩展性的邮件代理服务器软件,以便您可以根据需要进行功能扩展和定制。
基于以上几个方面的考虑,我推荐使用Postfix作为邮件代理服务器软件。
Postfix是一款稳定、安全且易于配置的邮件代理服务器软件,广泛应用于各种Linux发行版中。
二、安装和配置Postfix1.安装Postfix在Linux系统上安装Postfix非常简单。
首先,打开终端并以root用户身份运行以下命令来安装Postfix:```sudo apt-get install postfix```根据系统提示进行配置,一般选择“Internet Site”选项,并输入您的域名。
2.配置PostfixPostfix的配置文件位于/etc/postfix/main.cf。
您可以使用任何文本编辑器打开该文件并进行必要的配置。
以下是几个常见的配置选项:- myhostname:设置您的邮件代理服务器的主机名。
- mydomain:设置您的邮件代理服务器的域名。
- mydestination:设置邮件将被投递的目的地域名。
根据您的实际需求进行配置,并保存文件。
linux环境下postfix+dovecot+webmail安装配置详解

构建postfix邮件服务器(一)1、编译安装Postfix[root@mail ~]# groupadd -g 1200 postdrop[root@mail ~]# groupadd -g 1000 postfix[root@mail ~]# useradd -M -s /sbin/nologin -u 1000 -g postfix -G postdrop postfix[root@mail ~]# tar zxf postfix-2.4.6.tar.gz[root@mail ~]# gunzip postfix-2.4.6-vda-ng.patch.gz[root@mail ~]# cd postfix-2.4.6[root@mail postfix-2.4.6]# patch -p1 < ../postfix-2.4.6-vda-ng.patchpatching file README_FILES/VDA_READMEpatching file src/global/mail_params.hpatching file src/util/file_limit.cpatching file src/virtual/mailbox.cpatching file src/virtual/maildir.cpatching file src/virtual/virtual.cpatching file src/virtual/virtual.h[root@mail postfix-2.4.6]#预配置编译参数[root@mail postfix-2.4.6]# make makefiles \'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql \-DUSE_SASL_AUTH \-DUSE_CYRUS_SASL -I/usr/include/sasl' \'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm \-L/usr/lib/sasl2 -lsasl2 ' && make && make install //编译并进行安装Postfix的配置文件(Postfix系统最主要的配置文件包括:/etc/postfix/main.cf 和/etc/postfix/master.cf.前者是postfix服务的配置文件,后者是master程序的配置文件)[root@mail postfix-2.4.6]# postconf –n //-n 将只列出不同于默认值的配置参数command_directory = /usr/sbinconfig_directory = /etc/postfixdaemon_directory = /usr/libexec/postfixdebug_peer_level = 2html_directory = nomail_owner = postfixmailq_path = /usr/bin/mailqmanpage_directory = /usr/local/mannewaliases_path = /usr/bin/newaliasesqueue_directory = /var/spool/postfixreadme_directory = nosample_directory = /etc/postfixsendmail_path = /usr/sbin/sendmailsetgid_group = postdropunknown_local_recipient_reject_code = 550[root@mail postfix-2.4.6]#[root@mail postfix-2.4.6]# cd /etc/postfix/[root@mail postfix]# postconf -n > main2.cf[root@mail postfix]# mv main.cf main.cf.bak[root@mail postfix]# mv main2.cf main.cfPostfix的启动控制[root@mail postfix]# postfix startpostfix/postfix-script: starting the Postfix mail system[root@mail postfix]# netstat -anpt | grep :25tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1995/master[root@mail postfix]# postfix check //若配置无误,不会反馈任何信息[root@mail postfix]# postfix reload //重新载入配置信息,而不需要重启Postfix服务postfix/postfix-script: refreshing the Postfix mail system[root@mail postfix]# postfix stoppostfix/postfix-script: stopping the Postfix mail system[root@mail postfix]#配置基于Postfix构建简单电子邮件系统:1、编辑main.cf文件,调整运行Postfix的基本参数[root@mail postfix]#vi main.cfinet_interfaces=192.168.1.199, 127.0.0.1 //设置postfix服务监听的IP地址,缺省为allmyhostname= //设置postfix服务器使用的主机名mydomain= //设置postfix服务器使用的邮件域myorigin=$mydomain //设置外发邮件时发件人地址中的邮件域名mydestination=$mydomain,$myhostname //设置可接收的邮件地址中的域名home_mailbox=Maildir/ //设置邮件存储位置和格式2、添加邮件用户的帐号[root@mail postfix]# groupadd mailusers[root@mail postfix]# useradd -g mailusers -s /sbin/nologin xiaowu[root@mail postfix]# useradd -g mailusers -s /sbin/nologin juncai[root@mail postfix]# passwd xiaowuChanging password for user xiaowu.New UNIX password:BAD PASSWORD: it is based on a dictionary wordRetype new UNIX password:passwd: all authentication tokens updated successfully.[root@mail postfix]# passwd juncaiChanging password for user juncai.New UNIX password:BAD PASSWORD: it is based on a dictionary wordRetype new UNIX password:passwd: all authentication tokens updated successfully.[root@mail postfix]##echo 12345 | passwd --stdin xiaowu //或这样赋予密码Changing password for user xiaowu.passwd: all authentication tokens updated successfully.3、SMTP发送邮件测试[root@mail postfix]# telnet localhost 25Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.220 ESMTP Postfixehlo 250 250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSNmail from:xiaowu@250 2.1.0 Okrcpt to:juncai@250 2.1.5 Okdata354 End data with <CR><LF>.<CR><LF>subject: A TEST MAILHELLO!This is a test mail !!!.250 2.0.0 Ok: queued as 229784E100quit221 2.0.0 ByeConnection closed by foreign host.#grep 229784E100 /var/log/messages //查找发信状态[root@mail postfix]# cat ~juncai/Maildir/new/Return-Path: <xiaowu@>X-Original-To: juncai@Delivered-To: juncai@Received: from localhost (localhost.localdomain [127.0.0.1])by (Postfix) with SMTP id 229784E100for <juncai@>; Thu, 17 Mar 2011 03:02:45 +0800 (CST)subject: A TEST MAILMessage-Id: <20110316190254.229784E100@>Date: Thu, 17 Mar 2011 03:02:45 +0800 (CST)From: xiaowu@To: undisclosed-recipients:;HELLO!This is a test mail !!![root@mail postfix]#构建Dovecot服务器1、编译安装Dovecot软件包[root@mail ~]#useradd –M –s /sbin/nologin dovecot[root@mail ~]#tar zxvf dovecot-1.1.4.tar.gz[root@mail ~]#cd dovecot-1.1.4[root@mail dovecot-1.1.4]# ./configure --sysconfdir=/etc --with-mysql && make && make install2、配置Dovecot的运行参数(1)建立dovecot.conf配置文件并进行简单设置[root@mail dovecot-1.1.4]# cp /etc/dovecot-example.conf /etc/dovecot.conf[root@mail dovecot-1.1.4]#vi /etc/dovecot.confssl_disable = yesprotocols = imap pop3disable_plaintext_auth = nomail_location = maildir:~/Maildir(2)创建PAM认证文件[root@mail dovecot-1.1.4]# vi /etc/pam.d/dovecotauth required pam_nologin.soauth include system-authaccount include system-authsession include system-auth3、启动Dovecot服务[root@mail ~]# /usr/local/sbin/dovecot -c /etc/dovecot.conf[root@mail ~]# netstat -anpt | grep dovecottcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 3713/dovecottcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 3713/dovecot[root@mail ~]#4、POP3接收邮件测试[root@mail ~]# telnet localhost 110Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.+OK Dovecot ready.user juncai+OKpass juncai+OK Logged in.list+OK 1 messages:1 511.retr 1+OK 511 octetsReturn-Path: <xiaowu@>X-Original-To: juncai@Delivered-To: juncai@Received: from localhost (localhost.localdomain [127.0.0.1])by (Postfix) with SMTP id 229784E100for <juncai@>; Thu, 17 Mar 2011 03:02:45 +0800 (CST) subject: A TEST MAILMessage-Id: <20110316190254.229784E100@>Date: Thu, 17 Mar 2011 03:02:45 +0800 (CST)From: xiaowu@To: undisclosed-recipients:;HELLO!This is a test mail !!!.quit+OK Logging out.Connection closed by foreign host.[root@mail ~]#WEBMAIL邮件界面SquirrelMail的工作流程1、依次安装squirrelmail程序包、中文语言包[root@mail ~]# tar jxvf squirrelmail-1.4.13.tar.bz2 -C /usr/local/apache2/htdocs /webmail[root@mail ~]# cd /usr/local/apache2/htdocs/webmail/[root@mail webmail]# tar jxvf ~/zh_CN-1.4.13-20071220.tar.bz22、创建及调整数据目录、附件目录[root@mail webmail]# mkdir -p attach data[root@mail webmail]# chown -R daemon:daemon attach/ data/ [root@mail webmail]# chmod 730 attach/3、建立config.php配置文件[root@mail webmail]# cp config/config_default.php config/config.php [root@mail webmail]# vi config/config.php$squirrelmail_default_language = 'zh_CN';'en_US' $default_charset = 'zh_CN.UTF-8'; 'iso-8859-1' $domain = '';$smtpServerAddress = 'localhost';$smtpPort = 25;$imapPort = 143;$imap_server_type = 'dovecot';$data_dir = '/usr/local/apache2/htdocs/webmail/data/'; $attachment_dir = '/usr/local/apache2/htdocs/webmail/attach/';4、重新启动httpd服务,并在浏览器中登录squirrelmail系统[root@mail webmail]# ../../bin/apachectl restart在该界面中可以完成发信、收信等电子邮件服务的基本操作。
网络服务器搭建、配置与管理 项目11 配置与管理Postfix邮件服务器

(3)第三方中继。
由服务器提交的OPEN RELAY不是从客户端直接提交的。比如我的域是A,我通过服务器B(属于 B域)中转邮件到C域。这时在服务器B上看到的是连接请求来源于A域的服务器(不是客户),而邮 件既不是服务器B所在域用户提交的,也不是发B域的,这就属于第三方中继。这是垃圾邮件的根本。 如果用户通过直接连接你的服务器发送邮件,这是无法阻止的,比如群发软件。但如果关闭了OPEN RELAY,那么他只能发信到你的组织内用户,无法将邮件中继出组织。
MUA MTA MTA MTA MDA 邮箱
队列
队列
图11-2 电子邮件传输过程
队列
11.1.4 与电子邮件相关的协议
常用的与电子邮件相关的协议有SMTP、POP3和IMAP4。
8
1.SMTP
简单邮件传输协议(Simple Mail Transfer Protocol,SMTP)默认工作在TCP的25端口。SMTP属 于客户机/服务器模型,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转 方式。SMTP属于TCP/IP协议簇,它帮助每台计算机在发送或中转信件时找到下一个目的地。通过 SMTP指定的服务器,就可以把电子邮件寄到收件人的服务器上了。SMTP服务器则是遵循SMTP的 发送邮件服务器,用来发送或中转发出的电子邮件。SMTP仅能用来传输基本的文本信息,不支持字 体、颜色、声音、图像等信息的传输。
Linux1 邮件服务器 Postfix的安装

Linux1 邮件服务器 Postfix 的安装Red Hat Enterprise Linux 5.4中内置有Sendmail 和Postfix 两种服务,并且默认配置下已经启用了Sendmail 。
不过,从前文的分析可以看出,Postfix 有很多Senmail 所没有的优势,所以我们准备采用Postfix 。
虽然RedHat Enterprise Linux5.4同时提供Sendmail 与Postfix ,不过同时启用会出现冲突,并不建议这两者并存,因此在安装Postfix 后,要记得将Sendmail 停用或删除。
删除操作,可在终端下利用“rpm –e 安装的sendmail 软件包名称”命令格式,并按【回车】键依次卸载sendmail-cf 、sendmail-doc 和sendmail-devel 3个软件包,如图9-48所示。
图9-48 删除Sendmail 相关软件包删除Red Hat Enterprise Linux 5.4默认安装的Sendmail 后,就可以放心地安装、启用Postfix 服务了。
由于Red Hat Enterprise Linux 5.4中的Postfix 服务默认并不会自动安装,所以在安装Postfix (使用RPM 工具)之前,首先需要在终端界面下使用-qa 命令查看系统是否安装有Postfix ,如图9-49所示。
图9-49 查看是否安装Postfix如果输出中没有任何结果显示,则表明Postfix 服务没有被安装。
相反,则应该显示“postfix-2.3.3-2”等字样。
尚未安装这项服务,则可将Red Hat Enterprise Linux5.4的第3张安装盘放入光驱(或者直接放入Red Hat Enterprise Linux 5.4的DVD 安装盘)。
然后,使用mount 命令将此光盘挂载到任一个指定的目录下(如,/tmp ),如图9-50所示。
linux-postfix服务器-电子邮件过滤和防病毒

linux-postfix服务器-电子邮件过滤和防病毒-技术笔记电子邮件过滤和防病毒postfix邮件服务系统可以针对SMTP会话中的地址,名称等信息进行检查,并根据main.cf 的配置参数将某一类型的数据发送到指定的策略配置文件,由该文件配置执行的动作,该文件经过hash加密导入数据库。
1. 根据客户端的主机名地/址过滤邮件,可以是单个ip,网段ip,域名,主机名。
vi /etc/postfix/main.cfsmtpd_client_restrictions = check_client_access hash:/etc/postfix/access //指定策略文件和hash数据库位置下面设置策略文件:vi /etc/postfix/access192.168.4 REJECT //也可以使用DISCARD丢弃192.168.4.1 OK REJECTpostmap /etc/postfix/access //该命令用于将策略文件hash一下加入数据库//客户端地址可能是邮件真实的来源地,而helo信息只是客户端告知的地址//客户端的信息是2根据hello信息中的主机名地址过滤配置main.cfsmtpd_helo_required = yes //要求必须使用helo命令smtpd_helo_restrictions = reject_invalid_hostname //拒绝使用无效主机名的主机3根据发件人地址过滤邮件smtp_sender_login_maps =mysql:/etc/postfix/mysql_virtual_sender_maps.cf, //指定mysql类型的查询表文件和别名文件mysql:/etc/posfix/mysql_virtual_alias_maps.cfsmtpd_sender_restrictions =permit_mynetworks,reject_sender_login_mismatch, //发件人与登录用户不匹配时拒绝reject_non_fqdn_sender, //发件人地址不属于合法FQDN时拒绝reject_unknown_sender_domain, //发件人地址未知或不存在时拒绝//以上可以防止通过发信认证的用户伪造mail from 信息check_sender_access hash:/etc/postfix/sender_access //用于指向含有邮件地址域名地址的查询表,即rcpt to: 提供的信息---实际上是收件人地址如:vi /etc/postfixsender_accessREJECTmarketing@ REJECT REJECT REJECTpostmap /etc/postfix/sender_access4根据收件人地址过滤smtpd_recipient_restrictions =permit_mynetworks, //允许本邮件系统发出的邮件permit_sasl_authenticated, //允许通过sasl认证的用户作为发件人reject_unauth_destination, //收件人地址域不包括在postfix授权网络内时拒绝reject_non_fqdn_recipient, //收件人地址域不属于合法FQDN时拒绝reject_unknow_recipient_domain //收件人地址域或不存在时拒绝。
Linux邮件服务器

Service dovecot start
7、测试邮件的收发:
建立两个用户sutdent和teacher,在outlook中配置这两个帐号,并发送、接收邮件进行测试。
mynetworks = 192.168.1.0/24
使用:wq保存退出。
5、修改dovecot服务(POP3服务,用来收取邮件)的配置文件 dovecot.conf文件里的参数。
定位到dovecot.conf 的目录:cd /etc
编辑dovecot.conf配置文件: vi dovecot.conf
mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain
注意,在以后一行,添加如下参数:
myhostname =
mydomain =
大概在第15行加入protocols = pop3
在第23行修改为pop3_listen = [192.168.1.1]
这里的192.168.1.1是邮件服务器地址,请根据你的实际使用地址配置。
6、启动postfix和dovecot服务:
Service postfix start
cp main.cf.default main.cf
3、然后在mian.cf配置文件中修改相关参数,执行如下命令:
vi main.cf(打开main.cf配置文件)
在169行mydestination = $myhostname, localhost.$mydomain, localhost后添加逗号“,”,再添加一个参数$mydomain。修改完毕后如下所示:
在红旗Linux中打开一个系统终端,使用纯文本方式配置邮件服务器:
Linux怎么安装配置Postfix

Linux怎么安装配置PostfixPostfix是一款用法灵活的电子邮件应用程序,那么大家知道Linux怎么安装配置Postfix吗?今天店铺与大家分享下Linux安装配置Postfix的具体操作步骤,有需要的朋友不妨了解下。
Linux安装配置Postfix方法postfix的产生是为了替代传统的sendmail.相较于sendmail,postfix在速度,性能和稳定性上都更胜一筹。
现在目前非常多的主流邮件服务其实都在采用postfix. 当我们需要一个轻量级的的邮件服务器是,postfix不失为一种选择。
1. postfix是免费的:postfix想要作用的范围是广大的Internet用户,试图影响大多数的Internet上的电子邮件系统,因此它是免费的。
2. 更快:postfix在性能上大约比sendmail快三倍。
一部运行postfix的台式PC每天可以收发上百万封邮件。
3. 兼容性好:postfix是sendmail兼容的,从而使sendmail用户可以很方便地迁移到postfix。
Postfix支持/var[/spool]/mail、/etc/aliases、NIS、和 ~/.forward 文件。
4. 更健壮:postfix被设计成在重负荷之下仍然可以正常工作。
当系统运行超出了可用的内存或磁盘空间时,postfix会自动减少运行进程的数目。
当处理的邮件数目增长时,postfix运行的进程不会跟着增加。
5. 更灵活:postfix是由超过一打的小程序组成的,每个程序完成特定的功能。
你可以通过配置文件设置每个程序的运行参数。
6. 安全性postfix具有多层防御结构,可以有效地抵御恶意入侵者。
如大多数的postfix程序可以运行在较低的权限之下,不可以通过网络访问安全性相关的本地投递程序等等。
下面来介绍linux上如何搭建和配置postfix服务:1.关掉sendmail相关的所有服务,最好是直接卸载sendmail.# service sendmail stop# chkconfig sendmail off#rpm -qa | grep sendmail | xargs rpm -e2.安装postfix.redhat6.0以上版本应该是默认集成了postfix服务的,假如没有安装的话,可以手动安装。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Linux下的邮件服务器Postfix(一)在Linux下1、挂载光驱建立DNS服务器的MX记录:正向:
反向:
2、创建用户和密码:
看一下邮箱邮件默认保存在这里:
3、安装Postfix包,开启Postfix服务:
4、关闭sendmail服务:
5、编辑/etc/postfix/main.cf文件
找到这几项修改其余不改:
myhostname = 邮件主机的完整名称
mydomain = 邮件主机域名
myorigin = $mydomain(表示所有)设置发件人邮件地址的网域名
inet_interfaces = all (表示监听所有端口)监听端口【把下面的inet_interfaces=localhost
注释掉】
mydestination = $myhostname, $mydomain(表示所有)指定接收邮件时收件人的域名mynetworks = 192.168.1.0/24, 127.0.0.0/8(192.168.1.0/24表示这个网段,127.0.0.0/8表示本
地)设置可以为其转发邮件的网络
relay_domains = $mydestination(表示所有)设置可以为其转发邮件的域名
6、重新启动服务:
7、验证:发信:
#telnet 25 telnet到邮件服务器的25号端口
helo 用helo或ehlo介绍自己(可以不写)
mail from:li@ 发信人地址
rcpt to:gen@ 收件人地址
data 表示开始输入邮件正文
Hello! 邮件正文
.新起一行以“.”表示正文结束
quit 退出telnet
收信:
Linux下的邮件服务器Postfix(二)windows下第三方软件在(一)的基础上作:
1、安装软件包dovecot、perl-DBI和mysql:
2、修改主配置文件/etc/dovecot.conf
3、开启服务重启服务器:
4、将windows的首选DNS指向写成DNS服务器IP:
5、验证:安装一个收发邮件的软件,然后在用windows自带的邮件收发软件(开始---程序
---Outlook Express)互相测试:
Windows自带的:
工具-----账户-----添加-----邮件------
软件安装完后:
开始----程序-----找到刚安装的收发邮件的软件Windows Live Mail点开
发一封邮件试一下(抄送是同时发给谁):
这里有可能被认为是垃圾邮件:
再用另一种软件(pine)测试一下:在windows中安装这个软件(这个软件可以在Linux里用但要依赖很多包所以这里只在windows里试一下):
再选几个OK或是就进入:
点回车:
选择S项:
选中前四一项一项调(选中后双击可调,回车确定):
到li中查看一下:
设置Postfix服务器邮件转发和用户的别名
在(一)(二)的基础上(这个大致写一下):
1、编辑配置文件/etc/aliases
文件的记录格式(在最下面添加)
用户的别名(假名):用户的真名
admin: root 邮件的别名(发给admin也就是发给root)
group: user1,user2邮件的群发(发给group也就是发给user1、user2….. user1:root@邮件转发(将发给user1的邮件发给root用户)2、修改aliases文件后更新aliases.db文件
postalias hash:/etc/aliases
3、刷新服务器。
设置SMTP的用户认证(这个也大致写一下)
只有本域的用户才能收发邮件,外部的人需要通过认证才能收发邮件:
1、确认SMTP认证需要的软件包是否安装。
(默认已经安装过)
#rpm -qa |grep cyrus-sasl
cyrus-sasl-plain-2.1.22-4
cyrus-sasl-2.1.22-4
cyrus-sasl-devel-2.1.22-4
cyrus-sasl-lib-2.1.22-4
2、配置sasl认证服务,使用shadow的密码验证机制
# vim /etc/sysconfig/saslauthd
MECH=shadow
3、开启认证服务:service saslauthd start
4、设置开机自动启动:chkconfig saslauthd on
5、测试SMTP认证
/usr/sbin/testsaslauthd -u user1 -p user1
0: OK "Success." =>帐号验证成功了
6、设置postfix启用SMTP认证:
#vi /etc/postfix/main.cf 共添加5行
第一行内容smtpd_sasl_auth_enable = yes 启用SASL作为SMTP认证
第二行smtpd_recipient_restrictions=permit_mynetworks permit_sasl_authenticated permit_auth_destination reject 允许通过SASL认证的用户发信(这三句中间可只空一格)第三行内容smtpd_client_restrictions = permit_sasl_authenticated禁止没通过认证的客
户端向服务器发起smtp连接
第四行内容broken_sasl_auth_clients = yes 兼容非标准SMTP认证
第五行内容smtpd_sasl_security_options = noanonymous 不使用匿名认证
6、重新载入配置:postfix reload
7、验证:命令行客户端登录方式验证SMTP认证:
telnet 192.168.3.10 25
ehlo (注意这里用命令ehlo才能看到认证结果,不能输错,用先helo显示不出要得到的结果,切记)
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
当出现红色部分内容说明SMTP认证成功
Postfix服务器(三)基于web(网页)的邮件系统
在(一)(二)的基础上建立:
1、安装squirrelmail、httpd、php、php-cli、php-common和php-mbstring软件包若装机
时软件开发的勾打上在默认情况下有的包已安装则只需安装squirrelmail、php-mbstring这两个包即可
2、配置Squirrelmail:/usr/share/squirrelmail/config/conf.pl
3、重新启动相关服务:
4、访问:在IE中输入/webmail:。