summaryrefslogtreecommitdiffstats
path: root/roles/git
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-12-20 14:13:08 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-12-20 14:13:13 +0100
commitda2572ddb144086034eba1989ae909763e95c680 (patch)
treed3374338793592412ca1b10fb4fc20068a392c4e /roles/git
parent01e59771866559cc13a58800282617d04cb286a6 (diff)
Use the Let's Encrypt CA for our public certs.
Diffstat (limited to 'roles/git')
-rw-r--r--roles/git/files/etc/nginx/sites-available/git37
-rw-r--r--roles/git/tasks/cgit.yml20
2 files changed, 7 insertions, 50 deletions
diff --git a/roles/git/files/etc/nginx/sites-available/git b/roles/git/files/etc/nginx/sites-available/git
index 67776de..afb5fca 100644
--- a/roles/git/files/etc/nginx/sites-available/git
+++ b/roles/git/files/etc/nginx/sites-available/git
@@ -4,42 +4,13 @@ server {
server_name git.fripost.org;
+ include snippets/acme-challenge.conf;
+
access_log /var/log/nginx/git.access.log;
error_log /var/log/nginx/git.error.log info;
- location ^~ /static/ {
- alias /usr/share/cgit/;
- expires 30d;
- }
-
- # Bypass the CGI to return static files stored on disk. Try first repo with
- # a trailing '.git', then without.
- location ~* "^/((?U)[^/]+)(?:\.git)?/objects/(?:[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(?:pack|idx))$" {
- root /var/lib/gitolite/repositories;
- try_files /$1.git/objects/$2 /$1/objects/$2 =404;
- expires 30d;
- gzip off;
- # TODO honor git-daemon-export-ok
- }
-
- # disallow push over HTTP/HTTPS
- location ~* "^/[^/]+/git-receive-pack$" { return 403; }
-
- location ~* "^/[^/]+/(?:HEAD|info/refs|objects/info/[^/]+|git-upload-pack)$" {
- gzip off;
- include uwsgi_params;
- uwsgi_modifier1 9;
- uwsgi_param GIT_PROJECT_ROOT /var/lib/gitolite/repositories;
- uwsgi_pass unix:/run/uwsgi/app/git-http-backend/socket;
- }
-
-
- # send all other URLs to cgit
location / {
- gzip off;
- include uwsgi_params;
- uwsgi_modifier1 9;
- uwsgi_pass unix:/run/uwsgi/app/cgit/socket;
+ return 301 https://$host$request_uri;
}
}
@@ -51,7 +22,7 @@ server {
server_name git.fripost.org;
include snippets/ssl.conf;
- ssl_certificate /etc/nginx/ssl/git.fripost.org.pem;
+ ssl_certificate /etc/nginx/ssl/git.fripost.org.chained.pem;
ssl_certificate_key /etc/nginx/ssl/git.fripost.org.key;
access_log /var/log/nginx/git.access.log;
diff --git a/roles/git/tasks/cgit.yml b/roles/git/tasks/cgit.yml
index 27e0554..7237aa9 100644
--- a/roles/git/tasks/cgit.yml
+++ b/roles/git/tasks/cgit.yml
@@ -72,26 +72,12 @@
- www-data
-- name: Generate a private key and a X.509 certificate for Nginx
- command: genkeypair.sh x509
- --pubkey=/etc/nginx/ssl/git.fripost.org.pem
- --privkey=/etc/nginx/ssl/git.fripost.org.key
- --ou=WWW --cn=git.fripost.org --dns=git.fripost.org
- -t rsa -b 4096 -h sha512
- register: r1
- changed_when: r1.rc == 0
- failed_when: r1.rc > 1
- notify:
- - Restart Nginx
- tags:
- - genkey
-
- name: Copy /etc/nginx/sites-available/git
copy: src=etc/nginx/sites-available/git
dest=/etc/nginx/sites-available/git
owner=root group=root
mode=0644
- register: r2
+ register: r1
notify:
- Restart Nginx
@@ -100,13 +86,13 @@
dest=/etc/nginx/sites-enabled/git
owner=root group=root
state=link force=yes
- register: r3
+ register: r2
notify:
- Restart Nginx
- name: Start Nginx
service: name=nginx state=started
- when: not (r1.changed or r2.changed or r3.changed)
+ when: not (r1.changed or r2.changed)
- meta: flush_handlers