Skip to content

Commit

Permalink
Merge pull request #59 from magenbrot/haproxy-stats-acls
Browse files Browse the repository at this point in the history
allow ACLs in stats
  • Loading branch information
goldyfruit authored Jun 9, 2022
2 parents d7c387f + 5c74660 commit 9487e70
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,15 @@ haproxy_default_monitor_uri:

# Userlist
haproxy_userlist:

# Stats
- stats-auth:
groups:
- "admin users admin"
- "readonly users user"
users:
- "admin insecure-password opqrstuvw"
- "user insecure-password abcdefghi"

# Stats with HTTP Basic Auth and a single user
haproxy_stats: true
haproxy_stats_address: '*'
haproxy_stats_port: 9001
Expand All @@ -145,6 +152,23 @@ haproxy_stats_timeouts:
- connect 100s
- queue 100s

# Stats with HTTP Basic Auth using an userlist
haproxy_stats: true
haproxy_stats_address: "::"
haproxy_stats_port: 8081
haproxy_stats_ssl: false
haproxy_stats_uri: /stats
haproxy_stats_auth:
haproxy_stats_acls:
- "AUTH http_auth(stats-auth)"
- "AUTH_ADMIN http_auth_group(stats-auth) admin"
haproxy_stats_options:
- refresh 5s
- show-legends
- show-node
- http-request auth unless AUTH
- admin if AUTH_ADMIN

# SSL
haproxy_ssl_certificate: /etc/ssl/uoi.io/uoi.io.pem
haproxy_ssl_options: no-sslv3 no-tls-tickets force-tlsv12
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ haproxy_stats_address: '*'
haproxy_stats_port: 9001
haproxy_stats_ssl: false
haproxy_stats_auth: true
haproxy_stats_acls: []
haproxy_stats_user: haproxy-stats
haproxy_stats_password: B1Gp4sSw0rD!!
haproxy_stats_uri: /
Expand Down
5 changes: 5 additions & 0 deletions templates/etc/haproxy/haproxy-stats.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ listen stats
{% endif %}
mode http
maxconn 10
{% if haproxy_stats_acls is defined and haproxy_stats_acls|length %}
{% for acl in haproxy_stats_acls %}
acl {{ acl }}
{% endfor %}
{% endif %}
stats enable
{% for opt in haproxy_stats_options %}
stats {{ opt }}
Expand Down

0 comments on commit 9487e70

Please sign in to comment.