]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible: nginx configs for HTTPS 142/head
authorKen Dreyer <kdreyer@redhat.com>
Wed, 21 Oct 2015 01:34:32 +0000 (19:34 -0600)
committerKen Dreyer <kdreyer@redhat.com>
Thu, 22 Oct 2015 16:53:32 +0000 (10:53 -0600)
Add HTTPS to the jenkins web server to protect authentication.

The key and certificate files are managed outside of Ansible.

ansible/roles/ansible-jenkins/templates/jenkins.conf

index 5f498e525f0138bd627f1cc8698f711d584d6f2c..b60b07ade3cfc6dfa8a24649b7e957019235f622 100644 (file)
@@ -2,9 +2,14 @@
 
 server {
     listen       80 default_server;
+    listen       443 default_server ssl;
 
     server_name  localhost {{ ansible_fqdn }};
 
+    ssl_certificate     /etc/ssl/certs/{{ ansible_fqdn }}-bundled.crt;
+    ssl_certificate_key /etc/ssl/private/{{ ansible_fqdn }}.key;
+    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+
     access_log  /var/log/nginx/jenkins_access.log;
     error_log  /var/log/nginx/jenkins_error.log;
 
@@ -17,5 +22,9 @@ server {
       proxy_pass          http://127.0.0.1:8080;
       proxy_read_timeout  90;
 
+      # Redirect all plaintext HTTP to HTTPS
+      if ($scheme != "https") {
+         rewrite ^ https://$host$uri permanent;
+      }
     }
 }