sendmail 㨠dovecot 㨠SASL 㨠LDAP
SASL CRAM-MD5 ã®ã¸ã¬ã³ã
SMTP-AUTH ã POP3ãIMAP ã§ä½¿ããããèªè¨¼ãã¬ã¼ã ã¯ã¼ã¯ã® SASLãSASL ã¨ããååããããCRAM-MD5ãã¨ãã£ããå ·ä½çãªèªè¨¼æ¹å¼ã®æ¹ãæåããããã¾ããã
CRAM-MD5 ããPOP3 å°ç¨ã® APOP ã¨ãã£ãèªè¨¼æ¹å¼ã¯ãå¹³æã®ãã¹ã¯ã¼ããä¿åããã¦ããã®ãåæã§ã
- å¹³æã®ãã¹ã¯ã¼ããä¿åãã¦ããã
- å¹³æã®ãã¹ã¯ã¼ãããããã¯ã¼ã¯ãæµããã
ã®ã©ã£ã¡ããé¸ã¶å¿ è¦ãããã¾ããã§ããå¹³æã®ãã¹ã¯ã¼ãããããã¯ã¼ã¯ãæµããåé¡ãªããSSL/TLS åãã¡ããã° OK ããããã¨ãããã¨ã§ã
ã¨ããã®ãæ£è§£ãã¨ããã¾ããDovecot ã®ããã©ã«ãã ã¨ãLOGIN ã PLAIN ã使ãå ´åã«ã¯ãSSL/TLS åããã¦ããäºãæ¡ä»¶ã¨ãªã£ã¦ãã¦ããdisable_plaintext_auth = noãã¨ãã Bad Know How ãåºã¾ã£ã¦ããããã¾ãã
ãªã¬ãªã¬è¨¼ææ¸ãç¨æããã° SSL/TLS åã¯åºæ¥ãã®ã§ããããªã¬ãªã¬è¨¼ææ¸èªä½ãæ¨å¥¨åºæ¥ããã®ãããªããããã¨è¨ã£ã¦ãã¡ã¼ã«ãµã¼ãã¸ã®ã¢ã¯ã»ã¹ã®çºã«è¨¼ææ¸ã®ã³ã¹ããæãäºã«ããã¾ãç解ãå¾ãããªãç¶æ³ã ã£ãã*1ãã¾ãã¦ããèªå® ãµã¼ãã ã£ããããã...ã
ã¨ãããã¨ã§ãä»ã§ã CRAM-MD5 ã APOP ã®éè¦ã¯ããã¨æãã¾ãã対å¿ãã¦ããã¯ã©ã¤ã¢ã³ããå¤ãããã¨ããããããã¹ã¯ã¼ããå¹³æã§ãããã¯ã¼ã¯ãæµããªãã*2ã
ã§ãããµã¼ããé ããå´ã¨ãã¦ã¯ãå¹³æã®ãã¹ã¯ã¼ãããµã¼ãä¸ã«ä¿åããã¦ãããã¨ããã®ã¯ãã¨ã«ããè½ã¡çããªãã
DIGEST-MD5 ãªã
CRAM-MD5 ã®ä»ã«ãDIGEST-MD5 ã¨ããèªè¨¼æ¹å¼ããã£ã¦ãCRAM-MD5 ã®æ§ãªãã£ã¬ã³ã¸ï¼ã¬ã¹ãã³ã¹ã®èªè¨¼æ¹å¼ã§ããããã¯ã¼ã¯ã«ãã¹ã¯ã¼ããæµããªãã®ã§ãããå®ã¯ããã®å ´åã ã¨ãå¹³æã®ãã¹ã¯ã¼ããä¿åããå¿ è¦ãããã¾ããã
RFC 2831ã®ã2.1.2.1 Response-valueããããè¦ãã¨ã
response-value = HEX( KD ( HEX(H(A1)), { nonce-value, ":" nc-value, ":", cnonce-value, ":", qop-value, ":", HEX(H(A2)) })) If authzid is specified, then A1 is A1 = { H( { username-value, ":", realm-value, ":", passwd } ), ":", nonce-value, ":", cnonce-value, ":", authzid-value } If authzid is not specified, then A1 is A1 = { H( { username-value, ":", realm-value, ":", passwd } ), ":", nonce-value, ":", cnonce-value } ï¼ä¸ç¥ï¼ If the "qop" directive's value is "auth", then A2 is: A2 = { "AUTHENTICATE:", digest-uri-value } If the "qop" value is "auth-int" or "auth-conf" then A2 is: A2 = { "AUTHENTICATE:", digest-uri-value, ":00000000000000000000000000000000" }
A1 ãè¨ç®ãã¦ããã¨ããã®ãH( { username-value, ":", realm-value, ":", passwd } )ãã®é¨åã¯ãå ã«è¨ç®ãã¦ããã¦ä¿åãã¦ã大ä¸å¤«ãªã®ãåããã¾ã*3ãå®éãDovecot Ver 2 ã§ããã°ããdoveadm pwã*4ã§ãã®å¤ã®è¨ç®çµæã表示ãã¾ãã
$ doveadm pw -s DIGEST-MD5 -u JULY -p password {DIGEST-MD5}3d206b3a34d0d5f8e54320d57bec654c
ãã®ã{DIGEST-MD5}ããã¨ããæååããã®ã¾ã¾ãLDAP ã® userPassword ã¢ããªãã¥ã¼ãã«è¨å®ãã¦ãããDovecot ã LDAP ãåç §ããæ§ã«ãã¦ããã¨ãDIGEST-MD5 ã®èªè¨¼ãåºæ¥ã¾ãã
ãã ããã®å ´åãããã¾ã§ãã¢ããªãã¥ã¼ãã®å¤ã¨ãã¦ã{DIGEST-MD5}ãããä¿æãã¦ãããã¨ããã®ã LDAP å´ã®ç«å ´ã§ãä¾ãã°ãldappasswd ã§ãã¹ã¯ã¼ãå¤æ´ããã¦ãããã®å¤ãæ´æ°ããã訳ã§ã¯ããã¾ããã
LDAP ã® userPassword èªä½ã¯ãåæã«è¤æ°ã®å¤ãæã¤ãã¨ãã§ããä¾ãã°ãOpenLDAP ã®è¨å®ã§ãslapd.conf ã«
password-hash {SSHA} {CLEARTEXT}
ã¨æ¸ãã¨ãldappasswd ã使ã£ããã¹ã¯ã¼ãå¤æ´ã§ãSSHAï¼ã½ã«ãä»ã SHA ããã·ã¥å¤ï¼ãä¿æãã¦ãã userPassword ã¨ãå¹³æã®ãã¹ã¯ã¼ããä¿æãã¦ãã userPassword ã®ãï¼ã¤ã® userPassword ãæ´æ°ããã¾ãã
ãªã®ã§ãçæ³çã«ã¯ã
password-hash {DIGEST-MD5} {SSHA}
ã¨æ¸ããã°ãé常㮠LDAP ã®èªè¨¼ã PAM çµç±ã®èªè¨¼ã«å ãã¦ãSASL ã® DIGEST-MD5 èªè¨¼ã§åããã¹ã¯ã¼ãã使ããäºã«ãªãã¾ã*5ãããããæ®å¿µãªãããä¸è¨ã®ãããªè¨å®ã¯åºæ¥ã¾ããã
OpenLDAP ã« overlay ã¨ãããã©ã°ã¤ã³ã®ä»çµãããããã®ä¸ã« smbk5pwd ã¨ããç©ããã£ã¦ãããã使ãã¨ãSamba ã¨ã®ãã¹ã¯ã¼ãåæãå®ç¾åºæ¥ã¾ããåãããã« DIGEST-MD5 ç¨ã® overlay ãããã°...*6ã
Dovecot ã® CRAM-MD5
DIGEST-MD5 ã«é¢ãã¦ã¯ãåççã«å¹³æã®ãã¹ã¯ã¼ããä¿åãã¦ããªãã¦ãè¯ãäºãåããã¾ããå®ã¯ãDovecot ã®å ´åãCRAM-MD5 ã§ãåæ§ã«ããå¹³æã§ã¯ãªããã¹ã¯ã¼ããã使ã£ã¦ CRAM-MD5 ã使ããããã«ãªã£ã¦ãã¾ãã
$ doveadm pw -s CRAM-MD5 -p password {CRAM-MD5}9186d855e11eba527a7a52ca82b313e180d62234f0acc9051b527243d41e2740
ãã®å¤ã¯ãMD5 ã®ããã·ã¥å¤ãè¨ç®ãã¦ããæä¸ã®ä¸éå¤ããããä¸è¨ã®ãã¼ã¸ã§è§£èª¬ããã¦ãã¾ãã
Dovecot が保存する CRAM-MD5 認証用パスワード - snbhsmt_log
ãã®è¨ç®æ¹æ³ã OpenLDAP ã® plugin ã«ç§»æ¤ããã°*7ã
- LDAP ã§ã¦ã¼ã¶æ å ±ãä¸å 管çã
- SASL ã® CRAM-MD5 ã使ããã
- å¹³æãã¹ã¯ã¼ããä¿åããå¿ è¦ãç¡ãã
ã¨æã£ãã®ã§ãããè½ã¨ãç©´ã...ã
SASL ã®å®è£
SASL ãå®è£ ãã¦ããã©ã¤ãã©ãªã¨ãã¦ãè¯ã使ããã¦ããã®ã Cyrus SASL Library ã§ããSASL ããµãã¼ãããå¤ãã®ã½ããã§ã¯ããã® Cyrus SASL ã使ããã¦ãã¦ãOpenLDAP ã® SASL èªè¨¼ãããã®ã©ã¤ãã©ãªã使ã£ã¦ãã¾ãã
ä¸æ¹ãDovecot ã¯èªå㧠SASL ã®ä»çµãå®è£ ãã¦ãã¾ããCyrus SASL ã¯ä½¿ãã¾ãããPOP3ãIMAP ã§ã® SASL èªè¨¼ã¯ããã§è¯ãã®ã§ãããå°ãã®ã¯ SMTP-AUTH ã§ãã
å®ã¯ãpostfix ãªã Dovecot ãå®è£ ãã SASL ãå©ç¨ã§ãã¾ããéã«ãDovecot ã® SASL ã使ãã Dovecot 以å¤ã®ã½ãã㯠postfixï¼ã¨ eximï¼ãããã§ããpostfix ã¨ä¸¦ãã§ãã使ããã sendmail 㯠Cyrus SASL ã使ãã¾ãã
å ã®ãDIGEST-MD5 ã CRAM-MD5 ã§ããå¹³æã®ãã¹ã¯ã¼ããä¿åããªãã§å®ç¾ãããã¨ããã®ã¯ãããã¾ã§ã Dovecot SASL ã®å®è£ ã§ãã£ã¦ãCyrus SASL ã§ã¯ãããªäºã¯åºæ¥ã¾ããã
ã¤ã¾ããOpenLDAP ã® userPassword ãé å¼µã£ã¦ãããsendmail + Dovecotãã®çµã¿åããã§ã¯ä½¿ããªãäºã«ãªãã¾ãã
ã¾ã¨ã
LDAP ã§ã¢ã«ã¦ã³ããéä¸ç®¡çãã¦ãã¡ã¼ã«é¢ä¿ã ãã§ãªããOS ã Samba ãå«ãã¦èªè¨¼æ å ±ãçµ±ä¸ããããã¨ããè¦æã¯ãããªãæãããããã ãã©ãç¾å®ã«ã¯ãã¡ãã£ã¨ãã¤é½åãæªãã¨ããããã£ã¦ãç´å¾ããç°å¢ã«ãªããªããã¨ããæãããã¾ãã
ä¸è¨ã®è©±ã ã£ã¦ããSSL/TLS åãã¦ãCRAM-MD5 ã DIGEST-MD5 ã¯ãµãã¼ãããªããã¨ããã°åé¡ã¯ãªãããããã«è¨ãã°ããCRAM-MD5 ã DIGEST-MD5 ã®ãããªå端ãªç©ã使ãããKerberos ã使ãã°ãGSSAPI çµç±ã§ã·ã³ã°ã«ãµã¤ã³ãªã³ãã¨ãã話ãããã¾ãã
ãã ãSSL/TLS åã§ããã°ã証ææ¸ã®ç®¡çã¨ã³ã¹ãã®åé¡ãä»ãã¦åãããGSSAPI ã«ããã¨ããµãã¼ããã¦ããªãã¯ã©ã¤ã¢ã³ãã½ãããå¤ããã妥åç¹ã¨ã㦠CRAM-MD5 ã使ããã¨ããã¨ãä¸è¨ã®ãããªåé¡ã«ã¶ã¤ãããã¨ããã®ã¯æ¯ãããã§ãã
ä¸å¿ãOpenLDAP ã®é¨åãé å¼µãã°ãpostfixï¼or eximï¼ + Dovecot ã§è¯ãæãã«ãªãã®ã§ãããpostfix ã«é¢ãã¦ã¯ milter ã¨ã®é¢ä¿ãã¤ãã¤ãã ã£ããããã¨è¨ã£ã¦ exim ã«æãåºãã®ã¯èºèºããããã¨ããªããªããæºè¶³ã®ããçµã¿åããã¯ç¡ãã§ããã
*1:æ¢ã«ãwww.example.jp ã¨ãã Web ãµã¼ãç¨ã®è¨¼ææ¸ãæã£ã¦ãã¦ãåã FQDN ã§ã¡ã¼ã«ãµã¼ããéç¨ãããªãã追å ã®è²»ç¨ãçºçãã¾ãããæåããã¯ã¤ã«ãã«ã¼ã証ææ¸ãã¨ããæãããã¾ãããã¡ã¼ã«ã¯ã©ã¤ã¢ã³ãããã¡ãã¨å¯¾å¿ãã¦ãããã¯å¾®å¦ã§ãã
*2:ã§ããã¡ã¼ã«ã®ä¸èº«ãå¹³æã§æµãããã§ããã©ãã
*3:ä½ããåããã¹ã¯ã¼ãã§ãã¦ã¼ã¶åãå¤ãã£ãããã¬ã«ã ï¼ãã¡ã¤ã³åï¼ãå¤ããã¨ãåããã¹ã¯ã¼ãã§ãå¤ãå¤ããã®ã§ããããã«å¤æ´ãç¡ããã°ãã¨ããã®ãæ¡ä»¶ãã¬ã«ã ã¯ããã©ã«ãã ã¨ç©ºããªã®ã§ãã¦ã¼ã¶åã JULYããã¹ã¯ã¼ãã password ãªãã"JULY::password" ã¨ããæååã«å¯¾ãã MD5 ã®å¤ã®å¤ã«ãªãã¾ãã
*4:Ver 1.x ã§ããã°ãdovecotpw ã§åæ§ã®äºãåºæ¥ã¾ã
*5:ä½ããDovecot ãä¸äººã®ã¦ã¼ã¶ã«å¯¾ãã¦è¤æ°ã®ãã¹ã¯ã¼ããæã£ã¦ããå ´åãæ±ããå¾®å¦ã§ããAuthentication/PasswordSchemes - Dovecot Wiki ãèªãã¨ãéãã¬ã¼ã³ããã¹ãèªè¨¼ãããªãã¡ãCRAM-MD5 ã DIGEST-MD5 ããåæã«ä½¿ããããã°ãå¹³æã®ãã¹ã¯ã¼ããä¿åãã¦ããå¿ è¦ããããã¨ããäºãæ¸ãã¦ãããï¼ã¦ã¼ã¶ã«å¯¾ãã¦è¤æ°ã®éãã¹ãã¼ãã®ãã¹ã¯ã¼ãã使ããããã«ããã®ã¯ããIn futureãã¨ãªã£ã¦ãã¾ããã¨ãããå®éã«ã¯ãDovecot ã¨ãã¦ã¯ CRAM-MD5 ãã使ããªããã©ãpam çµç±ã§ã使ããã SSHA ã® userPassword ããã¨ããäºãããã¨ãLDAP ãæ¤ç´¢ããæã«ããï¼ã¤ãã userPassword ãã©ã®é åºã§è¿ãããã§ãDovecot ã®èªè¨¼çµæãå¤ãã£ã¦ãã¾ããå ã« SSHA ã®ããã·ã¥å¤ãè¿ã£ã¦ããã¨ããã®æç¹ã§ Dovecot ã¨ãã¦ã¯è«¦ãã¦ãã¾ã£ã¦ããããã§ããpassword-hash ã§æå®ããé åºãå¤ãã¦ãldappasswd ã§æ´æ°ããã¨ãæ¤ç´¢çµæã password-hash ã®é åºã§è¿ã£ã¦ããããã«è¦ãã¾ããã ã¨ããã°ãpassword-hash ã®é åºã¯ãDovecot ã«æ¾ããããç©ãå ã«æ¸ãå¿ è¦ãããã¾ããã¡ãªã¿ã«ãpam çµç±ã«èªè¨¼ã¯ããã®é åºã®å½±é¿ã¯åãã¾ããã§ããããã ãpassword-hash ã®é åºãæ¤ç´¢çµæã¨é£åãããã¨ã¯æ確ã«ãªã£ã¦ããªãã®ã§ãããã¾ã§ããçµé¨çã«ãã§ãã
*6:overlay 以å¤ã«ããåã«ãpluginãã¨å¼ãã§ããç©ããã£ã¦ãSHA256 ã SHA512 ã使ã£ãããã·ã¥å¤ãæ±ããããã«åºæ¥ãã®ã§ãããåãã¤ã³ã¿ãã§ã¼ã¹ã使ãã¨ãã¦ã¼ã¶åãåããªãã®ã§ããã® DIGEST-MD5 ç¨ã®ããã·ã¥å¤ãè¨ç®ã§ãã¾ãããoverlay ãªãåºæ¥ãããªãã ãã©ãã¤ã³ã¿ãã§ã¼ã¹ãè¤éã§ãããããããã¥ã¡ã³ããã»ã¨ãã©ç¡ãã®ã§ãèªåã§ä½ãã®ã¯ç¡çãã...
*7:ãã®ç§»æ¤ã¯ãæ¯è¼çç°¡åã«åºæ¥ã¾ãããå®éã®ã³ã¼ãã¯å¥ã®æ©ä¼ã«ã§ãã