check if letsencrypt cert is already present

This commit is contained in:
Praveen Arimbrathodiyil 2016-04-04 23:12:52 +05:30
parent 6206489e19
commit 404502f470
2 changed files with 13 additions and 7 deletions

1
debian/changelog vendored
View file

@ -6,6 +6,7 @@ gitlab (8.5.8+dfsg-3) UNRELEASED; urgency=medium
* Use embedded copy of fuzzaldrin-plus (See #814871 for more details)
* Bring back db check in postinst (initialize the db only if it is empty)
* Choose unicode for db encoding (fixes wiki creation error)
* Don't run letsencrypt if certificate is already present
-- Pirate Praveen <praveen@debian.org> Sun, 03 Apr 2016 17:41:28 +0530

19
debian/postinst vendored
View file

@ -97,13 +97,18 @@ case "$1" in
# Check if letsencrypt option is selected
db_get gitlab/letsencrypt
if [ "${RET}" = "true" ]; then
ln -sf /etc/letsencrypt/live/${GITLAB_HOST}/fullchain.pem \
/etc/gitlab/ssl/gitlab.crt
ln -sf /etc/letsencrypt/live/${GITLAB_HOST}/privkey.pem \
/etc/gitlab/ssl/gitlab.key
# Port 80 and 443 should be available for letsencrypt
invoke-rc.d nginx stop
letsencrypt -d ${GITLAB_HOST} certonly
# Check if certificate is already present
if [ -e /etc/letsencrypt/live/${GITLAB_HOST}/fullchain.pem ]; then
echo "Let's encrypt certificate already present."
else
ln -sf /etc/letsencrypt/live/${GITLAB_HOST}/fullchain.pem \
/etc/gitlab/ssl/gitlab.crt
ln -sf /etc/letsencrypt/live/${GITLAB_HOST}/privkey.pem \
/etc/gitlab/ssl/gitlab.key
# Port 80 and 443 should be available for letsencrypt
invoke-rc.d nginx stop
letsencrypt -d ${GITLAB_HOST} certonly
fi
fi
fi