菜鸟学Linux 第060篇笔记 mail server概念,postfix 编译

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

菜鸟学Linux 第060篇笔记 mail server概念,postfix 编译


Mail Server


TLS: Transport Layer Security

SMTP: Simple Mail Transfer Protocol

ESMTP: Extended Simple Mail Transfer Protocol


POP3: Post Office Protocol vertion 3

IMAP4: Internet Mail Access Protocol (消耗资源大,但功能也相对强)



UUCP: Unix to Unix CoPy

Unix 主机复制文件的协议

SMTP: (25/tcp)

C/S 



邮件传输 MT (Mail Transfer)

邮件投递 MD (Mail Delivery)

邮件用户 MU (Mail User)

邮件用户代理 MUA (Mail User Agent)

邮件传输代理 MTA (Mail Transfer Agent)

邮件投递代理 MDA (Mail Delivery Agent)

邮件取回代理 MRA (Mail Retrieval Agent)

MUA 从 MRA 取邮件 用 POP3 or IMAP4

LMTP Local Mail Transfer Protocol

smtpd

SMTP Simple Mail Transfer Protocol




邮件传递过程

MUA --> smtp --> SMTPD --> smtp --> SMTPD --> MDA --> MUA




Open Relay: 开放式中继 (一般不允许中继)



SASL:  Simple Authentication Secure Layer 简单认证安全层 协议



WebMail 


LDAP: Lightweight Directory Access Protocol

是一个可以提供快速检索的协议,比mysql检索的速度快10倍

缺点 写的速度慢

虚拟用户 仅用于访问某服务的数字标识

用户: 字符串 凭证(加密存放)



组建软件

MTA 邮件传输代理 Mail Transfer Agent  SMTP服务器  (实现的软件)

sendmail, uucp

单体结构, SUID, 配置文件语法不好理解(m4编写)

qmail

postfix 模块化设计,安全,跟sendmail兼容,效率高

exim

Exchange (Windows, 异步消息协作平台)

SASL: v2

cyrus-sasl(saslauthd) 框架

courier-authlib

MDA 邮件投递代理 Mail Delivery Agent

procmail (sendmail)

maildrop

MRA 邮件取回代理 Mail Retrieval Agent (pop3, imap4) 实现软件

cryus-imap

dovecot


MUA 邮件用户代理 Mail User Agent

Outlook Express, Outlook

Foxmail

Thunderbird

Evolution

mutt(文本界面)


WebMail

Openwebmail   (perl)

Squirrelmail  (php)

Extmail (Extman管理组件) (perl)

EOS(Extmail OS), CentOS




邮件服务器布署

Postfix + SASL (courier-authlib) 发邮件

Dovecot + MySQL 收邮件

Webmail: Extmail + Extman + httpd


postfix: rpm 包不支持虚拟用户




1. 布署postfix

# service sendmail stop

# chkconfig sendmail off

# rpm -e --nodeps sendmail

确保linux系统里已经安装了MySQL 前边章节有,这里不再详解其安装过程


# groupadd -g 2525 postfix

# useradd -g 2525 -u 2525 -M -s /sbin/nologin postfix

# groupadd -g 2526 postdrop

# useradd -g 2526 -u 2526 -M -s /sbin/nologin postdrop

# make makefiles 'CCARGS=-DASH_MYSQL -I/usr/local/mysql/include -DUSE_SASL_AUTH 

-DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS ' 

'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/lib/sasl2 

-lsasl2 -lssl -lcrypto' (此为一行命令)

# make

# make install


启动postfix

# postfix start

postfix 配置文件:

postfix模块化:

master: /etc/postfix/master.cf

mail: /etc/postfix/main.cf

参数 = 值  (参数必须写在行的绝对行首,以空白开头的行被认为是上一行的延续)

postconf (Postfix configuration utility) 

-d     Print main.cf  default  parameter  settings  instead  of

   actual  settings.   Specify  -df  to fold long lines for

   human readability (Postfix 2.9 and later).

   

-n     Show only configuration parameters  that  have  explicit

           name=value  settings  in  main.cf.   Specify -nf to fold

           long  lines  for  human  readability  (Postfix  2.9  and

           later).

   

-m     List  the  names of all supported lookup table types. In

           Postfix configuration files, lookup tables are specified

           as  type:name,  where  type  is  one of the types listed

           below. The table name syntax depends on the lookup table

           type as described in the DATABASE_README document.

   

-A     List the available SASL client plug-in types.  The  SASL

           plug-in  type  is  selected  with  the smtp_sasl_type or

           lmtp_sasl_type configuration  parameters  by  specifying

           one of the names listed below.

           cyrus  This  client plug-in is available when Postfix is

                  built with Cyrus SASL support.

-e     Edit the main.cf configuration file, and update  parame-

           ter  settings  with  the "name=value" pairs on the post-

           conf(1) command line.


smtp状态码

1xx 纯信息

2xx 正确

3xx 上一步操作尚未完成,需要继续补充

4xx 暂时性错误

5xx 永久性错误

smtp协议原语(命令)telnet localhost 25

helo (smtp协议) hostname

ehlo (esmtp协议) hostname

mail from: root

rcpt to  (recipient 接受方)

data

.

alias: 邮件别名

abc@mysky.com: postmaster@mysky.com

/etc/aliases --> hash --> /etc/aliases.db

# newaliases



postfix默认把本机的IP地址所在的网段识别为本地网络,并且为之中继邮件;

本文转自Winthcloud博客51CTO博客,原文链接http://blog.51cto.com/winthcloud/1886015如需转载请自行联系原作者



Winthcloud

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
2月前
|
安全 Linux
Linux Centos通过mail向QQ邮箱发邮件
【8月更文挑战第20天】在 CentOS 上配置使用 `mail` 命令向 QQ 邮箱发送邮件涉及几个步骤。首先确保已安装 `mailx`;接着编辑 `/etc/mail.rc` 文件来配置发件信息,包括设置发件邮箱、SMTP 服务器及授权码。最后,通过 `echo` 命令结合 `mail` 发送邮件。需登录 QQ 邮箱开启 SMTP 服务并获取授权码用于安全验证。
127 3
|
7天前
|
Ubuntu Java Linux
Linux操作系统——概念扫盲I
Linux操作系统——概念扫盲I
22 4
|
2月前
|
Unix Linux 开发工具
linux笔记 diff及patch的制作与使用
这篇文章是关于Linux系统中使用`diff`命令生成补丁文件以及使用`patch`命令应用这些补丁的详细教程和实战案例。
44 2
linux笔记 diff及patch的制作与使用
|
2月前
|
存储 缓存 Linux
在Linux中,文件系统概念是什么?
在Linux中,文件系统概念是什么?
|
2月前
|
Linux 开发者
Linux源码阅读笔记18-插入模型及删除模块操作
Linux源码阅读笔记18-插入模型及删除模块操作
|
2月前
|
数据采集 Linux
Linux源码阅读笔记20-PCI设备驱动详解
Linux源码阅读笔记20-PCI设备驱动详解
|
2月前
|
Linux
Linux源码阅读笔记19-插入删除模块实战
Linux源码阅读笔记19-插入删除模块实战
|
2月前
|
存储 安全 Linux
在Linux中,用户和组的概念是什么?
在Linux中,用户和组的概念是什么?
|
2月前
|
Linux 持续交付 虚拟化
在Linux中,Docker和容器虚拟概念是什么?
在Linux中,Docker和容器虚拟概念是什么?
|
2月前
|
Ubuntu Linux Shell
【linux】PetaLinux 2024.1安装笔记
【linux】PetaLinux 2024.1安装笔记
116 0