Linux/Mail.md
... ...
@@ -10,21 +10,24 @@
10 10
## 設定
11 11
- /etc/postfix/main.cf (抜粋)
12 12
```
13
-myhostname = <ホスト>.<ドメイン>
13
+myhostname = mail.<ドメイン>
14 14
mydomain = <ドメイン>
15 15
myorigin = $mydomain
16 16
inet_interfaces = all
17
-mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain
17
+mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
18
+local_recipient_maps =
18 19
home_mailbox = Maildir/
20
+luser_relay = unknown_user@localhost
19 21
smtpd_banner = $myhostname ESMTP unknown
22
+smtpd_tls_cert_file = /etc/letsencrypt/live/<ドメイン>/fullchain.pem
23
+smtpd_tls_key_file = /etc/letsencrypt/live/<ドメイン>/privkey.pem
24
+smtp_tls_CApath = /etc/letsencrypt/live/<ドメイン>/cert.pem
25
+smtpd_sasl_auth_enable = yes
20 26
smtpd_recipient_restrictions =
21 27
permit_mynetworks
22 28
permit_sasl_authenticated
23 29
reject_unauth_destination
24 30
message_size_limit = 10485760
25
-smtpd_sasl_auth_enable = yes
26
-local_recipient_maps =
27
-luser_relay = unknown_user@localhost
28 31
```
29 32
30 33
- /etc/postfix/master.cf (抜粋)
... ...
@@ -46,12 +49,17 @@ unknown_user: /dev/null
46 49
# firewall-cmd --list-services
47 50
```
48 51
49
-## サービス設定
50
-- CentOS 7
52
+## 設定反映
53
+- CentOS 7,8
51 54
```
52
-# systemctl restart postfix saslauthd
53
-# systemctl status postfix saslauthd
55
+# newaliases
56
+# postalias hash:/etc/aliases
57
+# alternatives --config mta
58
+(MTAがリストアップされる)
59
+(`+`が現在有効になっているMTA)
60
+(postfixの番号を入力して有効なMTAを変更)
54 61
# systemctl enable postfix saslauthd
62
+# systemctl restart postfix saslauthd
55 63
# systemctl status postfix saslauthd
56 64
```
57 65
... ...
@@ -68,23 +76,6 @@ unknown_user: /dev/null
68 76
mail_location = maildir:~/Maildir
69 77
```
70 78
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 79
- /etc/dovecot/conf.d/10-ssl.conf (証明書は Let's Encrypt で取得)
89 80
```
90 81
ssl = required
... ...
@@ -94,29 +85,25 @@ ssl_protocols = !SSLv2 !SSLv3
94 85
ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL
95 86
```
96 87
97
-## ファイアウォール設定
98
-- CentOS 7
88
+- /etc/dovecot/conf.d/10-logging.conf (抜粋, デバッグ用)
99 89
```
100
-# firewall-cmd --permanent --add-service=pop3
101
-# firewall-cmd --reload
102
-# firewall-cmd --list-services
90
+auth_verbose = yes
91
+auth_debug = yes
103 92
```
104 93
105
-## ファイアウォール設定 (暗号化)
106
-- CentOS 7
94
+## ファイアウォール設定
95
+- CentOS 7,8
107 96
```
108
-# firewall-cmd --permanent --remove-service=pop3
109 97
# firewall-cmd --permanent --add-service=pop3s
110 98
# firewall-cmd --reload
111 99
# firewall-cmd --list-services
112 100
```
113 101
114 102
## サービス設定
115
-- CentOS 7
103
+- CentOS 7,8
116 104
```
117
-# systemctl restart dovecot
118
-# systemctl status dovecot
119 105
# systemctl enable dovecot
106
+# systemctl restart dovecot
120 107
# systemctl status dovecot
121 108
```
122 109
... ...
@@ -124,4 +111,4 @@ ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL
124 111
- /var/log/maillog
125 112
- ログファイルを監視, Ctrl-C で終了
126 113
```
127
-# tail -f /var/log/maillog
... ...
\ No newline at end of file
0
+# tail -f /var/log/maillog