763751e09b92ab56ae5c04df563184e66bb3f027
Linux/Mail.md
... | ... | @@ -0,0 +1,127 @@ |
1 | +[[_TOC_]] |
|
2 | + |
|
3 | +# Postfix |
|
4 | + |
|
5 | +## インストール |
|
6 | +``` |
|
7 | +# yum install -y postfix cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5 |
|
8 | +``` |
|
9 | + |
|
10 | +## 設定 |
|
11 | +- /etc/postfix/main.cf (抜粋) |
|
12 | +``` |
|
13 | +myhostname = <ホスト>.<ドメイン> |
|
14 | +mydomain = <ドメイン> |
|
15 | +myorigin = $mydomain |
|
16 | +inet_interfaces = all |
|
17 | +mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain |
|
18 | +home_mailbox = Maildir/ |
|
19 | +smtpd_banner = $myhostname ESMTP unknown |
|
20 | +smtpd_recipient_restrictions = |
|
21 | + permit_mynetworks |
|
22 | + permit_sasl_authenticated |
|
23 | + reject_unauth_destination |
|
24 | +message_size_limit = 10485760 |
|
25 | +smtpd_sasl_auth_enable = yes |
|
26 | +local_recipient_maps = |
|
27 | +luser_relay = unknown_user@localhost |
|
28 | +``` |
|
29 | + |
|
30 | +- /etc/postfix/master.cf (抜粋) |
|
31 | +``` |
|
32 | +submission inet n - n - - smtpd |
|
33 | + -o smtpd_sasl_auth_enable=yes |
|
34 | +``` |
|
35 | + |
|
36 | +- /etc/aliases (追加) |
|
37 | +``` |
|
38 | +unknown_user: /dev/null |
|
39 | +``` |
|
40 | + |
|
41 | +## ファイアウォール設定 |
|
42 | +- CentOS 7 |
|
43 | +``` |
|
44 | +# firewall-cmd --permanent --add-service=smtp --add-service=smtp-submission --add-service=smtps |
|
45 | +# firewall-cmd --reload |
|
46 | +# firewall-cmd --list-services |
|
47 | +``` |
|
48 | + |
|
49 | +## サービス設定 |
|
50 | +- CentOS 7 |
|
51 | +``` |
|
52 | +# systemctl restart postfix saslauthd |
|
53 | +# systemctl status postfix saslauthd |
|
54 | +# systemctl enable postfix saslauthd |
|
55 | +# systemctl status postfix saslauthd |
|
56 | +``` |
|
57 | + |
|
58 | +# Dovecot |
|
59 | + |
|
60 | +## インストール |
|
61 | +``` |
|
62 | +# yum install -y dovecot |
|
63 | +``` |
|
64 | + |
|
65 | +## 設定 |
|
66 | +- /etc/dovecot/conf.d/10-mail.conf (抜粋) |
|
67 | +``` |
|
68 | +mail_location = maildir:~/Maildir |
|
69 | +``` |
|
70 | + |
|
71 | +- /etc/dovecot/conf.d/10-auth.conf (抜粋) |
|
72 | +``` |
|
73 | +disable_plaintext_auth = no |
|
74 | +``` |
|
75 | + |
|
76 | +- /etc/dovecot/conf.d/10-ssl.conf (抜粋) |
|
77 | +``` |
|
78 | +ssl = no |
|
79 | +``` |
|
80 | + |
|
81 | +- /etc/dovecot/conf.d/10-logging.conf (抜粋, デバッグ用) |
|
82 | +``` |
|
83 | +auth_verbose = yes |
|
84 | +auth_debug = yes |
|
85 | +``` |
|
86 | + |
|
87 | +## 設定 (暗号化) |
|
88 | +- /etc/dovecot/conf.d/10-ssl.conf (証明書は Let's Encrypt で取得) |
|
89 | +``` |
|
90 | +ssl = required |
|
91 | +ssl_cert = </etc/letsencrypt/live/<ドメイン>/fullchain.pem |
|
92 | +ssl_key = </etc/letsencrypt/live/<ドメイン>/privkey.pem |
|
93 | +ssl_protocols = !SSLv2 !SSLv3 |
|
94 | +ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL |
|
95 | +``` |
|
96 | + |
|
97 | +## ファイアウォール設定 |
|
98 | +- CentOS 7 |
|
99 | +``` |
|
100 | +# firewall-cmd --permanent --add-service=pop3 |
|
101 | +# firewall-cmd --reload |
|
102 | +# firewall-cmd --list-services |
|
103 | +``` |
|
104 | + |
|
105 | +## ファイアウォール設定 (暗号化) |
|
106 | +- CentOS 7 |
|
107 | +``` |
|
108 | +# firewall-cmd --permanent --remove-service=pop3 |
|
109 | +# firewall-cmd --permanent --add-service=pop3s |
|
110 | +# firewall-cmd --reload |
|
111 | +# firewall-cmd --list-services |
|
112 | +``` |
|
113 | + |
|
114 | +## サービス設定 |
|
115 | +- CentOS 7 |
|
116 | +``` |
|
117 | +# systemctl restart dovecot |
|
118 | +# systemctl status dovecot |
|
119 | +# systemctl enable dovecot |
|
120 | +# systemctl status dovecot |
|
121 | +``` |
|
122 | + |
|
123 | +# ログファイル |
|
124 | +- /var/log/maillog |
|
125 | +- ログファイルを監視, Ctrl-C で終了 |
|
126 | +``` |
|
127 | +# tail -f /var/log/maillog |
|
... | ... | \ No newline at end of file |
Linux/_Sidebar.md
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | - [[Customize]]
|
4 | 4 | - [[Install|/Linux/Install/Home]]
|
5 | 5 | - [[iptables]]
|
6 | +- [[Mail]]
|
|
6 | 7 | - [[NIC_Bonding]]
|
7 | 8 | - [[OpenVPN]]
|
8 | 9 | - [[phpMyAdmin]]
|