File tree Expand file tree Collapse file tree 5 files changed +90
-0
lines changed
Expand file tree Collapse file tree 5 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ # See roles/pulp_auth_proxy/README.md for details.
3+
4+ - name : Deploy Pulp auth proxy
5+ hosts : container-image-builders
6+ gather_facts : false
7+ tasks :
8+ - import_role :
9+ name : pulp_auth_proxy
10+ vars :
11+ pulp_auth_proxy_url : " {{ stackhpc_repo_mirror_url }}"
12+ pulp_auth_proxy_username : " {{ stackhpc_repo_mirror_username }}"
13+ pulp_auth_proxy_password : " {{ stackhpc_repo_mirror_password }}"
14+ pulp_auth_proxy_conf_path : " {{ base_path }}/containers/pulp_proxy"
Original file line number Diff line number Diff line change 1+ # Pulp Auth Proxy
2+
3+ There is currently no practical, secure way to provide credentials for
4+ accessing Ark's authenticated package repositories from within a Kolla build.
5+ Docker provides [ build
6+ secrets] ( https://docs.docker.com/build/building/secrets/ ) , but these must be
7+ explicitly requested for each RUN statement, making them challenging to use in
8+ Kolla.
9+
10+ This role deploys an Nginx container that runs as a reverse proxy, injecting an
11+ HTTP basic authentication header into requests.
12+
13+ Because this proxy bypasses Pulp's authentication, it must not be exposed to
14+ any untrusted environment.
15+
16+ ## Role variables
17+
18+ * ` pulp_auth_proxy_pulp_url ` : URL of the Pulp server to proxy requests to.
19+ * ` pulp_auth_proxy_username ` : Username of the Pulp server to proxy requests to.
20+ * ` pulp_auth_proxy_password ` : Password of the Pulp server to proxy requests to.
21+ * ` pulp_auth_proxy_conf_path ` : Path to a directory in which to write Nginx
22+ configuration.
23+ * ` pulp_auth_proxy_listen_ip ` : IP address on the Docker host on which to
24+ listen. Default is ` 127.0.0.1 ` .
25+ * ` pulp_auth_proxy_listen_port ` : Port on the Docker host on which to listen.
26+ Default is 80.
Original file line number Diff line number Diff line change 1+ ---
2+ pulp_auth_proxy_url :
3+ pulp_auth_proxy_username :
4+ pulp_auth_proxy_password :
5+ pulp_auth_proxy_conf_path :
6+ pulp_auth_proxy_listen_ip : 127.0.0.1
7+ pulp_auth_proxy_listen_port : 80
Original file line number Diff line number Diff line change 1+ ---
2+ - name : " Ensure {{ pulp_auth_proxy_conf_path }} exists"
3+ ansible.builtin.file :
4+ path : " {{ pulp_auth_proxy_conf_path }}"
5+ state : directory
6+ mode : 0700
7+ become : true
8+
9+ - name : Ensure pulp_proxy.conf is templated
10+ ansible.builtin.template :
11+ src : pulp_proxy.conf.j2
12+ dest : " {{ pulp_auth_proxy_conf_path }}/pulp_proxy.conf"
13+ mode : 0600
14+ become : true
15+ register : pulp_proxy_conf
16+
17+ - name : Ensure pulp_proxy container is running
18+ community.docker.docker_container :
19+ name : pulp_proxy
20+ image : nginx:stable-alpine
21+ ports :
22+ - " {{ pulp_auth_proxy_listen_ip }}:{{ pulp_auth_proxy_listen_port }}:80"
23+ restart_policy : " no"
24+ restart : " {{ pulp_proxy_conf is changed }}"
25+ volumes :
26+ - " {{ pulp_auth_proxy_conf_path }}/pulp_proxy.conf:/etc/nginx/conf.d/default.conf:ro"
Original file line number Diff line number Diff line change 1+ server {
2+ listen {{ pulp_auth_proxy_listen_port }};
3+ server_name pulp_proxy;
4+ location / {
5+ proxy_pass {{ pulp_auth_proxy_url }};
6+ proxy_set_header X-Real-IP $remote_addr;
7+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
8+ proxy_set_header X-Forwarded-Proto $scheme;
9+ proxy_set_header Host {{ pulp_auth_proxy_url | urlsplit('hostname') }};
10+ # The important part: add basic auth header
11+ proxy_set_header Authorization "Basic {{ (pulp_auth_proxy_username ~ ':' ~ pulp_auth_proxy_password) | b64encode }}";
12+ proxy_pass_header Authorization;
13+ # See https://stackoverflow.com/questions/25329941/nginx-caching-proxy-fails-with-ssl23-get-server-hellosslv3-alert-handshake-fail/25330027#25330027
14+ proxy_ssl_server_name on;
15+ proxy_ssl_protocols TLSv1.2;
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments