Apache/Tips


mod_auth_digest.soΥåȥåס󥹥ȡ

.htaccess Ѥ Digest ǧ(ǧ)

Digest ǧڤäơ

Ū Apache ǧڤȤƤ Basic ǧڡʴǧڡˤͭ̾ǤǤBasic ǧڤǤȤꤵ桼̾ȥѥɤξϰŹ沽ƤʤʿʸǥͥåȥͥåȥήƤޤФ mod_auth_digest Ѥˤϥ桼̾ѥɡǧΰ̾򸵤ˤ MD5 ϥåͤѤǧڤԤȤߤǤñƤޤȡŹ沽줿桼򸵤ǧڤǤȤǤ

.htaccess եǻꤹ硢ǧڤɬפȤǥ쥯ȥ̡Υ桼̾ȥѥɤäեɬפޤǤ Digest ǧڤǤϣĤΥեʣΥǥ쥯ȤФǧھޤȤƴ뤳ȤǤޤ(realm Ȥƥǥ쥯ȥ̤ޤˡ.htpasswd Τ褦ʥե뤬ǥ쥯ȥ֤ʤƤȤǤ⡢ԤˤȤäƤͭ񤤤Ǥ

⡢ǤϤʤ⤢ޤǧѤ Basic ǧƱͤ .htaccess httpd.conf ǻꤵƤǥ쥯ȥ Options +Indexes Ȼꤷƥǥ쥯ȥɽ褦ˤʤäƤƤ⡢ǥꥹȤɽ뤳ȤϤޤ

Apache ¦ɬפʻϡ

Apache ¦ɬפʤΤ mod_auth_digest ⥸塼뤬Ȥ߹ޤƤǤhttpd.conf ˼Τ褦ʹԤȤ߹ޤƤȻפäꤢޤѲǽǤ

LoadModule auth_digest_module modules/mod_auth_digest.so

⤷ DSO (ưŪȤ߹ߥ⥸塼) Apache бƤʤƥ饳ѥ뤵Ƥ Apache ǤкƹۤɬפȤʤäƤޤޤȤϤꥻƥι⤤ Digest ǧڤ뤿Ǥ顢ϻʤȤƥѥ뤷ޤ礦ġġ

Ȥˤ Digest ǧڤȤäƤߤ

ޤ Basic ǧڤꤷȤΤǤСDigest ǧڤؤƱ褦ʼꤹ뤳ȤޤBasic ǧڤǤ htpasswd ޥɤȤäƥ桼̾ȥѥɾե˺ޤФ Digest ǧڤǤ htdigest ޥɤȤäǧѤΥ桼̾ȥѥɤȤäϤ뤳ȤǤޤ

⤦ Digest ǧڤǰǰ realm ȤΤޤǧڤǥ쥯ȥˤĤ̾Τ褦ʤΤǤAuthName? ǻꤹ̾ AuthDigestFile? Ȥƻꤹѥɥե realm פʤǧڤޤ󡣤Ĥޤ realm ǧڤ̤뤿ΤΡȤ˹ͤ뤳ȤǤޤ

ϤƤȤˤƤߤޤ礦

ǧڤե֤ "/home/akane/digestpass" Ȥޤ.htpasswd Τ褦 Basic ǧڤƱͤ public_html ۲֤ΤϹޤʤȤޤʥФˤäƤȤƤޤ뤿Ǥˡ

ǧڤ realm "BIOHAZARD LEVEL 4" Ȥޤ

ǧڤ桼̾ "admin" ȤޤѥɤŬǤ

ơޤ htdigest ޥɤȤäǧѤΥեޤhtdigest ν񼰤ϼΤ褦ʤΤǤ

$ htdigest -c ǧڥե̾ "realm" 桼̾

ǻꤷƤߤȡ

$ htdigest -c /home/akane/digestpass "BIOHAZARD LEVEL 4" admin
Adding password for admin in realm BIOHAZARD LEVEL 4.
New password:
Re-type new password:

Τ褦ˤʤޤ碌ƥѥϤƤޤΤǡƱѥɤޤcat 򸫤ƤߤȡΤ褦ʴˤʤޤ

$ cat digestpass
admin:BIOHAZARD LEVEL 4:b28b9c50895dacaa50655efbcf01f8db

⤦ admin2 Ȥ桼ɲäޤ礦-c ץϽΤߤǤե뤬ʤп˥ե뤬Ƥо񤭤ޤ-c ʤơ桼̾ admin2 ȤƥޥɤϤޤ

$ htdigest /home/akane/digestpass "BIOHAZARD LEVEL 4" admin2
Adding user admin2 in realm BIOHAZARD LEVEL 4
New password:
Re-type new password:
$ cat digestpass
admin:BIOHAZARD LEVEL 4:b28b9c50895dacaa50655efbcf01f8db
admin2:BIOHAZARD LEVEL 4:ebc432e44550e90df6ec230de0c453ce

Τ褦 admin, admin2 桼Ф "BIOHAZARD LEVEL 4" ȤФǧھ󤬽񤭹ޤ褦ˤʤޤ

ʤߤ¾ξǧڤǤƱե˽񤭹ߤޤ㤨 "BIOHAZARD LEVEL 1" Ȥ guest 桼ФƤԤ

$ htdigest /home/akane/digestpass "BIOHAZARD LEVEL 1" guest
Adding user guest in realm BIOHAZARD LEVEL 1
New password:
Re-type new password:

Τ褦˻ꤹ뤳ȤǤޤcat ǥեΤȡ LEVEL 1 ȤФ guest 桼ǧھϿ줿Ȥʬޤ

$ cat digestpass
admin:BIOHAZARD LEVEL 4:b28b9c50895dacaa50655efbcf01f8db
admin2:BIOHAZARD LEVEL 4:ebc432e44550e90df6ec230de0c453ce
guest:BIOHAZARD LEVEL 1:7061b4a856732e77a93c9c2d0213cf33

Ƽ .htaccess ե֤Ǥ⤦־ľƤߤޤ

ǧڤե֤ "/home/akane/digestpass" Ȥޤ
ǧڤ realm  "BIOHAZARD LEVEL 4" Ȥޤ
ǧڤ桼̾ "admin" ȤޤѥɤŬǤ

ǧڤ URL http://192.168.11.253/~akane/auth/ Υǥ쥯ȥ /home/akane/public_html/auth Ȥѥˤʤޤ

.htaccess ե /home/akane/public_html/auth/.htaccess ֤ޤեȤϼΤ褦ʤΤǤ

AuthType Digest
AuthName "BIOHAZARD LEVEL 4"
AuthDigestFile /home/akane/digestpass
Require admin

Ȥϥ֥饦饢Ƥߤޤ

⤷Internal Server Error ФƤޤäơ顼Ƥ

/home/sakura/public_html/.htaccess: Invalid command 'AuthDigestFile', perhaps mis-spelled or defined by a module not included in the server configuration

ǤС mod_auth_digest.soΥåȥåס󥹥ȡ򻲾Ȥơmod_auth_digest.so κƥѥ뤬ɬפǤ

apache_digest.gif

äѤäǧڲ̤ˤʤޤ͡ Internet Explorer 6 ǤβɽǤrealm = AuthName? ǻꤷ̾ǧڤ̾ȤɽޤȤ̤ɤ桼̾ȥѥɤȤäǧڤޤ

ȤƤ Require valid-user λ꤬ȤʤʤޤȤȤƤ Internal Server Error ˤʤޤˤ⼡Τ褦ʥ顼Ĥ褦ˤʤޤ

access to /~akane/auth/ failed, reason: unknown require directive:"valiid-user"

ºݻƤߤȡۤȤ Basic ǧڤѤޤ󡣤⤷Ф Digest ǧڤбƤΤǤСǧڤǤ Digest ǧڤѤ褦ˤۤȰǤ礦

ޤʤ

顼 failed, reason: unknown require directive "xxxx"

.htaccess εҤʤ桼̾λ꤬ʤǽޤ

ξϡޤưǧΤ

Require valid-user

Τ褦ˡǤե桼Ǥǧڤդ褦˽񤭴ƤߤƤߤɤǤȤϡ

tail -f /usr/local/apache/logs/error_log

ʤɤΤ褦ˤơ顼ꥢ륿İƤȡˤĤʤȻפޤ


ͻ


ȥå   Խ ʬ Хåå ź ʣ ̾ѹ   ñ측 ǽ   إ   ǽRSS
Last-modified: Sun, 19 Sep 2010 14:56:26 JST (2314d)