๋ชจ๋์ํค์ SecurityPlugin์ ํ๊ฐ์ง
Contents
1. ์ค์ ¶
config.php
์ ๋ค์์ ๋ฃ์ผ๋ฉด ACL SecurityPlugin์ด ํ์ฑํ๋ฉ๋๋ค.$security_class="acl"; $acl_type="default";
2. ๋ฏธ๋ฆฌ ์ ์๋ ๊ทธ๋ฃน @group ¶
- @ALL: ๋ชจ๋ ์ฌ์ฉ์ (priority: 1)
- @User: ๋ฑ๋ก ์ฌ์ฉ์ (priority: 2)
3. ์ฌ์ฉ์ ์ ์ ๊ทธ๋ฃน @group ๊ทธ๋ฆฌ๊ณ @group์ priority ¶
##@๊ทธ๋ฃน์ด๋ฆ ์ฌ์ฉ์๋ฆฌ์คํธ [priority] @Guest Anonymous # priority๋ฅผ ์ง์ ํ์ง ์์ผ๋ฉด ๊ธฐ๋ณธ๊ฐ 2 @Kiwirian foobar,kiwi,hello123 20 # @Kiwirain ๊ทธ๋ฃน์ priority๋ฅผ ์ก๋๋ค.


# ๋ถ๋ถ IP, CIDR ๋ฑ๋ฑ๋ ๋ชจ๋ ์ง์. @Block 123.123.0.0/255.255.0.0, 123.12, 123.125.0/16
์์ ์์์ @Block ๊ทธ๋ฃน์ ์ ์ํ๊ณ ์์ผ๋ฉฐ ์ด์ ํด๋น๋๋ IP๋์ญ, ๋ถ๋ถIP ๋ฑ๋ฑ์ ์ง์ ํ๊ณ ์์ต๋๋ค.
์๋์ ๊ฐ์ด ๊ทธ๋ฃน์ ๋ํ ํจ๋ ฅ์ ๋ฐ์์ํฌ ์ ์์ต๋๋ค.
* @Block deny * // ๋ชจ๋ ํ์ด์ง(*)๋ฅผ @Block ์ฌ์ฉ์๊ทธ๋ฃน์ ๋ํด ๋ชจ๋ ์ก์ (*)์ ๊ฑฐ๋ถ(deny)

4. ACL ํ์ ¶
allow
: ํ์ฉ
deny
: ์ ํ
protect
: ๋น๋ฐ๋ฒํธ ์ ํ์ด ๊ฐ๋ฅํ ๋ช๋ช POST์ก์ ์ ๋ํด (๋ชจ๋ ์ก์ ์ด ๊ด๋ฆฌ๋น๋ฒ์ผ๋ก ์ ํ๊ฐ๋ฅํ์ง๋ ์์ต๋๋ค)
- ์ผ๋ถ POST์ก์
์ ๊ด๋ฆฌ์ ๋น๋ฐ๋ฒํธ๋ก ์ ํ์ ๊ฑธ์ด๋ ์ ์๋ ์ก์
์ protect ๊ฐ๋ฅํ ์ก์
์
๋๋ค. protect ์ก์
์ ์ ํ๋ allow์ด๋ฉฐ, ์ผ๋ถ POST์ก์
๋ง ์ง์ํฉ๋๋ค. ์) do_post_savepage()๋ post ์ก์
์ด๋ฉฐ, ์ผ๋ฐ do_goto()๊ฐ์ ์ก์
๊ณผ๋ ๋ฌ๋ฆฌ ๊ด๋ฆฌ์ ๋น๋ฐ๋ฒํธ๋ก ์ก์
์ ์ ํ์ ํ ์ ์์ต๋๋ค.
- ์ผ๋ถ POST์ก์
์ ๊ด๋ฆฌ์ ๋น๋ฐ๋ฒํธ๋ก ์ ํ์ ๊ฑธ์ด๋ ์ ์๋ ์ก์
์ protect ๊ฐ๋ฅํ ์ก์
์
๋๋ค. protect ์ก์
์ ์ ํ๋ allow์ด๋ฉฐ, ์ผ๋ถ POST์ก์
๋ง ์ง์ํฉ๋๋ค. ์) do_post_savepage()๋ post ์ก์
์ด๋ฉฐ, ์ผ๋ฐ do_goto()๊ฐ์ ์ก์
๊ณผ๋ ๋ฌ๋ฆฌ ๊ด๋ฆฌ์ ๋น๋ฐ๋ฒํธ๋ก ์ก์
์ ์ ํ์ ํ ์ ์์ต๋๋ค.
*
๋ ๋ชจ๋ ์ก์
์ ๊ฐ๋ฆฌํค๋ฉฐ, ํ์ด์ง ์ด๋ฆ์ regex๊ฐ ๊ฐ๋ฅํฉ๋๋ค.# ํ์ด์ง์ด๋ฆ @๊ทธ๋ฃน/ํน์ ์ฌ์ฉ์ allow/deny ์ก์ ๋ฆฌ์คํธ FoobarPage @ALL allow * FoobarPage babo deny edit,diff,info HelpOn.* @ALL deny edit,savepage
4.1. ๊ฐ๋จํ ์ ์ฉ์ ์ผ๋ถ ¶
@Guest Anonymous // @Guest ์ฌ์ฉ์ ๊ทธ๋ฃน ์ ์ * @ALL deny * // ๋ชจ๋ ํ์ด์ง(*)๋ฅผ ๋ชจ๋ ์ฌ์ฉ์(@ALL)์์ ๋ชจ๋ ์ก์ (*)์ ๊ฑฐ๋ถ(deny) * @ALL allow ticket // ๋ชจ๋ ํ์ด์ง๋ฅผ ๋ชจ๋ ์ฌ์ฉ์์๊ฒ ticket ์ก์ ์ ํ๋ฝ(allow) * @ALL allow read,userform,rss_rc,aclinfo,fortune,deletepage,fixmoin,ticket // ์ฌ๋ฌ ์ค๋ก ๋๋ ์ฐ๊ธฐ ๊ฐ๋ฅ * @User allow * // ๋ชจ๋ ํ์ด์ง(*)๋ฅผ ์ผ๋ฐ ๊ฐ์ ์ฌ์ฉ์์๊ฒ(@User) ํ๋ฝ(*) WikiSandBox @Guest allow edit,info,diff // WikiSandBox ํ์ด์ง๋ฅผ @Guest ๊ทธ๋ฃน์ edit,info,diff ์ก์ ์ ํ์ฉ(allow) WikiSandBox Foobar deny edit // ์ฌ์ฉ์ Foobar๋ WikiSandbox ํธ์ง ๋ชปํ๊ฒ ํจ
4.2. ์์ ํ ์ ์ฉ์ ์ ¶

