[tbb-commits] [tor-browser-build/master] Bug 33864: Add auth_basic to nightly build web server

gk at torproject.org gk at torproject.org
Mon Jun 1 06:49:15 UTC 2020


commit efe93411c75b8f2c0ba80164b9af7ab914614b9f
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Thu Apr 9 21:26:56 2020 +0200

    Bug 33864: Add auth_basic to nightly build web server
---
 tools/ansible/roles/tbb-nightly-build/defaults/main.yml           | 2 ++
 tools/ansible/roles/tbb-nightly-build/tasks/main.yml              | 8 ++++++++
 tools/ansible/roles/tbb-nightly-build/templates/nginx.conf        | 4 ++++
 .../templates/tbb-nightly-build.auth_basic_user_file              | 1 +
 4 files changed, 15 insertions(+)

diff --git a/tools/ansible/roles/tbb-nightly-build/defaults/main.yml b/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
index 0a9e94a..55154d3 100644
--- a/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
+++ b/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
@@ -9,3 +9,5 @@ testsuite_git_commit: ea0942f9da2bdbaf3f140f3baaed1bb56ee9af69
 nightly_build_wwwdir: "/home/{{ nightly_build_user }}/www"
 nightly_build_nginx_enable: true
 nightly_build_nginx_listen: 127.0.0.1:80
+nightly_build_nginx_auth_basic_enable: true
+nightly_build_nginx_auth_basic_content: tor-guest:ezmjAG/jVTat.
diff --git a/tools/ansible/roles/tbb-nightly-build/tasks/main.yml b/tools/ansible/roles/tbb-nightly-build/tasks/main.yml
index 2c795b8..d5254b6 100644
--- a/tools/ansible/roles/tbb-nightly-build/tasks/main.yml
+++ b/tools/ansible/roles/tbb-nightly-build/tasks/main.yml
@@ -75,6 +75,14 @@
       mode: 0644
       owner: "{{ nightly_build_user }}"
 
+- name: create tbb-nightly-build.auth_basic_user_file
+  template:
+        src: tbb-nightly-build.auth_basic_user_file
+        dest: /etc/nginx/tbb-nightly-build.auth_basic_user_file
+        mode: 0644
+        owner: root
+  when: nightly_build_nginx_auth_basic_enable
+
 - name: install nginx
   apt:
       name: nginx
diff --git a/tools/ansible/roles/tbb-nightly-build/templates/nginx.conf b/tools/ansible/roles/tbb-nightly-build/templates/nginx.conf
index 9d44bec..62ca8e3 100644
--- a/tools/ansible/roles/tbb-nightly-build/templates/nginx.conf
+++ b/tools/ansible/roles/tbb-nightly-build/templates/nginx.conf
@@ -12,5 +12,9 @@ server {
     location /tor-browser-builds {
         alias {{ testsuite_dir }}/tor-browser-builds;
         autoindex on;
+        {% if nightly_build_nginx_auth_basic_enable %}
+        auth_basic "Use tor-guest as username and password";
+        auth_basic_user_file /etc/nginx/tbb-nightly-build.auth_basic_user_file;
+        {% endif %}
     }
 }
diff --git a/tools/ansible/roles/tbb-nightly-build/templates/tbb-nightly-build.auth_basic_user_file b/tools/ansible/roles/tbb-nightly-build/templates/tbb-nightly-build.auth_basic_user_file
new file mode 100644
index 0000000..45d673c
--- /dev/null
+++ b/tools/ansible/roles/tbb-nightly-build/templates/tbb-nightly-build.auth_basic_user_file
@@ -0,0 +1 @@
+{{ nightly_build_nginx_auth_basic_content }}





More information about the tbb-commits mailing list