postfix on openSUSE 11.4

postfix 是邮件服务器,就是发邮件的。

那dovecot就是代收邮件的?

postfix的配置很麻烦,这是我到处抄来的一个配置,同时支持smtp和smtps协议

main.cf

--- main.cf.org	2011-03-20 13:55:24.000000000 +0800
+++ main.cf	2011-03-23 10:00:46.000000000 +0800
@@ -694,3 +694,29 @@
 
 inet_protocols = all
 biff = no
+myhostname = poetpalace.org
+myorigin = $myhostname
+inet_interfaces = all
+mydestination = $myhostname, localhost.$mydomain, localhost, mail.poetpalace.org
+mynetworks = 127.0.0.0/8
+#relay_domains = $mydestination, qq.com, gmail.com
+
+smtp_use_tls=yes
+smtpd_use_tls=yes
+smtp_tls_note_starttls_offer=yes
+smtpd_tls_key_file=/etc/postfix/smtpd.pem
+smtpd_tls_cert_file=/etc/postfix/smtpd.pem
+smtpd_tls_CAfile=/etc/postfix/smtpd.pem
+smtpd_tls_loglevel=1
+smtpd_tls_received_header=yes
+smtpd_tls_session_cache_timeout=3600s
+tls_random_source=dev:/dev/urandom
+
+smtpd_sasl_auth_enable = yes
+smtpd_delay_reject = yes
+broken_sasl_auth_clients = yes
+smtpd_sasl_security_options=noanonymous
+smtpd_sasl_type=dovecot
+smtpd_sasl_path=private/auth
+smtpd_client_restrictions=permit_sasl_authenticated
+smtpd_recipient_restrictions=permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

master.cf

--- master.cf.org	2011-03-20 13:55:33.000000000 +0800
+++ master.cf	2011-03-23 10:05:38.000000000 +0800
@@ -15,8 +15,8 @@
 #submission inet n      -       n       -       -       smtpd
 #     -o smtpd_etrn_restrictions=reject
 #     -o smtpd_client_restrictions=permit_sasl_authenticated,reject
-#smtps    inet  n       -       n       -       -       smtpd
-#  -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
+smtps    inet  n       -       n       -       -       smtpd
+  -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
 #submission   inet    n       -       n       -       -       smtpd
 #  -o smtpd_etrn_restrictions=reject
 #  -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes

还有几个数据库文件要生成

newaliases #这个生成/etc/aliases.db
postmap hash:/etc/postfix/relay
postmap hash:/etc/postfix/virtual

好了,service postfix restart,提示说done了

service postfix status,没结果,没说running 也没说stop。

nmap localhost 果然没发现25和465端口。

tail -f /var/log/mail,发现报错,google之……然后发现是个很orz的问题,原来就好像弄了蛮久的,不过没做笔记,忘了。

vim /etc/services,查找465,看看上面是什么:一个叫urd的协议,这是啥?注释掉,加上一行 smtps 465/tcp。

service postfix restart

done

updatedupdated2022-02-222022-02-22