Centralni sprava certifikatu podepsanych Let's Encrypt autoritou
Centralni server
Pristup na SSH povolen pouze klicem. Instalovan fail2ban.
Prihlaseni:# ssh root@encrypt.uvt.cz -p 10122
- Vygenerovani certifikatu
Na klientu je nutne pridat do konfigurace vhostu redirect na centralni server. Napr.:
Apache:
RewriteEngine On
RedirectMatch "^/.well-known/acme-challenge/(.*)" "http://encrypt.uvt.cz/.well-known/acme-challenge/$1"
Nginx:
location /.well-known/acme-challenge/ {
return 302 http://encrypt.uvt.cz$request_uri;
}
U vsech domen overime, ze je redirect funkcni:
# curl -v http://nase.domena.cz/.well-known/acme-challenge/test
Konfigurace na centralnim serveru:
V adresari /opt/letsencrypt/etc je seznam zakazniku. Co adresar to nazev zakaznika. V adresari zakaznika jsou kontrolovany soubory (skupiny domen) *.conf. Co radka to jedna domena. Priklad:
# cat /opt/letsencrypt/etc/uvt/b.ktf.cuni.cz.conf b.ktf.cuni.cz dc.b.ktf.cuni.cz ip.b.ktf.cuni.cz dohled.b.ktf.cuni.cz muc.b.ktf.cuni.cz
Po zmene konfigurace spustime script
# /opt/letsencrypt/lets-encrypt.pl
Pokud upravujem jiz existujici skupinu domen pouzijem parametry --customer a --groupid.
# /opt/letsencrypt/lets-encrypt.pl -h
A tool for manage certificate files via Let's Encrypt. Usage: /opt/letsencrypt/lets-encrypt.pl [OPTION] ...
Please specify following options for recreate files:
-c, --customer
Customer string.
-g, --groupid
GroupID string.
-h, --help
Print this message.
Napr.:
# /opt/letsencrypt/lets-encrypt.pl -c uvt -g testing
Script vygeneruje certifikat a vytvori ucet a do adresare /opt/letsencrypt/data/${customer}/.ssh SSH klic pokud neexistuje. Pokud nastane chyba, proverime log:
# less /opt/letsencrypt/log/lets-encrypt.log
Klient
Nainstalujem balik bosson-letsencrypt z bosson repozitare.
# yum install bosson-letsencrypt
- Konfigurace
V souboru /opt/bosson/etc/le/config.pm upravime konfiguraci hashe %LISTS. Do adresare /opt/bosson/etc/le/keys nakopirujem ssh klic daneho zakaznika z centralniho serveru (/opt/letsencrypt/data/<customer>/.ssh. Nazev souboru dle nazvu zakaznika. Zmenime prava:
# chmod 0400 /opt/bosson/etc/le/keys/*
Spustime script /opt/bosson/bin/le-renew.pl
Certifikaty jsou stazeny do adresare /etc/pki/le