ask email for letsencrypt

This commit is contained in:
Praveen Arimbrathodiyil 2017-04-26 20:23:50 +05:30
parent 8152bb431f
commit fe9de28786
3 changed files with 27 additions and 4 deletions

10
debian/config vendored
View file

@ -18,6 +18,9 @@ set -e
db_set gitlab/user "$gitlab_user" db_set gitlab/user "$gitlab_user"
db_set gitlab/ssl "${GITLAB_HTTPS:-false}" db_set gitlab/ssl "${GITLAB_HTTPS:-false}"
db_set gitlab/letsencrypt "${gitlab_letsencrypt:-false}" db_set gitlab/letsencrypt "${gitlab_letsencrypt:-false}"
if [ -n "$gitlab_letsencrypt_email" ]; then
db_set gitlab/letsencrypt_email "${gitlab_letsencrypt_email}"
fi
fi fi
# What is your fqdn? # What is your fqdn?
@ -36,6 +39,13 @@ if command -v letsencrypt >/dev/null; then
then then
db_input high gitlab/letsencrypt || true db_input high gitlab/letsencrypt || true
db_go db_go
db_get gitlab/letsencrypt
gitlab_letsencrypt_email=$RET
if [ "$gitlab_letsencrypt" = "true" ]; then
# Get email for letsencrypt updates
gitlab_letsencrypt_email=$RET
db_input high gitlab/letsencrypt_email || true
fi
fi fi
fi fi

View file

@ -56,7 +56,13 @@ _Description: Use Let's Encrypt?
. .
Note: letsencrypt does not have a usable nginx plugin currently, so Note: letsencrypt does not have a usable nginx plugin currently, so
certificates must be renewed manually after 3 months, when current certificates must be renewed manually after 3 months, when current
letsencrypt certificate expire. letsencrypt certificate expire. If you choose yes here, you will also be
agreeing to letsencrypt terms of service.
Template: gitlab/letsencrypt_email
Type: string
_Description: Email address for letsencrypt updates:
Please provide a valid email address for letsencrypt updates.
Template: gitlab/purge_data Template: gitlab/purge_data
Type: boolean Type: boolean

13
debian/postinst vendored
View file

@ -150,6 +150,8 @@ case "$1" in
gl_proto="http" gl_proto="http"
db_get gitlab/letsencrypt db_get gitlab/letsencrypt
gitlab_letsencrypt=$RET gitlab_letsencrypt=$RET
db_get gitlab/letsencrypt_email
gitlab_letsencrypt_email=$RET
cp -a -f ${gitlab_debian_conf_private} ${gitlab_debian_conf_private}.tmp cp -a -f ${gitlab_debian_conf_private} ${gitlab_debian_conf_private}.tmp
@ -169,6 +171,8 @@ case "$1" in
echo "GITLAB_HTTPS=" >> ${gitlab_debian_conf_private} echo "GITLAB_HTTPS=" >> ${gitlab_debian_conf_private}
test -z "$gitlab_letsencrypt" || grep -Eq '^ *gitlab_letsencrypt=' ${gitlab_debian_conf_private} || \ test -z "$gitlab_letsencrypt" || grep -Eq '^ *gitlab_letsencrypt=' ${gitlab_debian_conf_private} || \
echo "gitlab_letsencrypt=" >> ${gitlab_debian_conf_private} echo "gitlab_letsencrypt=" >> ${gitlab_debian_conf_private}
test -z "$gitlab_letsencrypt_email" || grep -Eq '^ *gitlab_letsencrypt_email=' ${gitlab_debian_conf_private} || \
echo "gitlab_letsencrypt_email=" >> ${gitlab_debian_conf_private}
sed -e "s/^ *GITLAB_HOST=.*/GITLAB_HOST=\"$GITLAB_HOST\"/" \ sed -e "s/^ *GITLAB_HOST=.*/GITLAB_HOST=\"$GITLAB_HOST\"/" \
-e "s/^ *GITLAB_EMAIL_FROM=.*/GITLAB_EMAIL_FROM=\"$GITLAB_EMAIL_FROM\"/" \ -e "s/^ *GITLAB_EMAIL_FROM=.*/GITLAB_EMAIL_FROM=\"$GITLAB_EMAIL_FROM\"/" \
-e "s/^ *GITLAB_EMAIL_DISPLAY_NAME=.*/GITLAB_EMAIL_DISPLAY_NAME=\"$GITLAB_EMAIL_DISPLAY_NAME\"/" \ -e "s/^ *GITLAB_EMAIL_DISPLAY_NAME=.*/GITLAB_EMAIL_DISPLAY_NAME=\"$GITLAB_EMAIL_DISPLAY_NAME\"/" \
@ -176,6 +180,7 @@ case "$1" in
-e "s/^ *gitlab_user=.*/gitlab_user=\"$gitlab_user\"/" \ -e "s/^ *gitlab_user=.*/gitlab_user=\"$gitlab_user\"/" \
-e "s/^ *GITLAB_HTTPS=.*/GITLAB_HTTPS=\"$GITLAB_HTTPS\"/" \ -e "s/^ *GITLAB_HTTPS=.*/GITLAB_HTTPS=\"$GITLAB_HTTPS\"/" \
-e "s/^ *gitlab_letsencrypt=.*/gitlab_letsencrypt=\"$gitlab_letsencrypt\"/" \ -e "s/^ *gitlab_letsencrypt=.*/gitlab_letsencrypt=\"$gitlab_letsencrypt\"/" \
-e "s/^ *gitlab_letsencrypt_email=.*/gitlab_letsencrypt_email=\"$gitlab_letsencrypt_email\"/" \
< ${gitlab_debian_conf_private} > ${gitlab_debian_conf_private}.tmp < ${gitlab_debian_conf_private} > ${gitlab_debian_conf_private}.tmp
mv -f ${gitlab_debian_conf_private}.tmp ${gitlab_debian_conf_private} mv -f ${gitlab_debian_conf_private}.tmp ${gitlab_debian_conf_private}
@ -222,11 +227,13 @@ case "$1" in
echo "Stopping nginx for letsencrypt..." echo "Stopping nginx for letsencrypt..."
invoke-rc.d nginx stop invoke-rc.d nginx stop
fi fi
db_get gitlab/letsencrypt_email
letsencrypt --standalone -d ${GITLAB_HOST} certonly || { gitlab_letsencrypt_email=$RET
LETSENCRYPT_CMD="letsencrypt --standalone --agree-tos -m $gitlab_letsencrypt_email -d ${GITLAB_HOST} certonly"
$LETSENCRYPT_CMD || {
echo "letsencrypt auto configuration failed..." echo "letsencrypt auto configuration failed..."
echo "Stop your webserver and try running letsencrypt manually..." echo "Stop your webserver and try running letsencrypt manually..."
echo "letsencrypt -d ${GITLAB_HOST} certonly" echo "$LETSENCRYPT_CMD"
} }
fi fi
fi fi