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
4809be21
Commit
4809be21
authored
7 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Allow haproxy_private to be limited to certain domains only
parent
9f0356ee
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
+12
-2
12 additions, 2 deletions
templates/haproxy_cfg.jinja2
templates/privatelist.domain.jinja2
+3
-0
3 additions, 0 deletions
templates/privatelist.domain.jinja2
with
25 additions
and
2 deletions
tasks/configure.yml
+
10
−
0
View file @
4809be21
...
...
@@ -95,6 +95,16 @@
when
:
haproxy_private is defined
notify
:
"
Check
HAProxy
Config"
-
name
:
"
Update
private
domains"
template
:
src='privatelist.domain.jinja2'
dest='/etc/haproxy/privatelist.domain'
owner='root'
group='root'
mode='644'
when
:
haproxy_private is defined and haproxy_private.domain
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
+
12
−
2
View file @
4809be21
...
...
@@ -61,9 +61,14 @@ frontend http_in
bind *:80
http-request del-header Proxy
{% if haproxy_private is defined %}
{% if haproxy_private.domain is defined %}
acl privatedomain hdr(host) -i -n -f /etc/haproxy/privatelist.domain
{% else %}
acl privatedomain if true
{% endif %}
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
http-request auth realm notprivate if
privatedomain
!privateip !private_auth
{% endif %}
acl blockedip src -f /etc/haproxy/blacklist.ip
http-request deny if blockedip
...
...
@@ -183,9 +188,14 @@ 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 %}
{% if haproxy_private.domain is defined %}
acl privatedomain hdr(host) -i -n -f /etc/haproxy/privatelist.domain
{% else %}
acl privatedomain if true
{% endif %}
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
http-request auth realm notprivate if
privatedomain
!privateip !private_auth
{% endif %}
acl blockedip src -f /etc/haproxy/blacklist.ip
http-request deny if blockedip
...
...
This diff is collapsed.
Click to expand it.
templates/privatelist.domain.jinja2
0 → 100644
+
3
−
0
View file @
4809be21
{% for domain in haproxy_private.domain %}
{{ domain }}
{% 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