# acl.default.php # <?php exit()?> // ํ์ผ์ php์ด์ง๋ง ํ์์ php๊ฐ ์๋ ์ผ๋ฐ ํ ์คํธ๋ค. # Please don't modify the lines above # # A sample Access Control Lists file for Moniwiki # @Guest Anonymous // @Guest ์ฌ์ฉ์ ๊ทธ๋ฃน ์ ์ * @ALL deny * // ๋ชจ๋ ํ์ด์ง(*)๋ฅผ ๋ชจ๋ ์ฌ์ฉ์(@ALL)์์ ๋ชจ๋ ์ก์ (*)์ ๊ฑฐ๋ถ(deny) * @ALL allow ticket // ๋ชจ๋ ํ์ด์ง(*)๋ฅผ ๋ชจ๋ ์ฌ์ฉ์(@ALL)์๊ฒ ticket ์ก์ ์ ํ๋ฝ(allow) ticket์ ๊ฐ์ ํผ์ ๋์ค๋ ๋ก๋ด๊ฐ์ ๋ฐฉ์ง captcha * @User allow * // ๋ชจ๋ ํ์ด์ง(*)๋ฅผ ์ผ๋ฐ ๊ฐ์ ์ฌ์ฉ์์๊ฒ(@User) ํ๋ฝ(*) # some pages are allowed to edit WikiSandBox @Guest allow edit,info,diff // WikiSandBox ํ์ด์ง๋ฅผ @Guest ๊ทธ๋ฃน์ edit,info,diff ์ก์ ์ ํ์ฉ(allow) # some POST actions support protected mode using admin password * @ALL protect deletefile,deletepage,rename,rcspurge,rcs,chmod,backup,restore // ๋ชจ๋ ํ์ด์ง(*)์ ๋ํด ๋ชจ๋ ์ฌ์ฉ์์(@ALL) detetefile,deltetepage ๋ฑ๋ฑ์ protect ๊ฐ๋ฅํ ์ก์ ์ protect # some actions allowed to @ALL * @ALL allow read,userform,rss_rc,aclinfo,fortune,deletepage,fixmoin,ticket # some pages have restrict permission MoniWiki @ALL deny edit,uploadfile,diff // MoniWiki ํ์ด์ง๋ฅผ @ALL ๋ชจ๋ ์ฌ์ฉ์์๊ฒ edit,upload,diff๋ฑ์ ์ผ๋ถ ์ก์ ์ ๊ฑฐ๋ถ
5.1. ๋ง์ง๋ง ACL ํญ๋ชฉ์ด ์ ์ฉ๋๋ค ¶
explicitํ๊ฒ ์ง์ ํ ๊ฒฝ์ฐ ์ต์ข
ACL ํญ๋ชฉ์ด ์ ์ฉ๋๋ค.
allow read
+deny read
=deny read
deny read
+allow read
=allow read
wildcard๋ฅผ ์ด ๊ฒฝ์ฐ๋ ์ญ์ ์ต์ข
ACL ํญ๋ชฉ์ด ์ ์ฉ๋๋ค.
allow *
+deny *
=deny *
๋ชจ๋ ์ก์ ์ ๊ฑฐ๋ถ
deny *
+allow *
=allow *
๋ชจ๋ ์ก์ ์ ์น์ธ
5.2. explicitํ๊ฒ ์ง์ ํด์ผ ํ๋ค ¶
wildcard๋ฅผ ์ด ๊ฒ ๋ณด๋ค explicitํ๊ฒ ์ง์ ๋ ๊ฒ์ด ๋จผ์ ์ ์ฉ๋๋ค. (์์์ ์๊ด ์๋ค)
deny *
+allow edit,info
= edit์ info ์ก์ ๋ง ๊ฐ๋ฅ: explicitํ๊ฒ ์ง์ ๋ ์ก์ ๋ง ํ๋ฝ
allow *
+deny info,diff
= info/diff ์ด์ธ์ ์ก์ ์ด ๋ชจ๋ ํ์ฉ: explicitํ๊ฒ ์ง์ ๋ ์ก์ ๋ง ๊ฑฐ๋ถ
deny info,diff
+allow *
= ์์ ๊ฒฝ์ฐ์ ๊ฐ๋ค. explicitํ๊ฒ ์ง์ ๋ ์ก์ ์ธ info, diff๋ง ๊ฑฐ๋ถ

