안녕리눅스 3 User Guide
  • Introduction
  • Chapter 1. 안녕 리눅스 3 \/ CentOS 7.2 차이점
  • Chapter 2. Access Control
    • 안녕 리눅스 방화벽 설정
      • 기본 설정
      • Inbound 제어
      • Outbound 제어
      • brute force attack 제어
      • User defined rule 제어
      • 특정 국가에서의 접속 제어
      • oops-firewall 실행 방법
    • Shell login Control (with PAM)
      • login 가능한 account 제한
      • login account chroot
      • Google OTP를 이용한 2 factor 인증
    • 인증 통합 (Authentification\/Authorization Intergrate)
      • Openldap
        • Master Server 설정
        • SSL 설정
        • Slave Server 설정
        • Replication 설정
        • LDAP 클라이언트 인증 연동 설정
        • LDAP data 관리
        • Sudo LDAP 연동
      • NIS
      • Active Directory
  • Chapter 3. Web control
    • httpd
    • nginx
    • lighttpd
    • PHP
    • Web Access Control
      • Apache 2.4
      • Nginx
      • lighttpd
    • Web Monitor agent
  • Chapter 4. JVM 운영
  • Chapter 5. DNS 운영
    • 기본 설정
    • 신규 도메인 설정
    • Slave DNS 구성
    • Inverse Domain 설정
    • DNSSEC 설정
    • GeoDNS 설정
    • Domain 위임
    • IDN
    • Troble Shooting
  • Chapter 6. Time Server 운영
    • Chrony
    • NTP
  • Chapter 7. VPN 운영
  • Chapter 8. SMTP 운영
  • 안녕 리눅스 White Paper
    • Disk Partition Aligment
  • 안녕 리눅스 알려진 버그
  • 안녕 리눅스 3 패키지 일람
    • [AN:core]
      • annyung-release
      • byspam
      • check-utils
      • genpasswd
      • httpd-conf
      • httpd-krisp
      • httpd-nis
      • httpd-url
      • kmod-geoip
      • l4vip
      • ldap-auth-utils
      • libchardet
      • libimginfo
      • libipcalc
      • libkrisp
      • mariadb-aes256
      • olibc
      • oops-firewall
      • perl-KRISP
      • perl-ModuleList
      • php-chardet
      • php56-chardet
      • php71-chardet
      • php-common
      • php56-common
      • php71-common
      • php-fpm-conf
      • php56-fpm-conf
      • php71-fpm-conf
      • php-geoip
      • php56-geoip
      • php71-geoip
      • php-korean
      • php56-korean
      • php71-korean
      • php-krisp
      • php56-krisp
      • php71-krisp
      • php-nis
      • php56-nis
      • php71-nis
      • php-pear-KSC5601
      • php-pear-ipcalc
      • php-pear-krisp
      • php-pear-oops-key
      • procdump
      • python-chardet
      • python-krisp
      • remount
      • utf8-profile
      • whois
      • yum-annyung
    • [AN:base]
      • apr
      • authconfig
      • bash
      • bind
      • chrony
      • coreutils
      • ctags
      • cvs
      • ecj
      • filesystem
      • GeoIP
      • gperftools
      • httpd
      • initscrtips
      • iptables
      • java-1.8.0-openjdk
      • javapacakges-tools
      • linuxdoc-tools
      • mariadb
      • memcached
      • net-tools
      • ntp
      • openssh
      • openssl
      • pam
      • php
      • procmail
      • procps-ng
      • redhat-rpm-config
      • rootfiles
      • rsyslog
      • sendmail
      • setup
      • shadow-utils
      • sudo
      • systemd
      • sysvinit-tools
      • tomcat
      • traceroute
      • unzip
      • util-linux
      • vim
      • xinted
    • [AN:xless]
    • [AN:addon]
      • authbind
      • cronolog
      • google-authenticator
      • hping3
      • httpd-fcgid
      • imap
      • jfbterm
      • jlint
      • libevent14
      • libnet
      • libnetfilter_acct
      • lighttpd
      • mhash
      • mimetex
      • mm
      • netdata
      • netperf
      • nginx
      • openvpn
      • pdnsd
      • perl-CSS-DOM
      • php-pecl-apcu
      • php56-pecl-apcu
      • php71-pecl-apcu
      • php-pecl-memcache
      • php56-pecl-memcache
      • php71-pecl-memcache
      • php-pecl-oauth
      • php56-pecl-oauth
      • php71-pecl-oauth
      • php-pecl-xdebug
      • php56-pecl-xdebug
      • php71-pecl-xdebug
      • php56
      • php71
      • proftpd
      • python-Mako
      • python-MarkupSafe
      • python-mcrypt
      • python-openpyxl
      • python-xlrd
      • re2c
      • redis
      • rudiments
      • splint
      • sqlite32
      • sqlrelay
      • tomcat-native
    • [AN:plus]
  • 안녕 리눅스 Upgrade Guide
Powered by GitBook
On this page
  • 1. IP based access control
  • 2. referer based access control
  • 3. User Agent based access control
  • 4. Country/ISP based access control
  • 5. User based access control
  • 5.1. mod_auth
  • 5.2. mod_auth_nis

Was this helpful?

  1. Chapter 3. Web control
  2. Web Access Control

lighttpd

