{"id":11230,"date":"2022-05-01T03:51:56","date_gmt":"2022-04-30T18:51:56","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=11230"},"modified":"2022-05-02T16:38:52","modified_gmt":"2022-05-02T07:38:52","slug":"ubuntu-20-04-lts-%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89-postfix-lets-encrypt%e3%81%a7tls%e5%8c%96","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=11230","title":{"rendered":"Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 &#8211; Postfix Let\u2019s Encrypt\u3067TLS\u5316"},"content":{"rendered":"<p>\u524d\u56de\u306e<a href=\"https:\/\/www.webcyou.com\/?p=11221\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Postfix SASL\u8a8d\u8a3c<\/a>\u306e\u7d9a\u304d\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u30e1\u30fc\u30eb\u9001\u4fe1\u3092Let\u2019s Encrypt\u3067TLS\u5316\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h4>\u30e1\u30cb\u30e5\u30fc<\/h4>\n<ul>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11191\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 \u521d\u671f\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/a><\/li>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11197\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Nginx\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11205\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Let\u2019s Encrypt\u3067SSL\/TLS\u5316<\/a><\/li>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11211\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Postfix\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11218\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Dovecot\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11221\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Postfix SASL\u8a8d\u8a3c<\/a><\/li>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11230\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Postfix Let\u2019s Encrypt\u3067TLS\u5316<\/a><\/li>\n<li><a href=\"https:\/\/www.webcyou.com\/?p=11234\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 DKIM\u3001DMARC\u3092\u8a2d\u5b9a\u3059\u308b<\/a><\/li>\n<\/ul>\n<h4>Postfix Let\u2019s Encrypt\u3067TLS\u5316<\/h4>\n<h5>\u73fe\u5728\u53d6\u5f97\u3057\u3066\u3044\u308b\u8a3c\u660e\u66f8\u306e\u78ba\u8a8d<\/h5>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo certbot certificates<\/pre>\n<p>\u9806\u756a\u3067\u3084\u3063\u3066\u304d\u305f\u306e\u3067\u3042\u308c\u3070\u3001web\u30b5\u30fc\u30d0\u306e\u65b9\u3067\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u306f\u305a\u306a\u306e\u3067\u3001\u65b0\u305f\u306b\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u7528\u306b\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u8d77\u52d5\u3057\u3066\u3044\u308bnginx\u3092stop\u3057\u306a\u3044\u3068\u30a8\u30e9\u30fc\u3068\u306a\u308b\u306e\u3067\u4e00\u5ea6\u6b62\u3081\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo systemctl stop nginx<\/pre>\n<p>\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3mail\u306e\u65b9\u3067\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo certbot certonly --standalone -d mail.example.com<\/pre>\n<p>\u65e2\u306b\u8a3c\u660e\u66f8\u767a\u884c\u3057\u3066\u308b\u3068\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5165\u529b\u3001\u5229\u7528\u898f\u7d04\u306e\u627f\u8afe\u3001\u30e1\u30fc\u30ea\u30f3\u30b0\u30ea\u30b9\u30c8\u306e\u767b\u9332\u53ef\u5426\u306a\u3069\u306f\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u307e\u3059\u3002\u8a3c\u660e\u66f8\u306f\u3001`\/etc\/letsencrypt\/live\/mail.`example.com`\/`\u306b\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u6210\u529f\u3057\u307e\u3057\u305f\u3089\u3001nginx\u3092\u518d\u8d77\u52d5\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo systemctl start nginx<\/pre>\n<h4>Postfix\u306eSSL\/TLS\u8a2d\u5b9a<\/h4>\n<p><strong>\/etc\/postfix\/main.cf<\/strong> \u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo vim \/etc\/postfix\/main.cf<\/pre>\n<p>\u6700\u5f8c\u5c3e\u306b\u8ffd\u52a0<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"># SSL\/TLS\r\nsmtp_tls_security_level = may\r\nsmtpd_tls_cert_file = \/etc\/letsencrypt\/live\/mail.(\u30c9\u30e1\u30a4\u30f3\u540d)\/fullchain.pem\r\nsmtpd_tls_key_file = \/etc\/letsencrypt\/live\/mail.(\u30c9\u30e1\u30a4\u30f3\u540d)\/privkey.pem\r\nsmtpd_tls_session_cache_database = btree:\/var\/lib\/postfix\/smtpd_scache\r\nsmtpd_tls_session_cache_timeout = 3600s\r\nsmtpd_tls_received_header = yes\r\nsmtpd_tls_loglevel = 1<\/pre>\n<p><strong>\/etc\/postfix\/master.cf<\/strong> \u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo vim \/etc\/postfix\/master.cf<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"># \u30b3\u30e1\u30f3\u30c8\u89e3\u9664 & \u5909\u66f4\r\nsmtps     inet  n       -       n       -       -       smtpd\r\n\r\n# \u30b3\u30e1\u30f3\u30c8\u89e3\u9664\r\n-o smtpd_tls_wrappermode=yes\r\n-o smtpd_sasl_auth_enable=yes\r\n# \u30b3\u30e1\u30f3\u30c8\u89e3\u9664 & \u5909\u66f4\r\n-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject<\/pre>\n<p>\u8a2d\u5b9a\u306e\u30c1\u30a7\u30c3\u30af<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo postfix check<\/pre>\n<p>Postfix\u306e\u518d\u8d77\u52d5\u3001\u8a2d\u5b9a\u5185\u5bb9\u306e\u53cd\u6620\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo systemctl restart postfix<\/pre>\n<p>\u30b9\u30c6\u30fc\u30bf\u30b9\u78ba\u8a8d<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ systemctl status postfix<\/pre>\n<h4>Dovecot\u306eSSL\/TLS\u8a2d\u5b9a<\/h4>\n<p><strong>\/etc\/dovecot\/conf.d\/10-ssl.conf<\/strong> \u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo vim \/etc\/dovecot\/conf.d\/10-ssl.conf<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"># \u5909\u66f4\r\nssl = required\r\n\r\n# \u30b3\u30e1\u30f3\u30c8\u89e3\u9664 &amp; \u5909\u66f4\r\nssl_cert = &lt;\/etc\/letsencrypt\/live\/mail.(\u30c9\u30e1\u30a4\u30f3\u540d)\/fullchain.pem\r\nssl_key = &lt;\/etc\/letsencrypt\/live\/mail.(\u30c9\u30e1\u30a4\u30f3\u540d)\/privkey.pem<\/pre>\n<p><strong>\/etc\/dovecot\/conf.d\/10-master.conf<\/strong> \u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo vim \/etc\/dovecot\/conf.d\/10-master.conf<\/pre>\n<p>\u975e\u30bb\u30ad\u30e5\u30a2\u306a\u901a\u4fe1\u306fport0\u756a\u3068\u3057\u3066\u8a2d\u5b9a\u3092\u7121\u52b9\u5316\u3057\u307e\u3059\u3002\uff08port = 0\u306f\u30b3\u30e1\u30f3\u30c8\u89e3\u9664 &#038; \u5909\u66f4\u3002imaps\u3068pop3s\u30b3\u30e1\u30f3\u30c8\u89e3\u9664\uff09<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">service imap-login {\r\n  inet_listener imap {\r\n    port = 0\r\n  }\r\n  inet_listener imaps {\r\n    port = 993\r\n    ssl = yes\r\n  }\r\n}\r\n\r\nservice pop3-login {\r\n  inet_listener pop3 {\r\n    port = 0\r\n  }\r\n  inet_listener pop3s {\r\n    port = 995\r\n    ssl = yes\r\n  }\r\n}<\/pre>\n<p>Dovecot\u306e\u518d\u8d77\u52d5<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ sudo systemctl restart dovecot<\/pre>\n<p>\u30b9\u30c6\u30fc\u30bf\u30b9\u78ba\u8a8d<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ systemctl status dovecot<\/pre>\n<h4>\u30e1\u30fc\u30eb\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a2\u30d7\u30ea\u3067\u9001\u53d7\u4fe1\u30c6\u30b9\u30c8<\/h4>\n<p>\u524d\u56de\u540c\u69d8\u3001\u30e1\u30fc\u30eb\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a2\u30d7\u30ea<a href=\"https:\/\/www.thunderbird.net\/ja\/)\" target=\"_blank\" rel=\"noopener\">Thunderbird<\/a> \u3092\u5229\u7528\u3057\u3066\u78ba\u8a8d\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u63a5\u7d9a\u306e\u4fdd\u8b77 SSL\/TLS\u3092\u9078\u629e\u3002<\/p>\n<p>\u9001\u4fe1\u30b5\u30fc\u30d0 smtp(SSL) \u30dd\u30fc\u30c8 465<\/p>\n<p>\u53d7\u4fe1\u30b5\u30fc\u30d0 POP(SSL) \u30dd\u30fc\u30c8 995<\/p>\n<p>\u53d7\u4fe1\u30b5\u30fc\u30d0 IMAP(SSL) \u30dd\u30fc\u30c8 993<\/p>\n<p>\u305d\u308c\u305e\u308c\u3001\u9001\u53d7\u4fe1\u30c6\u30b9\u30c8\u3067\u304d\u308b\u304b\u78ba\u8a8d\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u9001\u53d7\u4fe1<\/th>\n<th>\u30dd\u30fc\u30c8\u756a\u53f7<\/th>\n<th>\u7528\u9014<\/th>\n<\/tr>\n<tr>\n<td>\u9001\u4fe1<\/td>\n<td>25<\/td>\n<td>smtp<\/td>\n<\/tr>\n<tr>\n<td>\u9001\u4fe1<\/td>\n<td>465<\/td>\n<td>smtp(SSL)<\/td>\n<\/tr>\n<tr>\n<td>\u9001\u4fe1<\/td>\n<td>587<\/td>\n<td>Submission\u30dd\u30fc\u30c8<\/td>\n<\/tr>\n<tr>\n<td>\u53d7\u4fe1<\/td>\n<td>110<\/td>\n<td>POP<\/td>\n<\/tr>\n<tr>\n<td>\u53d7\u4fe1<\/td>\n<td>995<\/td>\n<td>POP(SSL)<\/td>\n<\/tr>\n<tr>\n<td>\u53d7\u4fe1<\/td>\n<td>143<\/td>\n<td>IMAP<\/td>\n<\/tr>\n<tr>\n<td>\u53d7\u4fe1<\/td>\n<td>993<\/td>\n<td>\u00a0IMAP(SSL)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2022\/05\/mail_tls.png\" alt=\"\" width=\"373\" height=\"39\" class=\"alignnone size-full wp-image-11231\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2022\/05\/mail_tls.png 373w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2022\/05\/mail_tls-300x31.png 300w\" sizes=\"auto, (max-width: 373px) 100vw, 373px\" \/><\/p>\n<p>\u9001\u4fe1\u30e1\u30fc\u30eb\u304cTLS\u5316\u3055\u308c\u3001\u30bb\u30ad\u30e5\u30a2\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u6700\u5f8c\u306f\u3001DKIM\u3001DMARC\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/?p=11234\">Ubuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 DKIM\u3001DMARC\u3092\u8a2d\u5b9a\u3059\u308b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306eUbuntu 20.04 LTS \u30b5\u30fc\u30d0\u69cb\u7bc9 \u2013 Postfix SASL\u8a8d\u8a3c\u306e\u7d9a\u304d\u3067\u3059\u3002 \u4eca\u56de\u306f\u3001\u30e1\u30fc\u30eb\u9001\u4fe1\u3092Let\u2019s Encrypt\u3067TLS\u5316\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u30e1\u30cb\u30e5\u30fc Ubuntu 20.04 LTS \u30b5\u30fc\u30d0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11192,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[248],"tags":[221,44,45,293],"class_list":{"0":"post-11230","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-ubuntu","8":"tag-linux","9":"tag-web","11":"tag-293"},"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/11230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11230"}],"version-history":[{"count":5,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/11230\/revisions"}],"predecessor-version":[{"id":11264,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/11230\/revisions\/11264"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/media\/11192"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}