Postfix is a free mail server software designed for use on Unix family operating systems. It belongs to the class of message transport agents (MTAs), which carry out the transfer of e-mails between email clients of users. The Ubuntu Linux + Postfix bundle is extremely popular for organizing such mail servers. Their configuration will be discussed in the article below.
Preparing to Install Postfix
Before you begin installing Postfix, you need to complete several procedures to properly configure the resource. It is assumed that the Ubuntu Linux operating system is already installed and ready for operation on the server.
Set the correct host name
, Postfix , . : (Fully Qualified Domain Name, FQDN). ?
. Linux , , , linux, debian, ubuntu. FQDN : . , mail.yourdomain.co.
mail – , yourdomain.com – . FQDN, , -, Postfix . FQDN email-.
FQDN , Ubuntu : hostname –f.
FQDN, hostnamectl. sudohostnamectlset-hostnameyour-fqdn.
. hostname –f.
Postfix, . . Postfix (/var/log/mail.log). Postfix, .
date, Ubuntu: user@mail:~$ date. Sun Dec 31 06:37:19 BST 2017.
DNS
- MX. MX- ( “mail exchanger”) , mail.yourdomain.com . MX @ mail.yourdomain.com.
- A. - FQDN IP-: mail.yourdomain.com <IP->.
- PTR. PTR- ( “pointer record”) IP- FQDN. A DNS. <IP-> mail.yourdomain.com
3 -. , , , .
A PTR . , . PTR , .
PTR IP-, : dig -x <IP> +short host <IP>.
, Postfix.
Postfix
Postfix, Ubuntu:
- sudo apt-get update;
- sudo apt-get install postfix -y.
Postfix :
- No configuration – - .
- Internet Site – Postfix .
- Internet with smarthost – Postfix , -.
- Satellite system – , .
- Local only – .
, , @. , – info@yourdomain.com, yourdomain.com.
Postfix Ubuntu .
Postfix , /etc /etc/postfix/main.cf. Postfix :
user@mail:~$ sudo postconf mail_version
mail_version = 2.11.0
netstat, Postfix «» TCP- 25: sudo netstat –lnpt.
, , 25 . nmap. - Linux (, ), IP : sudo nmap <IP >.
, 25 , . , iptables . . -, .
, Ubuntu. user, user@yourdomain.com. ( root) Gmail, "" .
Postfix /usr/sbin/sendmail sendmail. , Gmail, : echo«» | sendmailyouraccount@gmail.com
sendmail, «», Gmail. Google. , : Postfix, .
, , Postfix . , , /var/spool/mail/<username> /var/mail/<username>. : postconf ail_spool_directory.
Postfix /var/log/mail.log.
-
Postfix - spamassassin spamc: apt-get install spamassassin spamc
SpamAssassin – -, . .
- /etc/mail/spamassassin/local.cf, . , , :
report_safe 0
required_score 8.0
rewrite_header Subject [SPAM]
- report_safe 0. , rewrite_header. 1, .
- required_score -. , . , , required_score 8.0 10.0.
, - :
# systemctl enable spamassassin
# systemctl start spamassassin
# sa-update
Postfix SpamAssassin
Postfix -, -:
# useradd spamd -s /bin/false -d /var/log/spamassassin
/etc/postfix/master.cf:
spamassassin unix - n n - - pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
, spamassassin ( content_filter):
-o content_filter=spamassassin
, Postfix, :
# systemctl restart postfix
- .
SpamAssassin, . ( , Gmail ) . , :
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
, , Gmail, :
Verify SpamAssassin Detecting Spam Mails
, :
# journalctl | grep spam
: Monitor SpamAssassin Mail Logs
, spamassassin : # spamassassin -D < /usr/share/doc/spamassassin-3.4.0/sample-spam.txt
, : TestSpamAssassinSpamfromCommandline.
, , – - . , .
, Ubuntu Linux Postfix , . Ubuntu, 12.04.