PreviousNginxNextWeb Monitor agent

Last updated 5 years ago

Was this helpful?

목차 1. IP based access control 2. referer based access control 3. User Agent based access control 4. Country/ISP based access control 5. User based access control 1. mod_auth 2. mod_auth_nis

lighttpd의 접근 정책은 기본적으로 mod_access 에서 제공하는 url.access-deny 설정을 이용하여, conditonal field를 이용하여 응용을 합니다.

conditional field의 종류에 대해서는 을 참조 하십시오.

1. IP based access control

$HTTP["remoteip"] block을 이용하여 제어

# allow only 192.168.0.1
$HTTP["remoteip"] == "192.168.0.1" {
  url.access-deny = ("")
}

# allow all ip except 192.168.0.1
$HTTP["remoteip"] != "192.168.0.1" {
  url.access-deny = ("")
}

# allow 192.168.*.* and 121.33.*.*
$HTTP["remoteip"] =~ "^192.168|121.33" {
  url.access-deny = ("")
}

위의 방법 외에, 안녕 리눅스는 mod_net_access 라는 3rd party module을 통하여 좀더 편한 방법을 제공 합니다.

$HTTP["url"] =~ "/server-(status|config)" {
    url.order               = "allow"
    url.list                = ("127.0.0.1", "10.0.0.0/8")
}

이 기능을 사용하기 위해서는 mod_net_access 모듈이 load되어야 하며, 위의 예제 처럼 /server-status 와 /server-config handler에 사용하기 위해서는, mod_net_access 모듈이 mod_status 모듈 보다 먼저 load 되어야 합니다.

server.modules += (
  ...
  "mod_net_access",
  "mod_status",
   ...
)

2. referer based access control

# access.allow.com 에서의 접근이 아니면 불허
$HTTP["referer"] !~ "^http[s]?://access.allow.com" {
  url.access-deny = ("")
}

3. User Agent based access control

# Bot 접근 불허
$HTTP["useragent"] =~ "Bot" {
  url.access-deny = ("")
}

4. Country/ISP based access control

안녕 3의 lighttpd에서는 $HTTP["country"] 와 $HTTP["isp"] conditional field를 이용하여 접속자의 country 또는 isp를 이용하여 access control이 가능 합니다.

이 기능은 안녕 리눅스 3에서만 지원을 합니다.

참고!

  • 안녕에서 기본 제공하는 krisp database에는 국내의 ISP 정보만 있습니다. (해외 ISP 정보는 들어 있지 않습니다. GeoISP를 이용하여 custom database를 만들 수 있습니다.)

  • server-status 또는 server-config handler에서 사용하기 위해서는 mod_status 모듈 보다 mod_krisp 모듈이 먼저 load 되어야 합니다.

$HTTP["url"] == "/kor" {
  $HTTP["country"] != "KR" {
      url.access-deny = ("")
  }
}

$HTTP["isp"] != "boradNnet" {
    url.access-deny = ("")
}

5. User based access control

5.1. mod_auth

이 기능을 사용하기 위해서는 "mod_auth" 모듈이 load 되어야 합니다.

server.modules += ("mod_auth")

5.1.1. password list 생성

google에서 "htpasswd web generator" 로 검색을 하면 web상에서 password list를 만들어 주는 tool들을 쉽게 찾을 수 있습니다.

5.1.2. 인증 설정

$HTTP["url"] == "/req_auth" {
  auth.backend                   = "htpasswd"
  auth.backend.htpasswd.userfile = "/full/path/to/lighttpd-htpasswd.user"
  auth.require                   = (
    "" => (
      "method"  => "basic",
      "realm"   => "Private Area",
      "require" => "user=john|user=smith"
    )
  )
}

5.2. mod_auth_nis

mod_auth_nis 모듈을 이용하여 NIS 인증이 가능 합니다. mod_auth_nis는 PAM을 이용하지 않고 설정된 NIS entry를 이용하기 때문에 local account는 인증할 수 없습니다.

lighttpd nis module을 사용하기 위해서는, NIS 구성시에 shadow.byname MAP을 사용하지 않아야 합니다. 이는 passwd 리스트의 password entry의 값이 'x'로 되어 있으면 안된다는 의미입니다. 보안상 상당히 좋지 않기 때문에 사용을 권장하지 않습니다.

이 기능을 사용하기 위해서는 "mod_auth" 모듈이 load 되어야 합니다.

server.modules += ("mod_auth_nis")
$HTTP["url"] == "/req_auth" {
  auth.backend = "nis"
  nis.domain   = "NISDOMAINNAME"
  nis.usermap  = "passwd.byname"
  nis.require  = (
    "" => (
      "realm"    => "Private Area with NIS",
      "require"  => "valid-user"
      #"require" => "user=john|user=smith"
    )
  )
}

mod_net_access 모듈에 대해서는 를 참고 하십시오.

apache의 htpasswd file을 사용하여 인증을 하는 방법과 유사합니다. 자세한 사항은 를 참고 하십시오.

또는, 문서를 참고 하십시오.

자세한 사항에 대해서는 를 참조 하십시오.

lighty 운영 문서의 Conditional Configuration 섹션
mod_net_access 문서
mod_auth 문서
https://redmine.lighttpd.net/projects/1/wiki/docs_modauth
mod_auth_nis 모듈 문서