{"id":2886,"date":"2015-04-30T23:06:50","date_gmt":"2015-04-30T14:06:50","guid":{"rendered":"http:\/\/www.frontier-line.org\/lognote\/?p=2886"},"modified":"2015-05-01T17:59:47","modified_gmt":"2015-05-01T08:59:47","slug":"smtpauth%e5%b0%8e%e5%85%a5","status":"publish","type":"post","link":"http:\/\/www.frontier-line.org\/lognote\/?p=2886","title":{"rendered":"SMTPAuth\u5c0e\u5165"},"content":{"rendered":"<p>\u3000\u4ee5\u524d\u3001\u30e1\u30fc\u30eb\u304c\u9001\u308c\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3092\u66f8\u304d\u3001\u30b5\u30d6\u30df\u30c3\u30b7\u30e7\u30f3\u30dd\u30fc\u30c8\u306e\u8a2d\u5b9a\u3068POP before SMTP\u306e\u8a2d\u5b9a\u3067\u89e3\u6c7a\u3057\u305f\u3068\u66f8\u3044\u305f\u306e\u3060\u3051\u3069\u3001\u3044\u3064\u306e\u9593\u306b\u304b\u307e\u305f\u9001\u308c\u306a\u304f\u306a\u3063\u3066\u3044\u305f\u3002dracd\u306f\u52d5\u3044\u3066\u3044\u3066\u304f\u308c\u308b\u306e\u3060\u3051\u3069\u3001\u9001\u4fe1\u3057\u3088\u3046\u3068\u3059\u308b\u3068relay\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002<br \/>\n\u3000\u3067\u3001\u3042\u304d\u3089\u3081\u3066SMTPAuth\u3092\u5c0e\u5165\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002SMTP\u8a8d\u8a3c\u306e\u969b\u3001SMTP over SSL\u3067\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u6697\u53f7\u5316\u3059\u308b\u3002<\/p>\n<p>\u3000\u307e\u305a\u3001Cyrus SASL2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<pre><code>\ncd \/usr\/ports\/security\/cyrus-sasl2\nmake BATCH=yes WITHOUT_OTP=yes WITH_BDB=yes install clean\n<\/code><\/pre>\n<p>\n\u3000\u6b21\u306b\u3001Cyrus saslauthd \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<pre><code>\ncd \/usr\/ports\/security\/cyrus-sasl2-saslauthd\nmake BATCH=yes WITH_BDB=yes install clean\n<\/code><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u305f\u3089\u3001<\/p>\n<pre><code>\n\/usr\/local\/etc\/rc.d\/saslauthd start\n<\/code><\/pre>\n<p>\u3067\u3001\u30c7\u30fc\u30e2\u30f3\u3092\u8d77\u52d5\u3057\u3066\u304a\u304f\u3002<br \/>\n<br \/>\n\u3000\u6697\u53f7\u5316\u306e\u305f\u3081\u306eOpenSSL\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u30bd\u30fc\u30b9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5c55\u958b\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306bcd\u3057\u305f\u5f8c\u3001<\/p>\n<pre><code>\n.\/config\nmake\nmake test\nmake install\n<\/code><\/pre>\n<p>\u3068\u3084\u308c\u3070\u3001<\/p>\n<pre><code>\n\/usr\/local\/ssl\/bin\/openssl\n<\/code><\/pre>\n<p>\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u3002<br \/>\n\u3000\/etc\/pki\/tls\/certs\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u7121\u3044\u306e\u3067\u4f5c\u3063\u305f\u5f8c\u3001<\/p>\n<pre><code>\ncd \/etc\/pki\/tls\/certs\n\/usr\/local\/ssl\/bin\/openssl req -new -x509 -nodes -days 365 -out mail.crt -keyout mail.key\n<\/code><\/pre>\n<p>\u3092\u5b9f\u884c\u3002\u3044\u308d\u3044\u308d\u304d\u3044\u3066\u304f\u308b\u306e\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u5165\u529b\u3002<\/p>\n<pre><code>\nCountry Name (2 letter code) [AU]:JP\nState or Province Name (full name) [Some-State]:\nLocality Name (eg, city) []:\nOrganization Name (eg, company) [Internet Widgits Pty Ltd]:\nOrganizational Unit Name (eg, section) []:\nCommon Name (e.g. server FQDN or YOUR name) []:*.frontier-line.org\nEmail Address []:\n<\/code><\/pre>\n<p>\u3000\u3053\u308c\u304c\u7d42\u308f\u308b\u3068\u3001mail.crt\u3068mail.key\u304c\u3067\u304d\u308b\u3002\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u3092\u5909\u66f4\u3002<\/p>\n<pre><code>\nchmod 600 mail.key\n<\/code><\/pre>\n<p>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a3c\u660e\u66f8\u306e\u4f5c\u6210\u3002<\/p>\n<pre><code>\n\/usr\/local\/ssl\/bin\/openssl x509 -in mail.crt -outform der -out mail.der\n<\/code><\/pre>\n<p>\u3000\u6b21\u306bPostfix\u672c\u4f53\u306e\u518d\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u4e00\u5ea6make deinstall\u3057\u3066\u304b\u3089make reinstall\u3068\u304b\u3059\u308b\u3068\u3046\u307e\u304f\u3044\u304f\u3002<\/p>\n<pre><code>\nmake WITH_SASL2=yes WITH_TLS=yes WITH_BDB=yes WITH_BDB_VER=41\n<\/code><\/pre>\n<p>\u3067\u9069\u5f53\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<br \/>\n\u3000ports\u304b\u3089\u5165\u308c\u308b\u3068\/usr\/local\/sbin\/postfix\u304c\u52d5\u304f\u3002\u30bd\u30fc\u30b9\u304b\u3089\u5165\u308c\u305f\u6642\u3068\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u9055\u3044\u3001\u3044\u308d\u3044\u308d\u3084\u3063\u3066\u308b\u3068\u3069\u3063\u3061\u304b\u308f\u304b\u3089\u306a\u304f\u306a\u308b\u306e\u3067\u8981\u6ce8\u610f\u3002<\/p>\n<p>\u3000\u3082\u308d\u3082\u308d\u306e\u8a2d\u5b9a\u306f\u6b21\u306e\u901a\u308a\u3002<\/p>\n<p>\/usr\/local\/etc\/postfix\/main.cf\u306f\u3001<\/p>\n<pre><code>\nmyhostname = frontier-line.org\nmydomain = frontier-line.org\nmyorigin = $mydomain\ninet_interfaces = all\nmydestination = $myhostname, localhost.$mydomain, localhost, $mydomain\nrelay_domains = $mydestination\nalias_maps = hash:\/etc\/postfix\/aliases\nalias_database = hash:\/etc\/postfix\/aliases\nmail_spool_directory = \/var\/mail\n\n\u3068\u3084\u3063\u3066\u304a\u3044\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u5f8c\u306b\u3001SMTPAuth\u306b\u5fc5\u8981\u306a\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3002\n\nsmtpd_sasl_auth_enable = yes\nsmtpd_sasl_local_domain = $mydomain\nsmtpd_sasl_security_options = noanonymous\nsmtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination\nbroken_sasl_auth_clients = yes\n\n\u3055\u3089\u306b\u3001TLS\u3092\u4f7f\u3046\u305f\u3081\u306e\u8ffd\u52a0\u3002\n\nsmtpd_tls_security_level = may\nsmtpd_tls_key_file = \/etc\/pki\/tls\/certs\/mail.key\nsmtpd_tls_cert_file = \/etc\/pki\/tls\/certs\/mail.crt\nsmtpd_tls_loglevel = 1\nsmtpd_tls_received_header = yes\n\n\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u306e\u5927\u304d\u3044\u306e\u3092\u53d7\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3002\n\nmailbox_size_limit= 102400000\nmessage_size_limit = 51200000\nbody_checks_size_limit = 204800000\n<\/code><\/pre>\n<p>\/etc\/rc.conf\u306f\u3001<\/p>\n<pre><code>\nsaslauthd_enable=\"YES\"\nsaslauthd_flags=\"-a sasldb\"\n<\/code><\/pre>\n<p>\u3092\u8ffd\u52a0\u3002saslauthd\u3092\u81ea\u52d5\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3002<br \/>\npostfix\u3092\u6700\u521d\u306b\u5165\u308c\u305f\u6642\u306b\u5909\u66f4\u3057\u305f\u5206<\/p>\n<pre><code>\nsendmail_enable=\"NO\"\nsendmail_submit_enable=\"NO\"\nsendmail_outbound_enable=\"NO\"\nsendmail_msp_queue_enable=\"NO\"\npostfix_enable=\"YES\" \n<\/code><\/pre>\n<p>\u306f\u305d\u306e\u307e\u307e\u3002<\/p>\n<p>\/usr\/local\/lib\/sasl2\/smtpd.conf\u306b\u3001<\/p>\n<pre><code>\npwcheck_method: auxprop\n<\/code><\/pre>\n<p>\u3068\u66f8\u3044\u3066\u304a\u304f\u3002<\/p>\n<p>\/etc\/periodic.conf\u306f\u3001\u65e2\u306b\u5909\u66f4\u6e08\u307f\u3060\u304c\u3001<\/p>\n<pre><code>\ndaily_clean_hoststat_enable=\"NO\"\ndaily_status_mail_rejects_enable=\"NO\"\ndaily_status_include_submit_mailq=\"NO\"\ndaily_submit_queuerun=\"NO\"\n<\/code><\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u308b\u306e\u3092\u78ba\u8a8d\u3002<\/p>\n<p>\/etc\/mail\/mailer.conf\u306f\u3001<\/p>\n<pre><code>\nsendmail        \/usr\/local\/sbin\/sendmail\nsend-mail       \/usr\/local\/sbin\/sendmail\nmailq                   \/usr\/local\/sbin\/sendmail\nnewaliases              \/usr\/local\/sbin\/sendmail\n<\/code><\/pre>\n<p>\u3067\u3001\u3053\u308c\u306f\u6700\u521d\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u6642\u306e\u307e\u307e\u3002<\/p>\n<p>\/etc\/make.conf\u306f\u3001<\/p>\n<pre><code>\nPERL_VERSION=5.14.4\nNO_MAILWRAPPER=YES\nNO_SENDMAIL=YES\n<\/code><\/pre>\n<p>\u3067\u3001\u3053\u308c\u3082\u4ed6\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u6c7a\u3081\u305f\u307e\u307e\u5909\u66f4\u306a\u3057\u3002\u4f55\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u3044\u306a\u3089\u7279\u306b\u4f55\u304b\u3059\u308b\u5fc5\u8981\u306f\u7121\u3044\u304b\u3082\u3002<\/p>\n<p>\/usr\/local\/etc\/postfix\/master.cf\u3067\u3001\u4ee5\u4e0b\u306e\u90e8\u5206\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3059\u3002<\/p>\n<pre><code>\nsmtp      inet  n       -       n       -       -       smtpd\n  -o syslog_name=postfix\/submission\n  -o smtpd_tls_security_level=may\n\nsmtps     inet  n       -       n       -       -       smtpd\n  -o syslog_name=postfix\/smtps\n  -o smtpd_tls_wrappermode=yes\n  -o smtpd_sasl_auth_enable=yes\n<\/code><\/pre>\n<p>\n\u3000smtp auth\u30e6\u30fc\u30b6\u30fc\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre><code>\nsaslpasswd2 -c username\n<\/code><\/pre>\n<p>\u3067\u3001\u767b\u9332\u3057\u305f\u3044\u30e6\u30fc\u30b6\u30fc\u3092username\u306e\u3068\u3053\u308d\u306b\u66f8\u304f\u3068\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u304d\u3044\u3066\u304f\u308b\u3002<br \/>\n\u767b\u9332\u5f8c\u306f\u3001<\/p>\n<pre><code>\nsasldblistusers2\n<\/code><\/pre>\n<p>\u3067\u78ba\u8a8d\u3002\u3053\u306e\u767b\u9332\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u6240\u6709\u8005\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u3092\u5909\u66f4\u3002<\/p>\n<pre><code>\nchown cyrus:mail \/usr\/local\/etc\/sasldb2\nchmod 640 \/usr\/local\/etc\/sasldb2\n<\/code><\/pre>\n<p>\u3000\/etc\/services\u3067\u3001\u30b5\u30d6\u30df\u30c3\u30b7\u30e7\u30f3\u30dd\u30fc\u30c8587\u3068SMTP over SSL\u306e\u30dd\u30fc\u30c8465\u304c\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001<\/p>\n<pre><code>\n\/usr\/local\/sbin\/postfix stop\n\/usr\/local\/sbin\/postfix start\n<\/code><\/pre>\n<p>\u3068\u3084\u3063\u3066\u3001\u8a2d\u5b9a\u3092\u78ba\u5b9f\u306b\u8aad\u307f\u8fbc\u307e\u305b\u308b\u3002<\/p>\n<p>\u3000\u30c7\u30fc\u30e2\u30f3\u304c\u4e0a\u304c\u3063\u305f\u3089\u3001<\/p>\n<pre><code>\nnetstat -na | grep 587\nnetstat -na | grep 465\n<\/code><\/pre>\n<p>\u3092\u5b9f\u884c\u3057\u3001\u3053\u306e\uff12\u3064\u306e\u30dd\u30fc\u30c8\u3092listen\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<p>\u3000TLS\u306e\u52d5\u4f5c\u78ba\u8a8d\u306f\u3001<\/p>\n<pre><code>\ntelnet localhost 25\n\u3057\u3066\u304b\u3089\u3001\nEHLO localhost\nSTARTTLS\n.\n<\/code><\/pre>\n<p>\u3092\u9806\u756a\u306b\u5165\u529b\u3057\u3066\u69d8\u5b50\u3092\u898b\u308b\u3002<\/p>\n<p>\u3000\u4eca\u56de\u3001\u3069\u3046\u3044\u3046\u308f\u3051\u304b\u3001newaliases\u3067\u3067\u304d\u308b\/etc\/aliases\u304c\u3046\u307e\u304fpostfix\u306b\u8a8d\u8b58\u3055\u308c\u305a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u958b\u3051\u306a\u3044\u305f\u3081\u306b\u63a5\u7d9a\u304c\u62d2\u5426\u3055\u308c\u3001\u5916\u90e8\u304b\u3089\u306e\u30e1\u30fc\u30eb\u304c\u5230\u9054\u3057\u306a\u3044\u3068\u3044\u3046\u73fe\u8c61\u306b\u307f\u307e\u308f\u308c\u305f\u3002main.conf\u3067\u3001<\/p>\n<pre><code>\nalias_maps = hash:\/etc\/postfix\/aliases<br \/>\nalias_database = hash:\/etc\/postfix\/aliases<br \/>\n<\/code><\/pre>\n<p>\u3068\u8a2d\u5b9a\u3057\u3001\/etc\/postfix\/aliases\u3092\u66f8\u304d\u63db\u3048\u305f\u3089<\/p>\n<pre><code>\n\/usr\/local\/sbin\/postalias  \/etc\/postfix\/aliases\n<\/code><\/pre>\n<p>\u3092\u5b9f\u884c\u3059\u308b\u3068\u30a8\u30e9\u30fc\u306f\u51fa\u306a\u3044\u3002\u30e1\u30fc\u30e9\u30fc\u30c7\u30fc\u30e2\u30f3\u5171\u901a\u3067\u4f7f\u3048\u308baliases\u3067\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u7406\u7531\u306f\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u3002<\/p>\n<p>\u3000Thunderbird\u5074\u306e\u8a2d\u5b9a\u306f\u3001<br \/>\n\u30b5\u30fc\u30d0\u540d\uff1afrontier-line.org<br \/>\n\u30dd\u30fc\u30c8\u756a\u53f7\uff1a465<br \/>\n\u63a5\u7d9a\u306e\u4fdd\u8b77\uff1aSSL\/TLS<br \/>\n\u8a8d\u8a3c\u65b9\u5f0f\uff1a\u901a\u5e38\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c<br \/>\n\u3067\u63a5\u7d9a\u3067\u304d\u308b\u3002<\/p>\n<p>\u3000\u306a\u304a\u3001\u4eca\u56de\u4f5c\u3063\u305fTLS\u306e\u8a3c\u660e\u66f8\u306f\u3001\u3044\u308f\u3086\u308b\u30aa\u30ec\u30aa\u30ec\u8a3c\u660e\u66f8\u306a\u306e\u3067\u3001Thunderbird\u69d8\u304b\u3089\u602a\u3057\u3044\u3068\u6012\u3089\u308c\u307e\u3059orz\u3002\u3067\u3082\u307e\u3042\u3001\u30aa\u30ec\u304croot\u3067\u30aa\u30ec\u304c\u8a2d\u5b9a\u3057\u3066\u30aa\u30ec\u3057\u304b\u4f7f\u308f\u306a\u3044\u30aa\u30ec\u5c02\u7528\u30b5\u30fc\u30d0\u306a\u306e\u3067\u3001\u8a3c\u660e\u66f8\u3082\u30aa\u30ec\u30aa\u30ec\u3067\u3044\u3044\u3093\u3067\u3059\u3088\u306d\u3002\u4f8b\u5916\u8a2d\u5b9a\u3057\u3066\u8b66\u544a\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3082\u554f\u984c\u306a\u3057\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u4ee5\u524d\u3001\u30e1\u30fc\u30eb\u304c\u9001\u308c\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3092\u66f8\u304d\u3001\u30b5\u30d6\u30df\u30c3\u30b7\u30e7\u30f3\u30dd\u30fc\u30c8\u306e\u8a2d\u5b9a\u3068POP before SMTP\u306e\u8a2d\u5b9a\u3067\u89e3\u6c7a\u3057\u305f\u3068\u66f8\u3044\u305f\u306e\u3060\u3051\u3069\u3001\u3044\u3064\u306e\u9593\u306b\u304b\u307e\u305f\u9001\u308c\u306a\u304f\u306a\u3063\u3066\u3044\u305f\u3002dracd\u306f\u52d5\u3044\u3066\u3044\u3066\u304f\u308c\u308b\u306e\u3060\u3051\u3069\u3001\u9001\u4fe1\u3057\u3088\u3046\u3068 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2886","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=\/wp\/v2\/posts\/2886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2886"}],"version-history":[{"count":0,"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=\/wp\/v2\/posts\/2886\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2886"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.frontier-line.org\/lognote\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}