본문 바로가기

리눅스

[리눅스] HAProxy 패스워드 설정

728x90

HAProxy 패스워드 설정

haproxy.cfg 편집

$ vim /etc/haproxy/haproxy.cfg
...
#---------------------------------------------------------------------
userlist basic-auth
  #user elastic password ZWxhc3RpYzplbGFzdGlj
  user elastic insecure-password elastic
  user guest insecure-password guest


#---------------------------------------------------------------------
frontend www-lb
    bind *:80
    mode http
    http-request set-header X-Forwarded-Proto http
    log global
    option httplog
    #option dontlog-normal
    #option dontlognull
    acl acl_elasticsearc path_beg -i /es
    use_backend elasticsearch9200 if acl_elasticsearc
    default_backend kibana5601


#---------------------------------------------------------------------
backend kibana5601
    acl acl_kibana5601 http_auth(basic-auth)
    http-request auth if !acl_kibana5601
    mode http
    balance roundrobin
    cookie SERVERID insert indirect nocache
    option httpchk GET /
    http-check expect status 302
    #option httpchk GET "/app/kibana#?_g=()"
    #http-check expect string "Kibana"
    #default-server inter 10s downinter 5s rise 2 fall 2 slowstart 60s maxconn 250 maxqueue 256 weight 100
    #server datanode01 192.168.0.101:5601 check inter 3000 rise 2 fall 5
    server datanode01 192.168.0.101:5601 check cookie s1
    server datanode03 192.168.0.102:5601 check cookie s2
...

사용자 및 패스워드 지정

userlist basic-auth
#user elastic password ZWxhc3RpYzplbGFzdGlj
user elastic insecure-password elastic
user guest insecure-password guest

백엔드 접근 제어

acl acl_kibana5601 http_auth(basic-auth)
http-request auth if !acl_kibana5601

웹 페이지 접근 시 팝업

728x90