gate# telnet server.corpX.un 25 ... HELO gate.corpX.un ... MAIL FROM: root@gate.corpX.un ... RCPT TO: user1@server.corpX.un ... DATA ... From: root@gate.corpX.un To: user1@server.corpX.un Subject: test test . QUIT
root@server:~# debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" root@server:~# debconf-set-selections <<< "postfix postfix/mailname string corpX.un" root@server:~# apt install postfix root@server:~# debconf-show postfix | grep destinations root@server:~# man 1 postconf root@server:~# man 5 postconf root@server:~# postconf -n root@server:~# postconf -d
!!! В конфигурации остается запрет отправлять почту на сервера с “серыми” ip (на курсах)
# dpkg-reconfigure exim4-config ... intenet site, все остальное по умолчанию ...
[server:~] # cat /etc/rc.conf
... sendmail_enable="YES"
[server:~] # /etc/rc.d/sendmail restart [server:~] # more /etc/mail/sendmail.cf [server:~] # more /usr/share/sendmail/cf/README
Настройка мастер сервера зоны corpX.un
server# nslookup -q=A corpX.un
root@server:~# cat /etc/postfix/main.cf
... mydestination = server.corpX.un, localhost.corpX.un, , localhost, corpX.un ...
root@server:~# postconf root@server:~# service postfix check root@server:~# service postfix reload
[server:~] # cd /etc/mail [server:/etc/mail] # cat server.corpX.un.mc
OSTYPE(freebsd6) FEATURE(use_cw_file) MAILER(local) MAILER(smtp)
[server:/etc/mail] # cat local-host-names
corpX.un
[server:/etc/mail] # make cf [server:/etc/mail] # make install [server:/etc/mail] # /etc/rc.d/sendmail restart
root@gate:~# cat /etc/postfix/main.cf
... mynetworks = ... 192.168.X.0/24 ...
root@gate:~# service postfix reload
[server:/etc/mail] # cat server.corpX.un.mc
OSTYPE(freebsd6) ... FEATURE(access_db, `hash -o -T<TMPF> /etc/mail/access') ... MAILER(local) MAILER(smtp)
[server:/etc/mail] # cat access
192.168.X RELAY
[server:/etc/mail] # make maps [server:/etc/mail] # make install [server:/etc/mail] # /etc/rc.d/sendmail restart
root@server:~# cat /etc/postfix/main.cf
... relayhost = gate.corpX.un ...
root@server:~# service postfix reload
[server:/etc/mail] # cat server.corpX.un.mc
OSTYPE(freebsd6) ... define(`SMART_HOST', `gate.corpX.un') ... MAILER(local) MAILER(smtp)
[server:/etc/mail] # make cf [server:/etc/mail] # make install [server:/etc/mail] # /etc/rc.d/sendmail restart
root@gate:~# cat /etc/postfix/main.cf
... relay_domains = $mydestination, corpX.un
root@gate:~# service postfix reload root@gate:~# tail -f /var/log/mail.log
[gate:/etc/mail] # cat gate.corpX.un.mc
OSTYPE(freebsd6) FEATURE(access_db, `hash -o -T<TMPF> /etc/mail/access') MAILER(local) MAILER(smtp)
[gate:/etc/mail] # make install [gate:/etc/mail] # /etc/rc.d/sendmail restart [gate:/etc/mail] # cat access
corpX.un RELAY
[gate:/etc/mail] # make maps [gate:~] # tail -f /var/log/maillog
# cat /etc/postfix/main.cf
... smtpd_tls_cert_file = /root/server.crt smtpd_tls_key_file = /root/server.key smtpd_use_tls = yes ... smtpd_relay_restrictions = ... permit_sasl_authenticated ... ... smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_sasl_type = dovecot #for kerberos gssapi line_length_limit = 8192
Thunderbird и Roundcube используют 587-й порт
# cat /etc/postfix/master.cf
... smtp inet n - y - - smtpd 587 inet n - y - - smtpd ...
# cat /etc/aliases
... root: userX@isp.un # root: "|logger -t mail-to-root -p mail.info" #nagios: userX@isp.un #nagios: student@corpX.un support: user1, user2 ...
# newaliases # apt install logwatch ... # mail root
Запись A или MX для домена compX.un настраивает преподаватель
server# host compX.un ...
root@server:~# cat /etc/postfix/main.cf
... mydestination = server.corpX.un, localhost.corpX.un, corpX.un, compX.un, localhost virtual_alias_maps = hash:/etc/postfix/virtual ...
root@server:~# cat /etc/postfix/virtual
info@corpX.un user1 info@compX.un user2
root@server:~# postmap /etc/postfix/virtual root@server:~# service postfix reload gate.isp.un$ mail info@corpX.un gate.isp.un$ mail info@compX.un server# mail -u user1 server# mail -u user2
[server:/etc/mail] # cat local-host-names
corpX.un compX.un
[server:/etc/mail] # cat server.corpX.un.mc
OSTYPE(freebsd6) ... FEATURE(virtusertable, `hash -o /etc/mail/virtusertable') ... MAILER(local) MAILER(smtp)
[server:/etc/mail] # cat virtusertable
info@corpX.un user1 info@compX.un user2
[server:/etc/mail] # make maps [server:/etc/mail] # make install [server:/etc/mail] # /etc/rc.d/sendmail restart
# postconf -d | grep mail_name # postconf -e "mail_name = Exchange" # postconf -e 'smtpd_banner = $myhostname ESMTP $mail_name (Windows 2008R2)' # service postfix reload
[server:/etc/mail] # cat server.corpX.un.mc
OSTYPE(freebsd6) ... define(`confSMTP_LOGIN_MSG', `$j Exchange (Windows 2008R2)') ... MAILER(local) MAILER(smtp)
[server:/etc/mail] # make cf [server:/etc/mail] # make install [server:/etc/mail] # /etc/rc.d/sendmail restart
# mailq | grep apache@hoster.bmstu.ru | grep '*' | cut -d'*' -f 1 | postsuper -d -