HTTPS sur Apache

Mise à jour, nouvelle méthode

apt-get install python-certbot-apache -t jessie-backports
certbot –apache

certbot –apache certonly seulement si la conf SSL apache est manuelle
https://certbot.eff.org
//************************

encore mieux passe tout les virtual host d’un coup
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto –apache  -> répondre au questions

//************************

https://www.ssllabs.com/ssltest/analyze.html?d=www.mondomaine.com -> tester la conf HTTPS

Passer un site web apache en HTTPS avec certificat valide et certifié, mais gratuit
Certificat gratuit avec http://letsencrypt.fr/
sur Debian
apt-get install -y git
cd /monchemein
git clone https://github.com/letsencrypt/letsencrypt.git && cd letsencrypt/
./letsencrypt-auto certonly –webroot –webroot-path /home/www.mondomaine.com –renew-by-default –email adresse@email_valide.com –agree-tos -d www.mondomaine.com
Dans le fichier de conf apache pour le domaine, ajouter les 4 lignes à la fin de cet exemple
<VirtualHost *:443>    
  DocumentRoot /home/www.mondomaine.com/  
  ServerName www.mondomaine.com   
  ServerAdmin adresse@email_valide.com    
  <Directory /home/www.mondomaine.com/>       
    Options FollowSymLinks       
    AllowOverride all       
    #AllowOverride Indexes     AuthConfig Limit FileInfo       
    Order allow,deny        
    Allow from all   
  </Directory>    
  AddType application/x-httpd-php .php .php3 .php4 .php5     
  SSLEngine on  
  SSLCertificateFile /etc/letsencrypt/live/www.mondomaine.com/cert.pem   
  SSLCertificateKeyFile /etc/letsencrypt/live/www.mondomaine.com/privkey.pem   
  SSLCACertificateFile /etc/letsencrypt/live/www.mondomaine.com/chain.pem
  </VirtualHost>
/etc/init.d/apache2 stop
/etc/init.d/apache2 start
Le certificat doit être renouvelé tous les mois -> cron création /etc/cron.monthly/letsencrypt +chmod +x /etc/cron.monthly/letsencrypt contenant :
#!/bin/bash /monchemin/letsencrypt/letsencrypt-auto certonly –webroot –webroot-path /home/www.mondomaine.com –renew-by-default –emailadresse@email_valide.com  –agree-tos -d www.mondomaine.com
/etc/init.d/apache2 restart
C’est tout

Ancienne méthode pour certificat auto-signés -> message sécurité sur le navigateur

a2enmod ssl
service apache2 force-reload  ou /etc/init.d/apache2 stop + /etc/init.d/apache2 start
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/localhost.pem
ou
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -out /etc/apache2/server.crt -keyout /etc/apache2/server.key
openssl req -sha256 -nodes -newkey rsa:2048 -keyout www.server.com.key -out www.server.com.csr

ou Certificats gratuits : https://www.startssl.com/

Controle certificat SSL openssl s_client -connect localhost:443

En cas e conflict de version :  mv /opt/eff.org  /opt/eff.org.001

     

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

fifty eight − fifty seven =