Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
haproxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Zillmann
haproxy
Commits
c0e9ed1a
Commit
c0e9ed1a
authored
7 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
New option to require http auth for all requests if not from a private IP
parent
c1d2fe94
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tasks/configure.yml
+10
-0
10 additions, 0 deletions
tasks/configure.yml
templates/haproxy_cfg.jinja2
+17
-0
17 additions, 0 deletions
templates/haproxy_cfg.jinja2
templates/privatelist.ip.jinja2
+3
-0
3 additions, 0 deletions
templates/privatelist.ip.jinja2
with
30 additions
and
0 deletions
tasks/configure.yml
+
10
−
0
View file @
c0e9ed1a
...
...
@@ -85,6 +85,16 @@
-
'
blacklist.agent'
notify
:
"
Check
HAProxy
Config"
-
name
:
"
Update
private
ips"
template
:
src='privatelist.ip.jinja2'
dest='/etc/haproxy/privatelist.ip'
owner='root'
group='root'
mode='644'
when
:
haproxy_private is defined
notify
:
"
Check
HAProxy
Config"
-
name
:
"
Create
config
file"
template
:
src='haproxy_cfg.jinja2'
...
...
This diff is collapsed.
Click to expand it.
templates/haproxy_cfg.jinja2
+
17
−
0
View file @
c0e9ed1a
...
...
@@ -49,10 +49,22 @@ userlist kibana
user {{ user.username }} insecure-password '{{ user.password }}'
{% endfor %}
{% endif %}
{% if haproxy_private is defined %}
userlist notprivate
{% for user in haproxy_private.auth %}
user {{ user.username }} insecure-password '{{ user.password }}'
{% endfor %}
{% endif %}
frontend http_in
bind *:80
http-request del-header Proxy
{% if haproxy_private is defined %}
acl privateip src -f /etc/haproxy/privatelist.ip
acl private_auth http_auth(notprivate) if !privateip
http-request auth realm notprivate if !privateip !private_auth
{% endif %}
acl blockedip src -f /etc/haproxy/blacklist.ip
http-request deny if blockedip
acl blockedreferer hdr_sub(referer) -i -f /etc/haproxy/blacklist.referer
...
...
@@ -170,6 +182,11 @@ frontend http_in
frontend https_in_{{ cert.ip }}
bind {{ cert.ip }}:443 ssl crt /etc/haproxy/certs/{{ cert.file }} no-sslv3
http-request del-header Proxy
{% if haproxy_private is defined %}
acl privateip src -f /etc/haproxy/privatelist.ip
acl private_auth http_auth(notprivate) if !privateip
http-request auth realm notprivate if !privateip !private_auth
{% endif %}
acl blockedip src -f /etc/haproxy/blacklist.ip
http-request deny if blockedip
acl blockedreferer hdr_sub(referer) -i -f /etc/haproxy/blacklist.referer
...
...
This diff is collapsed.
Click to expand it.
templates/privatelist.ip.jinja2
0 → 100644
+
3
−
0
View file @
c0e9ed1a
{% for ip in haproxy_private.ip %}
{{ ip }}
{% endfor %}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment