====== HAPROXY ======
===== LetsEncrypt =====
=== Obnovení platnosti LetsEncrypt certifikátů ===
https://pulecp.github.io/linuxdays2017/#/3/8\\
https://serversforhackers.com/c/letsencrypt-with-haproxy
**PEM file pro HaProxy**
Pro každou site existuje skript pro obnovu certifikátů.\\
Skript se spouští cronem každý 15 den v měsíci.
#!/bin/sh
cert_path=/etc/letsencrypt/live/mail.ofiz.cz
haproxy_path=/etc/ssl/private/haproxy
#/etc/init.d/haproxy stop
certbot certonly --standalone -d mail.ofiz.cz -d post.emcc.cz -d mail.veltrusy.cz --non-interactive --agree-tos --email info@emcc.cz --http-01-port=9999 --expand
cat $cert_path/fullchain.pem $cert_path/privkey.pem | tee $haproxy_path/mail.ofiz.cz.pem
/etc/init.d/haproxy reload
==== Přenos certifikátů na poštovní server - post.emcc.cz ====
**Nastavit automatické kopírování**
Pro poštovní server musí být certifikáty uloženy na dvou místech.\\
Pro službu **webmail** musí být na haproxy a pro SMTP, POP a IMAP musí být na serveru post.emcc.cz
Certifikáty je nutné po každé obnove zkopírovat z haproxy:/etc/letsencrypt/live/mail.ofiz.cz na post:/.acme.sh/mail.ofiz.cz
haproxy:/etc/letsencrypt/live/mail.ofiz.cz/cert.pem -> post:/.acme.sh/mail.ofiz.cz/mail.ofiz.cz.cer
haproxy:/etc/letsencrypt/live/mail.ofiz.cz/fullchain.pem -> post:/.acme.sh/mail.ofiz.cz/mail.ofiz.cz.key
haproxy:/etc/letsencrypt/live/mail.ofiz.cz/privkey.pem -> post:/.acme.sh/mail.ofiz.cz/fullchain.cer
scp cert.pem snemec@10.13.238.53:/home/snemec/mailcert/mail.ofiz.cz.cer
scp privkey.pem snemec@10.13.238.53:/home/snemec/mailcert/mail.ofiz.cz.key
scp fullchain.pem snemec@10.13.238.53:/home/snemec/mailcert/fullchain.cer
===== Dořešit následující problémy =====
* přenos certifikátů pro poštovní server(haproxy -> post)
* Pro cloud.profiit.cz je pem cert včetně přípony pem ''cloud.profiit.cz.pem'', ale pro dokuwiki.emcc.cz je certifikát bez přípony pem ''dokuwiki.emcc.cz''. **Proč?**\\ **Nenašel jsem konfigurační soubor, kde by se to dalo změnit.**\\ Certifikáty jsou umístěny ve složce ''/etc/ssl/private/haproxy''
===== SMTP =====
https://www.vcloudnine.de/load-balancing-inbound-smtp-connection-with-haproxy/\\
https://haraka.github.io/manual/HAProxy.html\\
Build an iRedMail fail-over Cluster with KeepAlived, HAProxy, GlusterFS, OpenLDAP, Mariadb\\
https://docs.iredmail.org/haproxy.keepalived.glusterfs.html#install-and-configure-haproxy
==== SMTP, IMAP TLS ====
https://www.liip.ch/en/blog/haproxy-selective-tls-termination