{"id":5551,"date":"2023-09-18T19:47:14","date_gmt":"2023-09-18T10:47:14","guid":{"rendered":"https:\/\/hobby.mydns.jp\/teruki.wp\/?p=5551"},"modified":"2023-09-18T21:20:59","modified_gmt":"2023-09-18T12:20:59","slug":"post-5551","status":"publish","type":"post","link":"https:\/\/hobby.mydns.jp\/teruki.wp\/2023\/09\/18\/post-5551\/","title":{"rendered":"almalinux9 postfix\u8a2d\u5b9a"},"content":{"rendered":"<p>&nbsp;<\/p>\n<pre>[root@almalinux9 \/etc\/postfix]# vi main.cf\r\n----------------------------------------------------------\r\n#myhostname = host.domain.tld\r\n#myhostname = virtual.domain.tld\r\n<span style=\"color: #0000ff;\">myhostname = mail1.hobby.mydns.jp<\/span>\r\n\r\n#mydomain = domain.tld\r\n<span style=\"color: #0000ff;\">mydomain = hobby.mydns.jp\r\n\r\ninet_interfaces = all    <span style=\"color: #339966;\">\u2190192.168.0.5\u3068\u304b\u6307\u5b9a\u3059\u308b\u3068Gmail\u306b\u9001\u4fe1\u3067\u304d\u306a\u304b\u3063\u305f<\/span>\r\n<span style=\"color: #000000;\">#inet_interfaces = $myhostname<\/span>\r\n<span style=\"color: #000000;\">#inet_interfaces = $myhostname, localhost<\/span>\r\n<span style=\"color: #000000;\">#inet_interfaces = localhost<\/span>\r\n<\/span>\r\n#inet_protocols = all\r\n<span style=\"color: #0000ff;\">inet_protocols = ipv4<\/span>\r\n#mydestination = $myhostname, localhost.$mydomain, localhost\r\n<span style=\"color: #0000ff;\">mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain<\/span>\r\n#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,\r\n# mail.$mydomain, www.$mydomain, ftp.$mydomain\r\n\r\n#mynetworks = 168.100.189.0\/28, 127.0.0.0\/8\r\n<span style=\"color: #0000ff;\">mynetworks = 192.168.0.0\/24, 127.0.0.0\/8<\/span>\r\n#mynetworks = $config_directory\/mynetworks\r\n#mynetworks = hash:\/etc\/postfix\/network_table\r\n<span style=\"color: #339966;\">\u25a0\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u306eOP25B\u5bfe\u7b56(Postfix\u7de8)--------------------------------------------------------------------------------------\r\nGmail\u306e\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u9001\u4fe1\u3059\u308b\u30e1\u30fc\u30eb\u306fOP25B\u306e\u5f71\u97ff\u306f\u53d7\u3051\u306a\u3044\u305f\u3081\u3001\u5168\u3066\u306e\u9001\u4fe1\u30e1\u30fc\u30eb\u3092Gmail\u3092\u7d4c\u7531\u3057\u3066\u9001\u4fe1\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u3002\r\n\uff08\uff11\uff09Postfix\u8a2d\u5b9a\r\n[root@almalinux ~]# vi \/etc\/postfix\/main.cf\u3000\u2190\u3000Postfix\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u7de8\u96c6\r\n\u4ee5\u4e0b\u3092\u6700\u7d42\u884c\u3078\u8ffd\u52a0\r\nrelayhost = [smtp.gmail.com]:587\r\nsmtp_use_tls = yes\r\nsmtp_sasl_auth_enable = yes\r\nsmtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd\r\nsmtp_sasl_tls_security_options = noanonymous\r\nsmtp_sasl_mechanism_filter = plain\r\n\uff08\uff12\uff09SMTP\u8a8d\u8a3c\u60c5\u5831\u8a2d\u5b9a\r\n[root@almalinux ~]# echo [smtp.gmail.com]:587 Gmail\u30a2\u30c9\u30ec\u30b9:Gmail\u30a2\u30d7\u30ea\u30d1\u30b9\u30ef\u30fc\u30c9\u203b &gt; \/etc\/postfix\/sasl_passwd\u3000\u2190\u3000SMTP\u8a8d\u8a3c\u60c5\u5831\u8a2d\u5b9a\r\n[root@almalinux ~]# chmod 640 \/etc\/postfix\/sasl_passwd\u3000\u2190\u3000root\u4ee5\u5916\u53c2\u7167\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u5909\u66f4\r\n[root@almalinux ~]# postmap \/etc\/postfix\/sasl_passwd\u3000\u2190\u3000SMTP\u8a8d\u8a3c\u60c5\u5831\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5316\r\n\u203bGmail\u30a2\u30d7\u30ea\u30d1\u30b9\u30ef\u30fc\u30c9\u306f2\u6bb5\u968e\u8a8d\u8a3c\u30d7\u30ed\u30bb\u30b9\u3092\u6709\u52b9\u306b\u3059\u308b\u3001\u30a2\u30d7\u30ea\u30d1\u30b9\u30ef\u30fc\u30c9\u3067\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u3092\u5b9f\u65bd\u3057\u3066\u4f5c\u6210\u3057\u305f\u300c\u30a2\u30d7\u30ea\u30d1\u30b9\u30ef\u30fc\u30c9\u300d\u3092\u6307\u5b9a\u3059\u308b\r\n-------------------------------------------------------------------------------------------------------------------------------<\/span>\r\n#relayhost = $mydomain\r\n#relayhost = [gateway.my.domain]\r\n#relayhost = [mailserver.isp.tld]\r\n#relayhost = uucphost\r\n#relayhost = [an.ip.add.ress]\r\n<span style=\"color: #0000ff;\">relayhost = [smtp.gmail.com]:587<\/span>\r\n<span style=\"color: #0000ff;\">smtp_use_tls = yes<\/span>\r\n<span style=\"color: #0000ff;\">smtp_sasl_auth_enable = yes<\/span>\r\n<span style=\"color: #0000ff;\">smtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd<\/span>\r\n<span style=\"color: #0000ff;\">smtp_sasl_security_options = noanonymous<\/span>\r\n<span style=\"color: #0000ff;\">smtp_sasl_tls_security_options = noanonymous<\/span>\r\n<span style=\"color: #0000ff;\">smtp_sasl_mechanism_filter = plain\r\n\r\n<\/span>\r\n#home_mailbox = Mailbox\r\n<span style=\"color: #0000ff;\">home_mailbox = Maildir\/\r\n<\/span>\r\n<span style=\"color: #339966;\">\u25a0TLS\/SSL\u8a3c\u660e\u66f8\u306e\u8a2d\u5b9a\u306f<a href=\"https:\/\/hobby.mydns.jp\/teruki.wp\/2021\/08\/08\/post-4834\/\">ZeroSSL\u3067\u8a2d\u5b9a\u3057\u305f<\/a>\u30d5\u30a1\u30a4\u30eb\u3092\u6d41\u7528\u3059\u308b\u3002------<\/span>\r\n<span style=\"color: #339966;\">vi \/etc\/httpd\/conf.d\/ssl.conf<\/span>\r\n<span style=\"color: #339966;\">------------------------------------------------------------------<\/span>\r\n#smtpd_tls_cert_file = \/etc\/pki\/tls\/certs\/postfix.pem\r\n<span style=\"color: #0000ff;\"># ZeroSSL #\r\nsmtpd_tls_cert_file = \/etc\/ssl\/zerossl\/certificates\/hobby.mydns.jp.crt<\/span>\r\n\r\n# The full pathname of a file with the Postfix SMTP server RSA private key\r\n# in PEM format. The private key must be accessible without a pass-phrase,\r\n# i.e. it must not be encrypted.\r\n#\r\n#smtpd_tls_key_file = \/etc\/pki\/tls\/private\/postfix.key\r\n<span style=\"color: #0000ff;\"># ZeroSSL #\r\nsmtpd_tls_key_file = \/etc\/ssl\/zerossl\/certificates\/hobby.mydns.jp.key<\/span>\r\n\r\n# Announce STARTTLS support to remote SMTP clients, but do not require that\r\n# clients use TLS encryption (opportunistic TLS inbound).\r\n#\r\nsmtpd_tls_security_level = may\r\n\r\n# Directory with PEM format Certification Authority certificates that the\r\n# Postfix SMTP client uses to verify a remote SMTP server certificate.\r\n#\r\nsmtp_tls_CApath = \/etc\/pki\/tls\/certs\r\n\r\n# The full pathname of a file containing CA certificates of root CAs\r\n# trusted to sign either remote SMTP server certificates or intermediate CA\r\n# certificates.\r\n#\r\nsmtp_tls_CAfile = \/etc\/pki\/tls\/certs\/ca-bundle.crt\r\n\r\n\r\n<\/pre>\n<p>\u8a2d\u5b9a\u304c\u7d42\u308f\u3063\u305f\u3089\u518d\u8d77\u52d5<br \/>\nsystemctl restart postfix.service<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; [root@almalinux9 \/etc\/postfix]# vi main.cf &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- # [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":5556,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-5551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-unix"],"_links":{"self":[{"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/posts\/5551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/comments?post=5551"}],"version-history":[{"count":4,"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/posts\/5551\/revisions"}],"predecessor-version":[{"id":5555,"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/posts\/5551\/revisions\/5555"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/media\/5556"}],"wp:attachment":[{"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/media?parent=5551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/categories?post=5551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobby.mydns.jp\/teruki.wp\/wp-json\/wp\/v2\/tags?post=5551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}