deny *
+ allow read
๋ ์ํ์น์ Order allow,deny
์ ๊ฐ๋ค. ์ฆ, explicitํ๊ฒ ์ง์ ๋ allow์ ๋ํด ๋จผ์ ๊ฒ์ฌํ์ฌ ์ก์
์ด read์ผ๋๋ง ํ๋ฝํ๊ณ ๋๋จธ์ง ์ก์
์ deny.deny edit
+ allow *
์ ๊ทธ ๋ฐ๋๋ก Order deny,allow
๊ฐ ๋๋ค.5.3. ์ ¶
๋ชจ๋ ํ์ด์ง์ ๋ํด์ ์ฝ๊ธฐ๋ง ๊ฐ๋ฅํ๊ฒ, ProtectedPage์ ๋ํด์๋ ์ฝ๊ธฐ๋ ๊ฑฐ๋ถ
* @ALL deny * * @ALL allow read ProtectedPage @ALL deny readProtectedPage๋
deny *
+ allow read
+ deny read
= deny *
์ด ๋๋ค.
* @ALL deny * * @ALL allow read ProtectedPage @ALL deny *
ProtectedPage๋
๋ง์ง๋ง ์ค
deny *
+ allow read
+ deny *
์ด ๋๋ค: explicitํ๊ฒ ํ๋ฝ๋ read๊ฐ ํ์ฉ๋๋ค.๋ง์ง๋ง ์ค
ProtectedPage @ALL deny *
๋ ๋ฌด์๋๊ฒ ๋๋ ๊ฒ์ด๋ค.6. priority๊ฐ ๋ค๋ฅธ ๊ฒฝ์ฐ ACL์ ์ฑ๋ฆฝ ๊ณผ์ ¶
์์ ์ ์ค๋ช
์ priority๊ฐ ๊ฐ์ ๊ฒฝ์ฐ์ ๋ํ ์ผ๋ฐ์ ์ธ ์ค๋ช
์ด์๋ค. ๊ทธ๋ฃน์ priority๋ฅผ ๋์์ ๋๋ ์ด๋ป๊ฒ ์ ์ฉ๋ ๊น?
6.1. ์์ 1 ¶
@ALL deny * @User allow *
์ด ๊ฒฝ์ฐ @User์ priority๊ฐ ๋์ผ๋ฏ๋ก
allow *
์ด ์ ์ฉ๋๋ค.6.2. ์์ 2 ¶
@ALL deny * @User allow read
@User์์ read๊ฐ ํ์ฉ. ๋๋จธ์ง๋
@ALL deny *
์ ์ํด ๊ฑฐ๋ถ๋๋ค.6.3. ์์ 3 ¶
* @ALL deny * * @ALL allow read,ticket,info,diff,titleindex,bookmark,pagelist ProtectedPage @All deny read,ticket,info,diff,titleindex,bookmark,pagelist
- ๋ชจ๋ ์ฌ์ฉ์(@ALL)์๊ฒ allow๋ฅผ ์ ์ธํ ๋ชจ๋ ์ก์
๊ฑฐ๋ถ.
- ProtectedPage๋ edit,savepage๋ฅผ ์ ์ธํ๊ณ ๋ชจ๋ ๋ถํ
- ์ด ๊ฒฝ์ฐ, allow๋ฅผ explicitํ๊ฒ ํ ๋ชจ๋ ์ก์
์ ๋ํด explicitํ๊ฒ deny๋ฅผ ๊ฑธ์ด์ฃผ์ด์ผ ๋๋ค.
deny *
๋ผ๊ณ ๋ง ํ๋ฉด ์๋๋ค.
- ์ด ๊ฒฝ์ฐ, allow๋ฅผ explicitํ๊ฒ ํ ๋ชจ๋ ์ก์
์ ๋ํด explicitํ๊ฒ deny๋ฅผ ๊ฑธ์ด์ฃผ์ด์ผ ๋๋ค.
* @ALL deny * * @ALL allow show,ticket,titleindex,bookmark,pagelist * @User allow edit,savepage ProtectedPage @User deny * # ์ด๊ฒ๋ง์ผ๋ก๋ ์๋๋๋ก ์๋ ์ํ๋ค. # ๋ค์์ explicitํ๊ฒ ๋ช ์ํด์ผ ์๋๋๋ก ์๋ํ๋ค. ProtectedPage @User deny edit,savepage
- ์ผ๋ฐ ๋ฑ๋ก ์ฌ์ฉ์(@User)๋ edit,savepage ํ๋ฝ.
- ProtectedPage๋ ๋ชจ๋ ๋ถํ
- ์ด ๊ฒฝ์ฐ ๋ฑ๋ก ์ฌ์ฉ์์ ๋ํด
@User deny *
+@User allow edit,savepage
์ด๋ฏ๋ก edit,savepage๋ง ํ์ฉ๋๋ค.
allow edit,savepage
๋ผ๊ณ explicitํ๊ฒ ์ ์๋ ๊ฒ์ ๋ค์ ์ทจ์์์ผ์ผ ์๋๋๋ก ์๋ํ๋ ๊ฒ์ด๋ค. ๋ฐ๋ผ์ProtectedPage @User deny edit,savepage
๋ผ๊ณ ์จ ์ฃผ์ด์ผ ํ๋ค.
- ์ด ๊ฒฝ์ฐ ๋ฑ๋ก ์ฌ์ฉ์์ ๋ํด
6.4. ์ฐ์ต ¶
1) ๊ทธ๋ฃน priority๊ฐ ๊ฐ์ ํญ๋ชฉ๋ผ๋ฆฌ ํฉ์ณ์ง๊ณ , 2) ๊ทธ๋ฃน priority๊ฐ ๋์ ํญ๋ชฉ์ด ์ฐ์ ์ ์ผ๋ก ์ ์ฉ๋๋ค.
๊ฐ ACL ํญ๋ชฉ์ ๊ฐ์ priority๋ฅผ ๊ฐ์ง๋ ๋ชจ๋ ํญ๋ชฉ์ด ํฉํด์ ธ์ ์ ์ฉ๋ฉ๋๋ค.
####### @ALL ๊ทธ๋ฃน์ priority๋ 1์ด๋ค. @Guest Anonymous # @ALL์ ์ ์ธํ ๋ชจ๋ ๊ทธ๋ฃน์ priority๋ ๊ทธ ๊ฐ์ด ์ง์ ๋์ง ์์ผ๋ฉด 2 ์ด๋ค. @Group1 peter,john 20 # priority = 20 @Group2 simon,soo # default group priorty = 2 * @ALL allow * # group priority = 1 * @ALL deny backup,restore * @Guest deny * # group priority = 2 * @Group1 deny * # User defined @Group1 group * @Group1 allow read,info,diff * @Group2 deny info,diff
- peter์ john:
allow read,info,diff
+deny *
= read,info,diff๋ง ํ์ฉ
- Anonymous (@Guest):
deny *
: ๋ชจ๋ ๊ฑฐ๋ถ (@Guest๊ทธ๋ฃน์ priority๊ฐ ๋์ผ๋ฏ๋ก @ALL์ ๋ํด ํ์ฉ๋ ๊ฒ๊ณผ ๋ฌด๊ดํ๊ฒ ๊ฑฐ๋ถ๋๋ค)
- ๋ค๋ฅธ ๋ชจ๋ ์ฌ์ฉ์(@ALL):
deny backup,resotre
+allow *
(Order Deny,Allow)
- @Group1 :
allow read,info,diff
+deny *
(Order Allow,Deny)
- @Group2 :
deny info,diff
+@ALL deny backup,restore
+allow *
: priority๊ฐ ๊ฐ์ ํญ๋ชฉ์ด ํฉ์ณ์ง๋ค.

config.php์
$acl_debug=1
์ต์
์ ๋ฃ์ผ๋ฉด, ์ด๋ค ์์ผ๋ก ์ ์ฉ๋ ์ง๋ฅผ ๋ณด์ฌ์ค๋๋ค.