Linux postfix配置方法
第七题 配置邮件服务器
system1和systemc2分别执行
[root@system2 ~]# postconf -e inet_interfaces=loopback-only
[root@system2 ~]# postconf -e mydestindation=
[root@system2 ~]# postconf -e local_transport=error:err
[root@system2 ~]# postconf -e relayhost=[mail.group8.example.com]
[root@system2 ~]# postconf -e myorigin=server.group8.example.com
[root@system2 ~]# systemctl enable postfix
[root@system2 ~]# systemctl restart postfix
[root@system2 ~]# echo "hello" | mail -s testmail dave
参数解释:
relayhost 设定中心邮件服务器
收到的邮件全部转交给配置的服务器
inet_interfaces只在本地环回接口接受邮件
loopback-only表示只接受本地邮件,只在127.0.0.1监听25号端口deli
myorigin 设定发信人的域
假设发信人为lily,那么会将信件的发信人改为lily@server.group8.example.com
如果配置选项为188.com,那么发信人lily就会被改为lily@188.com
mydestindation 将接收到的任何邮件都当做外部邮件,这样邮件才会转发的到中心邮件服务器
收到的所有信件,不管收信人是谁,都不会保存。
可以理解为收到的所有的邮件都要转出去。
local_transport
当配置local_transport=error: local delivery disabled时,表示禁止本地分发邮件到本地用户邮箱
mynetworks 信任的网络
只接受配置选项中网络的邮件
验证:
[root@system1 postfix]# curl http://server.group8.example.com/pub/received_mail/8
From root@server.group8.example.com Wed Apr ::
Return-Path: <root@server.group8.example.com>
X-Original-To: dave@server.group8.example.com
Delivered-To: dave@server.group8.example.com
Received: from system1.group8.example.com (system1.group8.example.com [172.24.8.11])
by server.group8.example.com (Postfix) with ESMTP id B5F0E3089EFD
for <dave@server.group8.example.com>; Wed, Apr :: + (CST)
Received: by system1.group8.example.com (Postfix, from userid )
id 9B87C22E33F0; Wed, Apr :: + (CST)
Date: Wed, Apr :: +
To: dave@server.group8.example.com
Subject: testmail
User-Agent: Heirloom mailx 12.5 //
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <.9B87C22E33F0@system1.group8.example.com>
From: root@server.group8.example.com (root) hello
紧急情况补救措施:
打开配置文件,搜索配错了的某一项,然后将该项进行删除,重新配置即可
vim /etc/postfix/main.cf
至此,考试内容结束
实验:配置只发邮件服务器
首先在两台机器上分别执行实验脚本
[root@server0 ~]# lab smtp-auth setup
[root@desktop0 ~]# lab smpt-auth setup
Server0:
[root@server0 ~]# postconf -e "relayhost=[smtp0.example.com]:587"
[root@server0 ~]# postconf -e "inet_interfaces=loopback-only"
[root@server0 ~]# postconf -e "mynetworks=127.0.0.0/8 [::1]/128"
[root@server0 ~]# postconf -e "myorigin=desktop0.example.com"
[root@server0 ~]# postconf -e "mydestination="
[root@server0 ~]# postconf -e "local_transport=error: local delivery disabled"
从下开始与普通邮件不同
[root@server0 ~]# postconf -e "smtp_use_tls=yes"
将用户名和密码以tls的形式加密
[root@server0 ~]# postconf -e "smtp_tls_loglevel=1"
日志级别
[root@server0 ~]# postconf -e "smtp_tls_security_level=encrypt"
信息加密
[root@server0 ~]# postconf -e "smtp_sasl_auth_enable=yes"
启用smtp发送验证
[root@server0 ~]# postconf -e "smtp_sasl_security_options=noanonymous"
禁止匿名
[root@server0 ~]# postconf -e "smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd"
用户密码所在文件
Server0配置
解释:只要是将邮件转给smtp0.example.com的587端口的,我们就用student:student
[root@server0 ~]# vim /etc/postfix/sasl_passwd
smtp0.example.com: student:student
修改密码文件权限为0600
[root@server0 ~]# chmod /etc/postfix/sasl_passwd
修改文件格式
[root@server0 ~]# postmap /etc/postfix/sasl_passwd
其实真正使用的文件为/etc/postfix/sasl_passwd.db这个文件来验证也就是修改格式后的文件
重载服务
[root@server0 ~]# systemctl reload postfix
发送邮件
[root@server0 ~]# mail -s "server0 sasl tls" student@desktop0.example.com
sasl tls test. 这一行写邮件内容
. 用.来结束邮件内容
EOT
收信
[root@server0 student]# su student
[student@server0 ~]$ mutt -f imaps://imap0.example.com
验证:
Server0:
[root@server0 student]# lab-smtp-auth grade
Checking for Postfix configuration... PASS
Checking for Postfix TLS and SASL configuration... PASS
Desktop0: [root@desktop0 ~]# lab smtp-auth grade
Checking E-mail is present in student inbox... PASS
至此,实验结束
如果有什么建议或者意见,请直接在评论区留言或者私信本人,看到了第一时间回复。
本人Linux菜鸟,欢迎各位Linux大神指导。
Linux postfix配置方法的更多相关文章
- Linux时间同步配置方法
由于是在做mongoDB的实验中再一次的遇到了mongos路由节点同步时由于ntp时间的问题导致同步非常的慢.故写了个时间同步的语句===> while :; do rdate -s 192.1 ...
- Linux防火墙配置方法
1)查看防火墙状态 查看防火墙状态: /etc/init.d/iptables status 暂时关闭防火墙: /etc/init.d/iptables stop 重启防火墙: /etc/init.d ...
- Linux下配置ip地址四种方法
linux系统安装完,以后通过命令模式配置网卡IP.配置文件通常是/etc/sysconfig/network-scripts/ifcfg-interface-nameifconfig后显示的内容,l ...
- linux邮件服务器postfix配置实例
linux邮件服务器postfix配置实例(超级详细!!!) 2013-03-13 13:30:21 标签:邮件服务器 linux 1. 系统安装:1)centos4.3 选上MAIL组件里的全部.2 ...
- Linux安装配置php环境的方法
本文实例讲述了Linux安装配置php环境的方法.分享给大家供大家参考,具体如下: 1.获取安装文件: http://www.php.net/downloads.php php-5.3.8.tar.g ...
- Linux 单网卡多 IP 的配置方法
Linux 单网卡多 IP 的配置方法 1 .永久配置的方法: 知道在 Linux 下网卡被称为 eth0,eth1,eth2..... ,所有网卡的配置文件都存储在 /etc/sysconfi ...
- 在Linux下访问Windows共享目录的配置方法
在Linux下访问Windows共享目录的配置方法 1.在Windows上设置一个共享目录 如:将d:\RedHat_disk设置为共享目录 2.在Windows上创建一个用户,如tommy,密码11 ...
- Linux环境下Swap配置方法
Linux环境下Swap配置方法 场景: 今天下午安装一个CentOS6.5操作系统,忘记配置swap分区.看看如何安装系统之后,增加和删除swap分区.方法如下:1.内存占用情况[root@josh ...
- Linux NFS服务器的安装与配置方法(图文详解)
这篇文章主要介绍了Linux NFS服务器的安装与配置方法(图文详解),需要的朋友可以参考下(http://xb.xcjl0834.com) 一.NFS服务简介 NFS 是Network File S ...
随机推荐
- html5画界面常用标签整理
0.顶部一张banner图片横铺 .tl-header{ width: 100%; height: auto; } <section class="tl-header"> ...
- [LeetCode] 70. Climbing Stairs 爬楼梯
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...
- [LeetCode] 59. Spiral Matrix II 螺旋矩阵 II
Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. For ...
- 考前最后的感叹:CSP2019 Bless All! & AFO
因为没有退路,所以勇往直前. ----来自高二老年选手小蒟蒻XY Upd:凉凉了,你们都稳了...我看来是超不过准考证号了qwq[大哭] Upd:来自联考txdy的神仙gcz Upd:久远的回忆:会不 ...
- SpringBoot+Mybatis+MySql 自动生成代码 自动分页
一.配置文件 <!-- 通用mapper --> <dependency> <groupId>tk.mybatis</groupId> <arti ...
- Fiddler如何切换hosts以及切换hosts的另一个神器SwithcHosts
- 《TCP/IP - OSI和TCP/IP分层模型》
一:分层模型 - - OSI 更强调:通信协议必要的功能是什么 - TCP/IP 更强调:在计算机上实现协议应该开发哪种程序 二:为什么会产生协议标准化 (分层模型的产生)? - 由于各个厂商生产 ...
- Scala 函数入门之默认参数和带名参数
Scala 默认参数 在Scala中,有时我们调用某些函数时,不希望给出参数的具体值,而希望使用参数自身默认的值,此时就定义在定义函数时使用默认参数. def sayHello(firstName: ...
- Numpy学习笔记(下篇)
目录 Numpy学习笔记(下篇) 一.Numpy数组的合并与分割操作 1.合并操作 2.分割操作 二.Numpy中的矩阵运算 1.Universal Function 2.矩阵运算 3.向量和矩阵运算 ...
- SpringBoot +MSSQL
____SpringBoot +MSSQL_______________________________________________________________________________ ...