Skip to content

Commit cb9cda8

Browse files
committed
If letsencrypt tar archive is present use it.
Adapt for certbot 0.21. modified: scripts/setup.letsencrypt.sh
1 parent 21367f9 commit cb9cda8

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

scripts/setup.letsencrypt.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ setup_letsencrypt () {
4747
apt-add-repository -y ppa:certbot/certbot
4848

4949
apt-get update
50-
apt-get install certbot python-certbot-apache python-certbot-doc python-acme-doc python-cryptography-vectors python-certbot-apache-doc python-openssl-doc -y
50+
apt-get install certbot python-certbot-apache -y
5151
apt-get dist-upgrade -y
5252
apt-get autoremove --purge -y
5353
;;
@@ -64,16 +64,29 @@ setup_letsencrypt () {
6464
mkdir -p ~/Dokumentation/letsencrypt/
6565
echo "letsencrypt --authenticator webroot --webroot-path /var/www/html --installer apache --non-interactive --agree-tos --hsts --uir --email ${MY_EMAIL} --rsa-key-size ${MY_KEY_SIZE} -d ${MY_FQDN}" >~/Dokumentation/letsencrypt/${MY_FQDN}.txt
6666

67+
if [ "${LETSENCRYPT_CONFIG_ARCHIVE}" == "1" ] ; then
68+
tar -C /etc -xvf ${ARCHIVES_DIR}/letsencrypt.tar
69+
sed --in-place "s/^Header edit Set-Cookie/# Header edit Set-Cookie/" /etc/letsencrypt/options-ssl-apache.conf
70+
fi
71+
6772
letsencrypt --authenticator webroot --webroot-path /var/www/html --installer apache --non-interactive --agree-tos --hsts --uir --email ${MY_EMAIL} --rsa-key-size ${MY_KEY_SIZE} -d ${MY_FQDN}
6873

69-
patch /etc/letsencrypt/options-ssl-apache.conf ${PATCH_DIR}/etc.letsencrypt.options-ssl-apache.conf.patch
74+
if [ "${LETSENCRYPT_CONFIG_ARCHIVE}" == "1" ] ; then
75+
sed --in-place "s/^# Header edit Set-Cookie/Header edit Set-Cookie/" /etc/letsencrypt/options-ssl-apache.conf
76+
else
77+
patch /etc/letsencrypt/options-ssl-apache.conf ${PATCH_DIR}/etc.letsencrypt.options-ssl-apache.conf.patch
78+
fi
79+
7080
case ${DIST_ID} in
7181
Debian)
72-
sed --in-place "s/SSLOpenSSLConfCmd ECDHParameters/# SSLOpenSSLConfCmd ECDHParameters/" /etc/letsencrypt/options-ssl-apache.conf
73-
sed --in-place "s/SSLOpenSSLConfCmd Curves/# SSLOpenSSLConfCmd Curves/" /etc/letsencrypt/options-ssl-apache.conf
74-
sed --in-place "s/SSLSessionTickets/# SSLSessionTickets/" /etc/letsencrypt/options-ssl-apache.conf
82+
sed --in-place "s/^SSLOpenSSLConfCmd ECDHParameters/# SSLOpenSSLConfCmd ECDHParameters/" /etc/letsencrypt/options-ssl-apache.conf
83+
sed --in-place "s/^SSLOpenSSLConfCmd Curves/# SSLOpenSSLConfCmd Curves/" /etc/letsencrypt/options-ssl-apache.conf
84+
sed --in-place "s/^SSLSessionTickets/# SSLSessionTickets/" /etc/letsencrypt/options-ssl-apache.conf
7585
;;
7686
*)
87+
sed --in-place "s/# SSLOpenSSLConfCmd ECDHParameters/SSLOpenSSLConfCmd ECDHParameters/" /etc/letsencrypt/options-ssl-apache.conf
88+
sed --in-place "s/# SSLOpenSSLConfCmd Curves/SSLOpenSSLConfCmd Curves/" /etc/letsencrypt/options-ssl-apache.conf
89+
sed --in-place "s/# SSLSessionTickets/SSLSessionTickets/" /etc/letsencrypt/options-ssl-apache.conf
7790
;;
7891
esac
7992

@@ -102,6 +115,10 @@ setup_letsencrypt () {
102115
echo "# path to the public_html / webroot folder being served by your web server." >>/etc/letsencrypt/cli.ini
103116
echo "# authenticator = webroot" >>/etc/letsencrypt/cli.ini
104117
echo "# webroot-path = /usr/share/nginx/html" >>/etc/letsencrypt/cli.ini
118+
echo "" >>/etc/letsencrypt/cli.ini
119+
echo "# Because we are using logrotate for greater flexibility, disable the" >>/etc/letsencrypt/cli.ini
120+
echo "# internal certbot logrotation." >>/etc/letsencrypt/cli.ini
121+
echo "max-log-backups = 0" >>/etc/letsencrypt/cli.ini
105122

106123
patch /etc/apache2/conf-available/security.conf ${PATCH_DIR}/etc.apache2.conf-available.security.conf.patch
107124
patch /etc/apache2/conf-available/apache2-doc.conf ${PATCH_DIR}/etc.apache2.conf-available.apache2-doc.conf.patch

0 commit comments

Comments
 (0)