# # # #smtp Protocol # # #
The SMTP protocol is Simple Mail transfer.
(1) First do DNS resolution
Vim/etc/named.conf
Listen-on Port 53 {127.0.0.1;};
Listen-on-v6 Port 53 {:: 1;};
allow-query {localhost;};
Dnssec-validation No;
Vim/etc/named.rfc1912.zones
Zone "Westos.com" in {
Type master;
File "Westos.com.zone";
allow-update {none;};
};
Zone "Linux.com" in {
Type master;
File "Linux.com.zone";
allow-update {none;};
};
Vim Westos.com.zone
$TTL 1D
@ in SOA dns.westos.com. Root.westos.com. (
0; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); Minimum
NS dns.westos.com.
DNS A 172.25.254.109
westos.com. MX 1 172.25.254.109.
Vim Linux.com.zone
$TTL 1D
@ in SOA dns.linux.com. Root.linux.com. (
0; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); Minimum
NS dns.linux.com.
DNS A 172.25.254.109
Linux.com. MX 1 172.25.254.209.
Vim/etc/postfix/main.cf
Myhostname = maillinux.linux.com
MyDomain = linux.com
Myorigin = $mydomain
113 Inet_interfaces = All
#inet_interfaces = localhost
164 mydestination = $myhostname, $mydomain, localhost
Systemctl Restart Postfix.service
(2) Outbound address spoofing
cd/etc/postfix/
Vim generic
[Email protected] [Email protected]
|| ||
Real address fake address
Postmap generic
postconf-d | grep generic
Postconf-e "Smtp_generic_maps =hash:/etc/postfix/generic"
Systemctl Restart Postfix.service
(3) Remote Mail sending
Yum Install Telnet-y # #安装
Telnet 172.25.254.109 25
[[Email protected] ~]# Telnet 172.25.254.109 25
Trying 172.25.254.109 ...
Connected to 172.25.254.109.
Escape character is ' ^] '.
Mailwestos.westos.com ESMTP Postfix
EHLO Hello
250-mailwestos.westos.com
250-pipelining
250-size 10240000
250-vrfy
250-etrn
250-enhancedstatuscodes
250-8bitmime
DSN
Mail from
501 5.5.4 Syntax:mail from:<address>
Mail From:[email protected]
2.1.0 Ok
RCPT To:[email protected]
2.1.5 Ok
Data
354 END data with <CR><LF>.<CR><LF>
Afsa
Dsd
Sdw
SwS
.
2.0.0 ok:queued as 830d917e861
Quit
221 2.0.0 Bye
Connection closed by foreign host.
# #在邮件发送中 "." Indicates the end.
Smpt Protocol (i)