Letsentcrypt

From Blue-IT.org Wiki

Revision as of 11:39, 3 February 2016 by Apos (talk | contribs) (Valid certs for your webserver)

Valid certs for your webserver

HowTos

* https://www.digitalocean.com/communin-ubuntu-14-04 [EN]
* https://thomas-leister.de/internet/aate-fuer-alle/ [GER]

Chaos Commuication Congress HH 12/2015 (englisch) Vortrag zum Thema letsencrypt:

* https://events.ccc.de/congress/2015/ents/7528.html [EN]

!!! NEVER EVER !!! DELETE THIS DIRECTORY AFTER AN INITIAL RUN:

DONT DO !!! #>  rm -rf /etc/letsencrypt

You'll have to wait a full week to repeat the registration process!

Wrapper script

A simple wrapper script (mainly for the domains reneval):

#!/bin/bash

# Analyse the status
# https://www.ssllabs.com/ssltest/analyze.html?d=blue-it.org

# DON'T CHANGE (needs reconfiguring configuration of virtual servers
BASE_DOMAIN="-d blue-it.org "
CIPHER_STRENGTH=" --rsa-key-size 4096 "
DOMAIN_LIST="-d domaion \
-d other.domain -d www.other.domain"

#####################################
LETSENCRYPT_DIR="/opt/letsencrypt"
#LETSENCRYPT_BIN="/root/.local/share/letsencrypt/bin"
[ -d ${LETSENCRYPT_DIR} ] && cd ${LETSENCRYPT_DIR}
pwd


if [ "${1}" == "--reinstall" ]
then

read -p "Sind sie sicher, das die letsencrypt neu installieren wollen? (y/n) " -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
    	echo "OK, Vorgang abgebrochen."
	exit 1
fi

#####################################
#COMPLETE REINSTALL

mkdir "/opt/$(date +%F)/"
mv "${LETSENCRYPT_DIR}" "/opt/$(date +%F)"
#rm -rf "${LETSENCRYPT_DIR}"

#rm -rf /root/.local/share/letsencrypt
# !!! NEVER EVER !!! DELETE THIS DIRECTORY AFTER AN INITIAL RUN !!!
#rm -rf /etc/letsencrypt


	#mkdir -p "${LETSENCRYPT_DIR}"
	#git clone https://github.com/letsencrypt/letsencrypt "${LETSENCRYPT_DIR}"

	echo "Now run the script without a parameter to invoke letsencrypt and install your certs."

elif [ "${1}" == "--update" ]
then
#####################################
# UPDATE
git pull

elif [ "${1}" == "--renew" ]
then

#####################################
# RENEVAL

#./letsencrypt-auto certonly --apache ${CIPHER_STRENGTH} --renew-by-default \
./letsencrypt-auto certonly --apache  --renew-by-default \
"${BASE_DOMAIN}" \
"${DOMAIN_LIST}"


else

#####################################
# NEW ENVIRONMENT INCLUDING 

#./letsencrypt-auto certonly --apache ${CIPHER_STRENGTH} \
#./letsencrypt-auto certonly --apache \
./letsencrypt-auto --apache \
"${BASE_DOMAIN}" \
"${DOMAIN_LIST}"

fi