Installation des certificats Let's Encrypt avec le client certbot
modifier le DocumentRoot du fichier /etc/apache2/sites-enabled/000-default.conf
sed --follow-symlinks -i "s|DocumentRoot.*|DocumentRoot ${INSTALL_PATH}/|g" /etc/apache2/sites-enabled/000-default.conf
installer les dépôts backports dans /etc/apt/sources.list
echo '# jessie-backports, previously on backports.debian.org deb http://ftp.fr.debian.org/debian/ jessie-backports main contrib non-free' >>/etc/apt/sources.list
sudo apt-get update && sudo apt-get install python-certbot-apache -t jessie-backports
certbot --apache --rsa-key-size 4096 -d mail.toto.fr --email postmaster@toto.fr --agree-tos
Sélectionnez l'option “Secure” pour rediriger toutes les requêtes vers le 443 SSL
les nouveaux certificats seront dans: /etc/letsencrypt/live/
votre fichier /etc/apache2/sites-enabled/000-default.conf devrait ressemblé à ça:
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/horde/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on RewriteCond %{SERVER_NAME} =mail.toto.fr RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] </VirtualHost>
et votre fichier /etc/apache2/sites-enabled/000-default-le-ssl.conf devrait ressemblé à ça:
<IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin www@toto.fr DocumentRoot /var/www/horde ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLCertificateFile /etc/letsencrypt/live/mail.toto.fr/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/mail.toto.fr/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf ServerName mail.toto.fr # CalDAV/CardDAV autodiscovery RedirectPermanent /.well-known/caldav /rpc.php/ RedirectPermanent /.well-known/carddav /rpc.php/ # Outlook autodiscover URL. Alias /autodiscover/autodiscover.xml /var/www/horde/rpc.php Alias /autodiscover/Autodiscover.xml /var/www/horde/rpc.php Alias /autodiscover/AutoDiscover.xml /var/www/horde/rpc.php Alias /autodiscover/autoDiscover.xml /var/www/horde/rpc.php # ActiveSync Alias /Microsoft-Server-ActiveSync /var/www/horde/rpc.php <Directory /var/www/horde> Options Indexes FollowSymLinks MultiViews AllowOverride Require all granted RewriteEngine On </Directory> AddType application/x-httpd-php .php DirectoryIndex index.php </VirtualHost> </IfModule>
Edit /etc/postfix/main.cf and change certificates files paths Edit /etc/dovecot/conf.d/10-ssl.conf and change certificates files paths