====== Certifikační autorita Let‘s Encrypt ======
**Problém s žadostí o certifikát**, skončil chybou, pomohla doinstalace **curl**
https://github.com/Neilpang/acme.sh\\
https://www.zdrojak.cz/clanky/lets-encrypt-a-vase-weby/?utm_source=rss&utm_medium=rss&utm_campaign=lets-encrypt-a-vase-weby\\
https://www.zdrojak.cz/clanky/lets-encrypt-a-vase-weby/\\
http://www.root.cz/clanky/let-s-encrypt-v-praxi-jak-jsem-presel-na-https/\\
http://www.root.cz/clanky/acme-sh-snadna-cesta-k-certifikatu-od-let-s-encrypt/\\
**Cerifikáty pro IIS na Windows**\\
Nově jen https://www.win-acme.com/
https://github.com/win-acme/win-acme/releases/
https://weblog.west-wind.com/posts/2016/feb/22/using-lets-encrypt-with-iis-on-windows\\
https://github.com/Lone-Coder/letsencrypt-win-simple/wiki/Create-a-SAN-certificate-for-Microsoft-Exchange-2016,-2013-&-2010\\
===== Konfigurace Apache serveru =====
https://www.hukot.net/community/tutorials/nastaveni-let-s-encrypt-s-apache-serverem
===== Správa certifikátů pomocí acme.sh skriptu =====
Nově používám konfiguraci pro Apache
==== Instalace ====
git clone https://github.com/Neilpang/acme.sh.git
cd ./acme.sh
./acme.sh --install
Skrip lze stáhnout samostatně
wget -O - https://get.acme.sh | sh
Pokud se příkaz ''acme.sh'' spustí s paramatrem ''--install'', vytvoří adresářovou strukturu a založí uživatele **letsencrypt**.\\
Dále nastavít úlohu v cronu.
==== Žádost o certifikát ====
=== Singledomain pomocí webroot složky ===
root@debian:~/.acme.sh# ./acme.sh --issue -d wp.emcc.cz -w /home/letsencrypt/webroot/ -d wp.emcc.cz
[Wed Oct 19 14:07:02 CEST 2016] Registering account
[Wed Oct 19 14:07:03 CEST 2016] Already registered
[Wed Oct 19 14:07:05 CEST 2016] Update success.
[Wed Oct 19 14:07:05 CEST 2016] Creating domain key
[Wed Oct 19 14:07:05 CEST 2016] Multi domain='DNS:wp.emcc.cz'
[Wed Oct 19 14:07:05 CEST 2016] Verify each domain
[Wed Oct 19 14:07:05 CEST 2016] Getting webroot for domain='wp.emcc.cz'
[Wed Oct 19 14:07:05 CEST 2016] _w='/home/letsencrypt/webroot/'
[Wed Oct 19 14:07:05 CEST 2016] Getting new-authz for domain='wp.emcc.cz'
[Wed Oct 19 14:07:06 CEST 2016] Getting webroot for domain='wp.emcc.cz'
[Wed Oct 19 14:07:06 CEST 2016] _w='/home/letsencrypt/webroot/'
[Wed Oct 19 14:07:06 CEST 2016] Getting new-authz for domain='wp.emcc.cz'
[Wed Oct 19 14:07:07 CEST 2016] Verifying:wp.emcc.cz
[Wed Oct 19 14:07:13 CEST 2016] Success
[Wed Oct 19 14:07:13 CEST 2016] Verifying:wp.emcc.cz
[Wed Oct 19 14:07:20 CEST 2016] Success
[Wed Oct 19 14:07:20 CEST 2016] Verify finished, start to sign.
[Wed Oct 19 14:07:22 CEST 2016] Cert success.
-----BEGIN CERTIFICATE-----
MIIE+DCCA+CgAwIBAgISA4v016MFsZI1SOAnZbrivVrQMA0GCSqGSIb3DQEBCwUA
.
.
.
4jU122EVpg9S3u4WQn2HTbwIZ12iplIcZiUpPZSb3rVzuZC3p3ZF234icqaSC4/K
CniaOfThxEL2Yw2HQik1JGCP9vwTRNqN2/E5J/fpxzqD1b7kj5S1oOkNjLzP/6wi
wzvfNAFI8d1XzuqayMtrPWEhXXDy6NvHG1Bcpg==
-----END CERTIFICATE-----
[Wed Oct 19 14:07:22 CEST 2016] Your cert is in /root/.acme.sh/wp.emcc.cz/wp.emcc.cz.cer
[Wed Oct 19 14:07:22 CEST 2016] Your cert key is in /root/.acme.sh/wp.emcc.cz/wp.emcc.cz.key
[Wed Oct 19 14:07:22 CEST 2016] The intermediate CA cert is in /root/.acme.sh/wp.emcc.cz/ca.cer
[Wed Oct 19 14:07:22 CEST 2016] And the full chain certs is there: /root/.acme.sh/wp.emcc.cz/fullchain.cer
=== Multidomain pomocí webroot složky ===
./acme.sh --issue -d jira.hpl.cz -d jira.griffteam.com -d jira.griffteam.cz -w /home/letsencrypt/webroot/
./acme.sh --issue -d steel-meat.com -d www.steel-meat.com -w /home/letsencrypt/webroot/
=== Obnova certifikátu ===
acme.sh --renew -d confluence.hpl.cz --force
==== Aktualizace z v1.api na v2.api ====
Aktualizace byla provedena na serverech Jira, Bamboo, Bitbucket a Confluence - všechny servery jsou nainstalované jako LXC kontejnery na PROXMOX. OS Debian 8.\\
LE přešel od května 2021 na apv v2. Na serverech přestala fungovat automatická aktualizace certifikátů.
Na serverech jsem provedl zálohu složky ''/root/.acme.sh'' na ''/root/.acme.sh.v1'', nainstalovalk jsem aktuální verzi skriptu ''acme.sh''\\
#Instalace do složky -root-.acme.sh
wget -O - https://get.acme.sh | sh
#Aktualizace
acme.sh --upgrade
Nainstaloval jsem znovu certifikáty
/root/.acme.sh/acme.sh --issue -d bamboo.hpl.cz -d bamboo.tool4dev.com -w /home/letsencrypt/webroot/ --force --server letsencrypt
Skript ''acme.sh'' se musí spustit s parametrem ''--server letsencrypt'' - [[https://github.com/acmesh-official/acme.sh|acme.sh]] defaultně podporuje vydavatele ZeroSSL.com CA.
Po instalaci certifikátů je potřeba překopírovat certifikáty na reverzní proxy - Mail GW a restartovat Apache server lokální i na Mail GW - použít skript ''sync_cert''
===== Zjištění datumu expirace certifikátu =====
echo | openssl s_client -servername confluence.tool4dev.com -connect confluence.tool4dev.com:443 2>/dev/null | openssl x509 -enddate -noout
Jak setřídit txt soubor podle data expirace?
https://unix.stackexchange.com/questions/535611/how-does-one-sort-dates-in-a-text-file
===== Expirace ROOT certifikátu - DST Root CA X3 =====
=== Ověření pomocí stránky ===
https://www.ssllabs.com/ssltest
nebo ověřit pomocí programu ''openssl''
openssl s_client -connect mail.griffteam.com:443 -showcerts
=== Root certifikáty Lets Encrypt ===
https://letsencrypt.org/certificates/
Po instalaci ROOT certifikátů je nutné vygenerovat nový certifikát
C:\Data\Utils\LetsEncrypt\win-acme-2.1.7\wacs.exe --renew --force --baseuri "https://acme-v02.api.letsencrypt.org/"
==== Postup aktualizace na nový ROOT cert pro Windows servery ====
https://github.com/win-acme/win-acme/issues/1918
==== Postup aktualizace na nový ROOT cert pro Linux - Debian servery ====
Editovat soubor ''/etc/ca-certificates.conf'', zakomentovat vykřičníkem řádek ''mozilla/DST_Root_CA_X3.crt''.\\
Výsledek pak vypadá následovně: ''!mozilla/DST_Root_CA_X3.crt''\\
Po úpravě souboru spustit příkaz: ''update-ca-certificates''