SMTP
Install: postfix
sudo aptitude -y install postfix : Please select the mail server configuration type that best meets your needs. No configuration: Should be chosen to leave the current configuration unchanged. Internet site: Mail is sent and received directly using SMTP. Internet with smarthost: Mail is received directly using SMTP or by running a utility such as fetchmail. Outgoing mail is sent using a smarthost. Satellite system: All mail is sent to another machine, called a 'smarthost', for delivery. Local only: The only delivered mail is the mail for local users. There is no network. 1. No configuration 3. Internet with smarthost 5. Local only 2. Internet Site 4. Satellite system General type of mail configuration: 2 : System mail name: xxxxxx.jp :
è¨å®
- /etc/postfix/main.cf
myhostname = mail.example.com mydestination = example.com, mail.example.com, localhost.localdomain, localhost mynetworks = 192.168.0.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 inet_interfaces = all home_mailbox = Maildir/
- /etc/postfix/master.cf
: # submission inet n - - - - smtpd submission inet n - - - - smtpd : smtps inet n - - - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes :
åèµ·å
sudo service postfix restart
ã¡ã¼ã«éããã確èª
ã¡ã¼ã«éããããã« mailutils ã¤ã³ã¹ãã¼ã«
sudo aptitude -y install mailutils
ãã¼ã«ã«ããã¡ã¼ã«éä¿¡
mail [email protected] cc: Subject: test from mail server # C-d
å±ããã確èª
cd Maildir/new/ ls xxxxxxxxxx.xxxxxxxxxxxxxxxxxx.xxxxxxxxxx cat xxxxxxxxxx.xxxxxxxxxxxxxxxxxx.xxxxxxxxxx : Subject: test from mail server X-Mailer: mail (GNU Mailutils 2.1) :
ãã¡ã¤ã¢ã¼ã¦ã©ã¼ã«è¨±å¯
sudo ufw allow smtp sudo ufw allow ssmtp sudo ufw allow imaps sudo ufw allow imap2 sudo ufw status
証ææ¸ã®ä½æ
sudo su - cd /etc/ssl/private openssl genrsa -des3 1024 > mail.key Generating RSA private key, 1024 bit long modulus : Enter pass phrase: Verifying - Enter pass phrase:
ãã©ã¤ãã¼ããã¼ãããã¹ã¯ã¼ããåé¤ã
openssl rsa -in mail.key -out mail.key Enter pass phrase for test.key: #åè¿°ã§å ¥åãããã¹å ¥å writing RSA keyã
ãããªãã¯ãã¼ã®çæ
cd /etc/ssl/certs openssl req -utf8 -new -key /etc/ssl/private/mail.key -x509 -days 365 -out mail.pem -set_serial 0 #質åã«çãã Country Name (2 letter code) [AU]:JP :
Config: dovecot
#ssl_cert_file = /etc/ssl/certs/dovecot.pem #ssl_key_file = /etc/ssl/private/dovecot.pem ssl_cert_file = /etc/ssl/certs/mail.pem ssl_key_file = /etc/ssl/private/mail.key
restart
sudo service dovecot restart
Config: postfix
- /etc/postfix/main.cf
# smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem # smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_cert_file=/etc/ssl/certs/mail.pem smtpd_tls_key_file=/etc/ssl/private/mail.key
restart
sudo service postfix restart
saslauthd*1
sudo aptitude install -y sasl2-bin
- /etc/default/saslauthd
# Should saslauthd run automatically on startup? (default: no) # START=no START=yes
Config: postfix
- /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_application_name = smtpd smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
Restart: postfix
sudo service postfix restart
chroot
ubuntuã®postfixã¯æ¨æºã§chrootã使ç¨ãã¦èµ·åãã¦ãããããã®ã§ãsaslauthdã¨éä¿¡ã§ããããã«æ¬¡ã®ããã«ã¿ã¤ãããå¿ è¦ããããããªãä¸è¨åèãµã¤ãåç §ã
ããå°ãã¹ãã¼ããªæ¹æ³ãªãã®ããªï¼
#åèãµã¤ãã®ããã«åé¤ããã®ã¯æãã®ã§ãªãã¼ã ãã¦ã¿ã sudo mv /var/run/saslauthd /var/run/saslauthd_bak #æ°ãã /var/spool/postfix/ 以ä¸ã«ãã£ã¬ã¯ããªä½æ /var/run/saslauthd sudo mkdir -p /var/spool/postfix/var/run/saslauthd sudo ln -s /var/spool/postfix/var/run/saslauthd /var/run sudo chgrp sasl /var/spool/postfix/var/run/saslauthd sudo adduser postfix sasl
Restart: saslauthd
sudo service saslauthd restart
Link
åèãµã¤ãã
- Ubuntu でメールサーバー
- サポート / postfix、dovecot の証明書の作成
- Dovecot で IMAP サーバ構築
- Carpe Diem 2011年11月
- Postfixのぺーじ−SMTP Auth 対応版 Postfix インストールの記録
- uayeb » メールサーバの設定(postfix, dovecot, sasl2=saslauthd)
- メールサーバの設定(postfix・dovecot):tech.ckme.co.jp
- Ubuntu日本語フォーラム / Postfix SMTP-Authの設定でなかなか認証してくれない。
- Postfix - Community Help Wiki
*1:å¤æ´:20120519