OpenLDAP ä¸ã®ãã¹ã¯ã¼ãæ å ±
OpenLDAP 㧠userPassword ã¢ããªãã¥ã¼ãã«ãã¹ã¯ã¼ãæ å ±ãä¿åããå ´åãæ¨å¥¨ã¯ã½ã«ãä»ã SHAï¼SSHAï¼ã¨ããã¦ããã¨æãã¾ããå®éãCentOS Ver 6.3 ä¸ã® OpenLDAP ã«ä»ãã¦ãã slappasswd ã³ãã³ãã¯ããªãã·ã§ã³ãæå®ããªãããã©ã«ãã¯ãSSHA ã®å½¢å¼ãåºåãã¾ãã
ããããé«é㪠GPU ãå»ä¾¡ã«è²©å£²ããããã® GPU ãé§ä½¿ãã¦ä¸¦åè¨ç®ãããã¨ããã«ã¼ããã©ã¼ã¹ã«ãã解æããå®ç¨çãªæéã§æåããããã«ãªãã¾ããã
å»å¹´ã® 12 æã«é£ã³è¾¼ãã§ããããNTLM ããã·ã¥ã 8 æåã¾ã§ã®ãã¹ã¯ã¼ããªãï¼æéçã*1ã¯è¡æçã§ãç§ããã®ãã¨ãæ¥è¨ã«æ¸ãã¾ãã*2ãNTLM ããã·ã¥ã¯ Unicode ã§è¡¨ç¾ããããã¹ã¯ã¼ãæååã® MD4 ããã·ã¥å¤ã§ãSHA-1 ããã¯åºåãããããã·ã¥å¤ã® bit é·ãçããï¼ã¤ã®ããã·ã¥å¤ãæ±ããæéã¯ãããããSHA-1 ãã MD4 ã®æ¹ãçãã¨ã¯æãã¾ãããããã§ããä½ç¾åãä½ååãéããã¨ããäºã§ã¯ãªãã§ãããã
http://www.cryptopp.com/benchmarks.html
ä¸è¨ãµã¤ãã«ãæ§ã ã¯ããã·ã¥å¤è¨ç®ãæå·åå¦çã®ãã³ããã¼ã¯çµæãããã¾ãããMD5 㨠SHA-1 ã®æ¯è¼ã§ããããï¼åï¼MD5 ã®æ¹ãé«éï¼ã¨ããçµæã«ãªã£ã¦ãã¾ããMD4 ãã©ã®ãããã«ãªãã®ãåããã¾ãããã大ããè¦ç©ãã£ã¦ã 10 åã«ã¯ãªããªãã¨æãã¾ãã
ä»®ã«ãSHA-1 ã®è¨ç®ã MD4 ãã 10 åã®æéãããããã¨ãã¦ããå ã®ãï¼æéåãã¯ã55 æéãã«ãããªãã¾ãããï¼æ¥ä½ãã§å¿ ã解ãããã¨ããäºã«ãªã£ã¦ãã¾ãã¾ããã塩加減は重要? - JULYの日記ãã§ãæ¸ãã¾ããããã½ã«ãã®æç¡ã¯ Rainbow Table 対çã«ã¯ãªã£ã¦ãããã«ã¼ããã©ã¼ã¹å¯¾çã«ã¯ãªãã¾ããã
ã¾ããå®éã« SHA ã®å¤ãåä¸ã® GPU 㧠33 æ¥éã§è¦ã¤ããããã¨ããï¼å¹´åã®è¨äº*3ãããã¾ã*4ã
ãã«ã¼ããã©ã¼ã¹å¯¾çã«ã¯ã¹ãã¬ããã³ã°ããªã®ã§ãããèªåã§ä½ã Web ã¢ããªã±ã¼ã·ã§ã³ãªãã¨ããããLDAP ã®ãã¹ã¯ã¼ããã£ã¼ã«ãã«å¯¾ãã¦ãç¬èªã®ã¹ãã¬ããã³ã°ãè¡ã OpenLDAP ç¨ã® overlay ã plugin ãä½ããã¨ããã®ãæ°ãå¼ãã¾ãã
{CRYPT} 㯠crypt(3)
OpenLDAP ã®ãã¹ã¯ã¼ãã»ã¹ãã¼ã ã«ã{CRYPT} ã¨ããã®ãããã¾ããããã¯ãå¤ããã UNIX ç³» OS ã® /etc/passwd ã /etc/shadow ã®ãã¹ã¯ã¼ãã»ãã£ã¼ã«ãã«è¨è¿°ãããããå½¢å¼ã§ãå¤å ¸çã«ã¯ ASCII ã®ãã¹ã¯ã¼ãæååã DES ã®éµã¨ãã¦ãå ¨ããã 0 ã®ãã¼ã¿ãåºçºç¹ã«ãç¹°ãè¿ãæå·åããçµæã«ãªãã¾ã*5ã
ããããä»æããã® DES ã使ã£ãå½¢å¼ã®å¤ãä¿åãã¦ããç©ãè¦ã¾ãããåç¨ UNIX ã§ããLinux ã§ãã10 年以ä¸åãããMD5 ã使ã£ãå½¢å¼ãªã©ã«å¤ãã£ã¦ãã¦ãã¾ãã
ããã¯ããã®ãã¹ã¯ã¼ãã»ãã£ã¼ã«ãã«è¨è¿°ããå 容ãè¨ç®ãã crypt ã¨ãã C è¨èªç¨ã®é¢æ°ãæ¡å¼µããå½¢ã§å®ç¾ããã¾ãããå ·ä½çã«ã¯ crypt ã®å¼æ°ã«æ¸¡ãã½ã«ãã§ãå é 3 æåã«ç¹å¥ãªæå³ãæãããããã«ãã£ã¦è¨ç®å¦çãå¤ããããã«ãªã£ã¦ãã¾ããä¾ãã°ãã$1$ãã§å§ã¾ã£ãã½ã«ãã渡ãããããMD5 ã使ã£ãè¨ç®å¦çãè¡ããã¨ãã£ãæãã§ããä»ã§ã¯ MD5 ã®ä»£ããã« SHA-256ãSHA-512 ã使ã£ãå½¢å¼ããããæè¿ã® Linux ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã§ã¯ SHA-512 ã使ãã$6$ãã«ãªã£ã¦ãã¾ãã
ã¨ããããè¨å®ãããã¹ã¯ã¼ãã¨ã½ã«ããã MD5 ã®å¤ãæ±ãããã¨ãã¦ããå®éã« /etc/shadow ã«æ¸ãè¾¼ã¾ããç©ã¨ã¯ãä¼¼ã¦ãä¼¼ã¤ããªãçµæã«ãªãã¾ããã§ãå®éã« crypt ã®å¦çã調ã¹ããã¨ãããã¾ãã
å®ã¯ MD5 ã使ã£ã crypt ã¨ããã®ã¯ã1,000 åã®ã¹ãã¬ããã³ã°ãè¡ã£ãå¦çã§ãããã¡ãªã¿ã« SHA-256 ã SHA-512 ã®å ´åããåæ§ã®ã¹ãã¬ããã³ã°ããã¦ãã¾ãã
ã§ãæ¹ã㦠OpenLDAP ã®ããã¥ã¡ã³ããèªãã¨ãslapd.conf ã®è¨å®ã« password-crypt-salt-format*6 ã¨ããé ç®ãããã¾ããã
OpenLDAP Faq-O-Matic: How do I specify the crypt(3) salt format to use?
password-crypt-salt-format ã«æå®ããã®ã¯ printf ã®æ¸å¼æå®åã®å½¢å¼ã§è¨è¿°ãã¾ããä¸è¨ãã¼ã¸ã§ã¯ããpassword-crypt-salt-format "$1$%.8s"ãã¨ããä¾ãåºã¦ãã¾ãããããããã°ãã$1$ãã§å§ã¾ãããã®å¾ãã« 8 æ¡ã®ã½ã«ãæååãç¶ããã¨ã«ãªãã¾ãã
ã¤ã¾ãã
- password-hash ã« {CRYPT} ãæå®ã
- password-crypt-salt-format ã« "$1$%.8s" ã¨è¨å®ãã
ã¨ãMD5 ã 1,000 åç¹°ãè¿ãã¹ãã¬ããã³ã°å¦çãããçµæããuserPassword ã®ã¢ããªãã¥ã¼ãã«æ¸ãè¾¼ã¾ããäºã«ãªãã¾ããMD5 ã®è¨ç®æéã SHA-1 ã®ååã ã£ã¨ãã¦ãããã«ã¼ããã©ã¼ã¹ã§è§£ãã«ã¯ãåç´è¨ç®ã§ {SSHA} ã® 500 åã®æéããããäºã«ãªãã¾ããä»®ã«ãMD5 㨠MD4 ã®è¨ç®æéãåç¨åº¦ãã¨æ§ããã«è¦ç©ãã£ã¦ããå ã® 5.5 æéã®è£ 置㧠2,750 æéã4 ã¶æè¿ãæéããããäºã«ãªãã¾ãããã SHA-512 ã® crypt ã使ãããã«ããã°ãå ã«ç´¹ä»ãããã³ããã¼ã¯çµæãè¦ãã¨ãããã« 2.5 åç¨åº¦ã®æéãè¦ããã®ã§ 10 ã¶æã®æéãå¿ è¦ãã¨ããäºã«ãªãã¾ãã
å¶éäºé
slapd ãåãã OS ä¸ã® crypt(3) ã®æ©è½
OpenLDAP ã® {CRYPT} ã¯ããã® OS ä¸ã® crypt é¢æ°ã®å®è£ ã«ä¾åãã¾ãããªã®ã§ãè¤æ°ã® slapd ã§åæããã¦ãããããªå ´åãããããã® OS ä¸ã® crypt ã®å®è£ ã§æã£ã¦ããå¿ è¦ãããã¾ã*7ãMD5 ã使ã£ãå½¢å¼ã§ããã°ããã»ã©ã®äºãç¡ãéãã対å¿ãã¦ããªãäºã¯èãããã¾ããããSHA-256ãSHA-512 ã使ãã®ã§ããã°è¦æ³¨æã§ãã
ã¡ãªã¿ã«ãRHEL / CentOS ã®å ´åãpam_unix 㧠SHA-256ãSHA-512 対å¿ã¨ãªã£ãã®ã¯ Ver. 5.2 ã§ã*8ã®ã§ãå°ãªãã¨ããã®ãã¼ã¸ã§ã³ä»¥éã§ããã°å¤§ä¸å¤«ãªã¯ãã§ãã
LDAP ã使ãããã°ã©ã ã®å®è£
ã¦ã¼ã¶èªè¨¼ãè¡ãããã°ã©ã ãããã®ããã¯ã¨ã³ãã¨ã㦠LDAP ã使ãå ´åã大ããåã㦠2 ã¤ã®å®è£ æ¹æ³ãããã¾ãã
- å ¥åãããã¢ã«ã¦ã³ãåããã¹ã¯ã¼ãã使ã£ã¦ãLDAP ãµã¼ãã¸ã®ãã¤ã³ãã試ã¿ãã
- userPassword ã¢ããªãã¥ã¼ããç´æ¥åç §ã»æ¯è¼ããã
åè ã®å ´åã¯ãslapd ãã©ããªãã¹ã¯ã¼ãã»ã¹ãã¼ã ã使ã£ã¦ããã¯å ¨ãé¢ä¿ããã¾ããããå¾è ã®å ´åã¯ããã°ã©ã å´ã {CRYPT} 㧠DES 以å¤ã®å½¢å¼ãæ±ããããã¨ããåé¡ã«ãªãã¾ãã
ä¾ãã°ãDovecot ã§ã¦ã¼ã¶èªè¨¼ã« LDAP ã使ãå ´åã
- Passdb LDAP with authentication binds (http://wiki2.dovecot.org/AuthDatabase/LDAP/AuthBinds)
- Passdb LDAP with password lookups (http://wiki2.dovecot.org/AuthDatabase/LDAP/PasswordLookups)
ã®äºéãã®æ¹æ³ããããauth_bind ã yes ã«ããã°åè ãno ã«ããã°å¾è ã«ãªãã¾ãã
ãããPOP3 㧠APOPãIMAP 㧠DIGEST-MD5 ã CRAM-MD5 ã使ããããã°å¾è ããé¸æã®ä½å°ãããã¾ããããããã§ãªããã°ãåè ã®æ¹å¼ã使ãã¾ãã
åè ã®æ¹å¼ã使ããã®ã§ããã°ããã¹ã¯ã¼ãã»ã¹ãã¼ã ã®åé¡ã¯çãã¾ããããå¾è ã®å ´åã¯ãDovecot ããã¾ãæ±ãããã©ããã確èªããå¿ è¦ãããã¾ã*9ã
RFC 3062 é対å¿
ãã¹ã¯ã¼ããå¤æ´ããéãRFC 3062 ã®ãLDAP Password Modify Extended Operationãã«å¯¾å¿ãã¦ããããã°ã©ã ããã§ããã°ãslapd ã userPassword ãè¨å®ãããã¹ã¯ã¼ãã»ã¹ãã¼ã ã§ä¿åãã¦ããã¾ãããããã«é対å¿ã®å ´åãuserPassword ã«ä¿åããå 容ãç´æ¥æ¸ãè¾¼ãç©ãããã¾ããã³ãã³ãã©ã¤ã³ã® ldappasswd 㯠RFC 3062 対å¿ãªã®ã§åé¡ãªãã®ã§ãããä¾ãã° Apache Directory Studio*10 ã¯å¯¾å¿ãã¦ãã¾ãã*11ã
ããã¯ãpassword-crypt-salt-format ãæå®ãã¦ããå¦ãã«ããããããã¯ã©ã¤ã¢ã³ãå´ã§åæã«ãã¹ã¯ã¼ãã»ã¹ãã¼ã ãå¤æ´ã§ããäºã«ãªãã®ã§ãããããªãã®ã§ãããããããããã®ãã¼ã«ã使ãã®ã§ããã°ãslappasswd 㧠-c ãªãã·ã§ã³ã« password-crypt-salt-format ã«æå®ããã®ã¨åãç©ãæå®ãã-h ãªãã·ã§ã³ã« {CRYPT} ãæå®ããã°ãuserPassword ã¢ããªãã¥ã¼ãã«ä¿åãããå¤ãè¨ç®ã§ãã¾ãã
$ slappasswd -h {CRYPT} -c '$1$%.8s' New password: Re-enter new password: {CRYPT}$1$t6PXjyr8$R9LHggt9sf2ietomynfRo0
ãã ãslappasswd ã使ãããªããldappasswd ã§å¤ããæ¹ãæ©ãã§ãã...ã
ããã©ã¼ãã³ã¹
ãããããï¼åº¦ã® SHA-1 ã®è¨ç®å¦çã§ç¶±æ¸¡ãç¶æ ã«ãããããªãµã¼ãã®å ´åããã®ã¾ã¾ãã¹ã¯ã¼ãã»ã¹ãã¼ã ãå¤æ´ããã°ç ´ç¶»ãã¾ãããããããèªè¨¼å¦çã§ããã¾ã§éãç¶æ ãªæç¹ã§ãã·ã¹ãã å¢å¼·ãªã©ãæ¤è¨ãã¹ãã§ãã...ã
ã¾ã¨ã
ã¨ãããã¨ã§ããããã·ã¹ãã å ¨ä½ã§åé¡ãç¡ãã®ã§ããã°ãOpenLDAP ã§ã®ãã¹ã¯ã¼ãã¹ãã¼ã ã¯ã
password-crypt-salt-format ãæå®ããä¸ã§ã{CRYPT} ã使ãã
ããä»ã®ã¨ããæ£è§£ãã¨ããäºã«ãªãã¾ãããã«ã¼ããã©ã¼ã¹èæ§ã¯ã"$1$%.8s" 㧠{SSHA} ã®ããã 500 åã«ä¸ããã¾ãããã¹ã¯ã¼ãé·ãï¼æåå¢ãããããé«ãå¹æãå¾ãããäºã«ãªãã¾ãã
ãã ããçããã¹ã¯ã¼ããåèªã使ã£ããããªãã¹ã¯ã¼ããªã©ãè¨å®ããããã»ã¨ãã©å¹æã¯ããã¾ãããååã«é·ããè¤éãªãã¹ã¯ã¼ãã§ã使ãåããããªããã¨ããéåã¯ãä½ãå¤ãããã¨ã¯ããã¾ããã
*1:8文字の全パスワードを5時間半で解析するコンピュータクラスタが登場 - CNET Japan
*2:こんなに早く、この日が来るとは... - JULYの日記
*3:エフセキュアブログ : 「SHA-1+salt」はパスワードに十分だと思いますか?
*5:crypt (C) - Wikipedia Traditional DES-based scheme åç §
*6:ä»æã® cn=config ãããªã³ã©ã¤ã³ã§è¨å®å¤æ´ãããå ´åã 㨠olcPasswordCryptSaltFormat ã«è©²å½ãã¾ãã
*7:試ãã¦ã¯ãã¾ããããåæèªä½ã¯æ£å¸¸ã«è¡ãããããããã¾ããããã ãuserPassword ã¢ããªãã¥ã¼ãèªä½ãæ£ããåæã§ãã¦ãããã¤ã³ãæã«æ£ããèªè¨¼ã§ããªããã¨ããäºæ ã«ãªãäºãæ³åããã¾ãã
*8:Bug 435804 – RHEL5.2 Release Notes: SHA-256 and SHA-512 support in password hashing
*9:æªç¢ºèªãDovecot ã {CRYPT} ã ã£ãæã«ãã®ã¾ã¾ crypt é¢æ°ãå¼ã³åºãã¦ããã°ã大ä¸å¤«ãªã¯ãã
*10:Welcome to Apache Directory Studio — Apache Directory
*11:Ver. 1.5 ç³»ã®å ´åãVer. 2 ç³»ã¯ä¸æã§ããã試ããæãã§ã¯å¯¾å¿ãã¦ããæ°é ãç¡ãã£ãã§ãããµã¼ãå´ã®è¨å®ã®é¢ä¿ã¨ããããã®ããªãã