CentOS 6 1. 移除sendmail 安裝postfix
1 2 3 |
# /etc/init.d/sendmail stop # yum remove sendmail # yum install postfix cyrus-sasl mailx |
2. Gmail username and password Simple Authentication and Security Layer (SASL)
1 2 3 |
# echo "smtp.gmail.com GMAIL_USERNAME:GMAIL_PASSWORD" > /etc/postfix/sasl_passwd # chmod 600 /etc/postfix/sasl_passwd # postmap hash:/etc/postfix/sasl_passwd |
3. Postfix 設定 vim /etc/postfix/main.cf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
myhostname = xxxx.hang321.net mydomain = hang321.net # use Gmail SMTP server. Remember to set on Google to allow access with less secure method relayhost = smtp.gmail.com:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous # set the required TLS options smtp_tls_CApath = /etc/ssl/certs smtp_tls_security_level = secure smtp_tls_mandatory_protocols = TLSv1 smtp_tls_mandatory_ciphers = high smtp_tls_secure_cert_match = nexthop |
CApath here, not CAfile 4. 重新啟動Postfix
1 |
# service postfix restart |
5. Google 安全性設定 https://myaccount.google.com/security 「我的帳戶」> 「低安全性應用程式」專區 > 「安全性較低的應用程式存取權限」旁邊的 [啟用] 6. 測試mail server 是否有正常寄信 寄信俾自己
1 2 |
Testing email, tail -f /var/log/maillog to see the result. # echo "body of your email" | mail -s "This is a Subject" [email protected] |
後記: Goolge 可能係最近才有這個安全性設定,大多數reference 都沒有提及,搞到我白忙一場。 不同Linux distro, CA file name 有分別。
最近花了太多時間在MMORPG elder scroll online 上. 幸好 (不幸) 今天PS4 server 又死掉, 走去搞下個docker, 個SSD 都唔夠位放images, 都係早D set 做其他位置好d .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
## installation sudo apt-get install apparmor lxc cgroup-lite sudo apt-get install docker.io ## verification sudo service docker.io start sudo docker run hello-world ## show current images sudo docker images ## view location sudo cat /var/lib/docker/repositories-aufs | python -m json.tool ## change docker image installation directory sudo docker ps -q | xargs docker kill sudo service docker.io stop mkdir /your/path/to/docker && chmod 700 /your/path/to/docker sudo vim /etc/default/docker.io # add new line DOCKER_OPTS="-g /your/path/to/docker" ## as root: su chown root.root /your/path/to/docker mv /var/lib/docker/* /your/path/to/docker/ echo "image location moved, see /etc/default/docker.io for new location" > /var/lib/docker/README ## as normal user sudo service docker.io start sudo docker images ## hellow-world listed |