-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #938 from stackhpc/zed-yoga-merge
zed: yoga merge
- Loading branch information
Showing
17 changed files
with
178 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
# See roles/pulp_auth_proxy/README.md for details. | ||
|
||
- name: Deploy Pulp auth proxy | ||
hosts: container-image-builders | ||
gather_facts: false | ||
tasks: | ||
- import_role: | ||
name: pulp_auth_proxy | ||
vars: | ||
pulp_auth_proxy_url: "{{ stackhpc_repo_mirror_url }}" | ||
pulp_auth_proxy_username: "{{ stackhpc_repo_mirror_username }}" | ||
pulp_auth_proxy_password: "{{ stackhpc_repo_mirror_password }}" | ||
pulp_auth_proxy_conf_path: "{{ base_path }}/containers/pulp_proxy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Pulp Auth Proxy | ||
|
||
There is currently no practical, secure way to provide credentials for | ||
accessing Ark's authenticated package repositories from within a Kolla build. | ||
Docker provides [build | ||
secrets](https://docs.docker.com/build/building/secrets/), but these must be | ||
explicitly requested for each RUN statement, making them challenging to use in | ||
Kolla. | ||
|
||
This role deploys an Nginx container that runs as a reverse proxy, injecting an | ||
HTTP basic authentication header into requests. | ||
|
||
Because this proxy bypasses Pulp's authentication, it must not be exposed to | ||
any untrusted environment. | ||
|
||
## Role variables | ||
|
||
* `pulp_auth_proxy_pulp_url`: URL of the Pulp server to proxy requests to. | ||
* `pulp_auth_proxy_username`: Username of the Pulp server to proxy requests to. | ||
* `pulp_auth_proxy_password`: Password of the Pulp server to proxy requests to. | ||
* `pulp_auth_proxy_conf_path`: Path to a directory in which to write Nginx | ||
configuration. | ||
* `pulp_auth_proxy_listen_ip`: IP address on the Docker host on which to | ||
listen. Default is `127.0.0.1`. | ||
* `pulp_auth_proxy_listen_port`: Port on the Docker host on which to listen. | ||
Default is 80. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
pulp_auth_proxy_url: | ||
pulp_auth_proxy_username: | ||
pulp_auth_proxy_password: | ||
pulp_auth_proxy_conf_path: | ||
pulp_auth_proxy_listen_ip: 127.0.0.1 | ||
pulp_auth_proxy_listen_port: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: "Ensure {{ pulp_auth_proxy_conf_path }} exists" | ||
ansible.builtin.file: | ||
path: "{{ pulp_auth_proxy_conf_path }}" | ||
state: directory | ||
mode: 0700 | ||
become: true | ||
|
||
- name: Ensure pulp_proxy.conf is templated | ||
ansible.builtin.template: | ||
src: pulp_proxy.conf.j2 | ||
dest: "{{ pulp_auth_proxy_conf_path }}/pulp_proxy.conf" | ||
mode: 0600 | ||
become: true | ||
register: pulp_proxy_conf | ||
|
||
- name: Ensure pulp_proxy container is running | ||
community.docker.docker_container: | ||
name: pulp_proxy | ||
image: nginx:stable-alpine | ||
ports: | ||
- "{{ pulp_auth_proxy_listen_ip }}:{{ pulp_auth_proxy_listen_port }}:80" | ||
restart_policy: "no" | ||
restart: "{{ pulp_proxy_conf is changed }}" | ||
volumes: | ||
- "{{ pulp_auth_proxy_conf_path }}/pulp_proxy.conf:/etc/nginx/conf.d/default.conf:ro" |
17 changes: 17 additions & 0 deletions
17
etc/kayobe/ansible/roles/pulp_auth_proxy/templates/pulp_proxy.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
server { | ||
listen {{ pulp_auth_proxy_listen_port }}; | ||
server_name pulp_proxy; | ||
location / { | ||
proxy_pass {{ pulp_auth_proxy_url }}; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header Host {{ pulp_auth_proxy_url | urlsplit('hostname') }}; | ||
# The important part: add basic auth header | ||
proxy_set_header Authorization "Basic {{ (pulp_auth_proxy_username ~ ':' ~ pulp_auth_proxy_password) | b64encode }}"; | ||
proxy_pass_header Authorization; | ||
# See https://stackoverflow.com/questions/25329941/nginx-caching-proxy-fails-with-ssl23-get-server-hellosslv3-alert-handshake-fail/25330027#25330027 | ||
proxy_ssl_server_name on; | ||
proxy_ssl_protocols TLSv1.2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
features: | ||
- | | ||
Adds a custom playbook (``pulp-auth-proxy.yml``) for deploying an | ||
authenticating proxy for Pulp. This can be used when building container | ||
images to avoid leaking credentials for package repositories into the built | ||
images or their metadata. |