• Applications
  • [Discussion] Certificat SSL signé et gratuit avec Let's Encrypt

Bon bah du coup reste que pip (?)

sudo pip install --upgrade pip

Réponse : Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages/pi p-9.0.1-py2.7.egg

Version python : 2.7.9
Version pip : 9.0.1

un mois plus tard

Bonjour,

Après l'installation d'une seedbox chez kimsufi version exrat en debian 9 et php 7.
Dès que je mets en place les certificats ssl avec let's encrypt, Seedbox manager ne fonctionne plus.
Au niveau conf, je dois modifier quoi ?

Merci
Balbao.

    balbao
    Salut
    tu dois juste modifié ces 2 lignes

        ssl_certificate /etc/letsencrypt/live/www.votresite.fr/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/www.votresite.fr/privkey.pem;

      xavier

      C'est déjà fait. Et tout fonctionne sauf seedbox manager.

      server {
      listen 80;
      server_name monsite.com;

      location / {
          rewrite ^ https://$server_name$request_uri? permanent;
      }
      
      	location = /favicon.ico {
      	access_log off;
      	log_not_found off;
      }
      
      location = /50x.html {
      	root /usr/share/nginx/html;
      }
      
      location ~ \.php$ {
      	fastcgi_index index.php;
      	include /etc/nginx/fastcgi_params;
      	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      	fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
      }
      
      location ~* \.(jpg|jpeg|gif|css|png|js|map|woff|woff2|ttf|svg|eot)$ {
      	expires 30d;
      	access_log off;
      }

      }

      server {
      listen 443 ssl;
      server_name monsite.com;
      index index.html index.php;
      charset utf-8;

      ssl on;
      ssl_certificate /etc/letsencrypt/live/monsite.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/monsite.com/privkey.pem;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers "EECDH+AESGCM:AES128+EECDH:AES256+EECDH";

      ssl_prefer_server_ciphers on;
      ssl_ecdh_curve secp384r1;

      ssl_session_cache shared:SSL:10m;
      ssl_session_timeout 10m;

      ssl_stapling on;
      ssl_stapling_verify on;

      resolver 8.8.4.4 8.8.8.8 valid=300s;
      resolver_timeout 10s;

      add_header X-Frame-Options "SAMEORIGIN";
      add_header X-Content-Type-Options "nosniff";

      access_log /var/log/nginx/rutorrent-access.log combined;
      error_log /var/log/nginx/rutorrent-error.log error;

      error_page 500 502 503 504 /50x.html;
      location = /50x.html { root /usr/share/nginx/html; }

      auth_basic "seedbox";
      auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd";
      
      location = /favicon.ico {
      	access_log off;
      	log_not_found off;
      }
      
         ## debut config accueil serveur ##
      
      location ^~ / {
          root /var/www/base;
          include /etc/nginx/conf.d/php.conf;
          include /etc/nginx/conf.d/cache.conf;
          satisfy any;
          allow all;
      }
      
      ## fin config accueil serveur ##
      
      
      ## début config proxy ##
      
      location ^~ /proxy {
          root /var/www;
          include /etc/nginx/conf.d/php.conf;
          include /etc/nginx/conf.d/cache.conf;
      }
      
      ## fin config proxy ##
      
      ## début config rutorrent ##
      
      location ^~ /rutorrent {
          root /var/www;
          include /etc/nginx/conf.d/php.conf;
          include /etc/nginx/conf.d/cache.conf;
      
          location ~ /\.svn {
      	    deny all;
          }
      
          location ~ /\.ht {
      	    deny all;
          }
      }
      
      location ^~ /rutorrent/conf/ {
      	deny all;
      }
      
      location ^~ /rutorrent/share/ {
      	deny all;
      }
      
      ## fin config rutorrent ##
      
      ## début config munin ##
      
      location ^~ /graph {
          root /var/www;
          include /etc/nginx/conf.d/php.conf;
          include /etc/nginx/conf.d/cache.conf;
      }
      
      location ^~ /graph/img {
          root /var/www;
          include /etc/nginx/conf.d/php.conf;
          include /etc/nginx/conf.d/cache.conf;
          error_log /dev/null crit;
      }
      
      location ^~ /monitoring {
          root /var/www;
          include /etc/nginx/conf.d/php.conf;
          include /etc/nginx/conf.d/cache.conf;
      }
      
      ## fin config munin ##
      
       
      ## début config seedbox-manager ##
      
      location ^~ /seedbox-manager {
      alias /var/www/seedbox-manager/public;
          include /etc/nginx/conf.d/php-manager.conf;
          include /etc/nginx/conf.d/cache.conf;
      }
      
          ## fin config seedbox-manager ##
      
          ## config utilisateurs  ##
      
          location /BALBAO {
              include scgi_params;
              scgi_pass 127.0.0.1:5001; #ou socket : unix:/home/username/.session/username.socket
              auth_basic "seedbox";
              auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_balbao";
          }
      
          location /USER1 {
              include scgi_params;
              scgi_pass 127.0.0.1:5003; #ou socket : unix:/home/username/.session/username.socket
              auth_basic "seedbox";
              auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user1";
          }
      
          location /USER2 {
              include scgi_params;
              scgi_pass 127.0.0.1:5004; #ou socket : unix:/home/username/.session/username.socket
              auth_basic "seedbox";
              auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user2";
          }
      
          location /USER3 {
              include scgi_params;
              scgi_pass 127.0.0.1:5005; #ou socket : unix:/home/username/.session/username.socket
              auth_basic "seedbox";
              auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user3";
          }

      }

        balbao
        Salut
        si tu as utilisé le derniere version de manager ta conf doit pas du tout ressemblé a ça.
        deja il te manque
        root /var/www;
        je vais essaye de tant faire un.

        balbao
        si tu veux test cette version de conf.

        server {
        	listen 80 default_server;
        	listen 443 default_server ssl http2;
        	server_name _;
        
        	index index.html index.php;
        	charset utf-8;
        	client_max_body_size 10M;
        
        	ssl_certificate /etc/letsencrypt/live/monsite.com/fullchain.pem;
        	ssl_certificate_key /etc/letsencrypt/live/monsite.com/privkey.pem;
        
        	include /etc/nginx/conf.d/ciphers.conf;
        
        	access_log /var/log/nginx/rutorrent-access.log combined;
        	error_log /var/log/nginx/rutorrent-error.log error;
        
        	error_page 500 502 503 504 /50x.html;
        
        	auth_basic "seedbox";
        	auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd";
        
        	root /var/www;
        
        	location = /favicon.ico {
        		access_log off;
        		log_not_found off;
        	}
        
        	location = /50x.html {
        		root /usr/share/nginx/html;
        	}
        
        	location ~ \.php$ {
        		fastcgi_index index.php;
        		include /etc/nginx/fastcgi_params;
        		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        		fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        	}
        
        	location ~* \.(jpg|jpeg|gif|css|png|js|map|woff|woff2|ttf|svg|eot)$ {
        		expires 30d;
        		access_log off;
        	}
        
        	location ~* \.(eot|ttf|woff|svg)$ {
        		add_header Acccess-Control-Allow-Origin *;
        	}
        
        	## Config accueil serveur ##
        
        	location ^~ / {
        		root /var/www/base;
        		include /etc/nginx/conf.d/php.conf;
        		include /etc/nginx/conf.d/cache.conf;
        		satisfy any;
        		allow all;
        	}
        
        	## Config rutorrent ##
        
        	location /rutorrent {
        		try_files $uri $uri/ /index.html;
        	}
        
        	location ~ ^/rutorrent/(conf|share)/(.+)$ {
        		deny all;
        	}
        
        	## Config seedbox-manager ##
        
        	location /seedbox-manager {
        		try_files /seedbox-manager/$uri /seedbox-manager/index.php$is_args$args;
        	}
        
        	## Config utilisateurs ##
        
                    location /BALBAO {
                    include scgi_params;
                    scgi_pass 127.0.0.1:5001; #ou socket : unix:/home/username/.session/username.socket
                    auth_basic "seedbox";
                    auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_balbao";
                }
        
                location /USER1 {
                    include scgi_params;
                    scgi_pass 127.0.0.1:5003; #ou socket : unix:/home/username/.session/username.socket
                    auth_basic "seedbox";
                    auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user1";
                }
        
                location /USER2 {
                    include scgi_params;
                    scgi_pass 127.0.0.1:5004; #ou socket : unix:/home/username/.session/username.socket
                    auth_basic "seedbox";
                    auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user2";
                }
        
                location /USER3 {
                    include scgi_params;
                    scgi_pass 127.0.0.1:5005; #ou socket : unix:/home/username/.session/username.socket
                    auth_basic "seedbox";
                    auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user3";
                }
        
            }

        Au final de l'installation du script j'ai ce message d'erreur au redémarrage de nginx :

        service nginx restart

        Erreur >
        Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details

        J'ai fait: service nginx status -l

        ● nginx.service - A high performance web server and a reverse proxy server
           Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
           Active: failed (Result: exit-code) since Tue 2017-10-10 17:07:50 CEST; 18min ago
             Docs: man:nginx(8)
          Process: 1450 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
         Main PID: 4695 (code=exited, status=0/SUCCESS)
        
        Oct 10 17:07:50 113500HD010180 nginx[1450]: nginx: [emerg] invalid number of arguments in "ssl_certificate" directive in /etc/nginx/sites-enabled/seedbox.conf:4
        Oct 10 17:07:50 113500HD010180 nginx[1450]: nginx: configuration file /etc/nginx/nginx.conf test failed
        Oct 10 17:07:50 113500HD010180 systemd[1]: nginx.service: control process exited, code=exited status=1
        Oct 10 17:07:50 113500HD010180 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
        Oct 10 17:07:50 113500HD010180 systemd[1]: Unit nginx.service entered failed state.
        Oct 10 17:26:10 113500HD010180 systemd[1]: Stopped A high performance web server and a reverse proxy server.
        

        @xavier

        Merci pour cette conf. Cela fonctionne très bien

          balbao
          Après a toi de mettre ton nom de domaine et faire une redirection automatique sur le https .

          Oui c'est ce que j'ai fait. J'ai pas utilisé la config exactement comme ça. Mais tout fonctionne maintenant.

            balbao enfaite avec manager 2.5 ta conf devait être bonne.mais avec la version 3 il te faut ma conf.

            @Wagner

            Merci. C'est effectivement 2 erreurs dans la ligne ssl_certificate + ssl_certificate_key: un espace inséré après l'adresse de mon site. Pourtant j'ai regardé et reregardé cette config......
            Mon status de nginx est au vert ))))

            Petite question:
            Comment as-tu pu repéré ce genre d'erreur ?

            En tout cas mille et un mercis encore.

            De rien @Peerotechnik, dès fois c'est juste grâce au(x) message(s) et quand c'est possible je me base aussi sur mon expérience (ou mes souvenirs).

            un mois plus tard

            Bonjour.

            Sur un installation propre de Stretch et après avoir suivi ce tuto Installer ruTorrent sur Debian 9 j'essai d'installer un certificat ssl.
            Mais j'ai une erreur au redémarrage de nginx.
            Le statut de nginx :

            systemd[1]: Starting nginx - high performance web server...
            nginx[17207]: nginx: [emerg] "location" directive is not allowed here in /etc/nginx/sites-enabled/seedbox.conf:23
            nginx[17207]: nginx: configuration file /etc/nginx/nginx.conf test failed
            systemd[1]: nginx.service: Control process exited, code=exited status=1
            systemd[1]: Failed to start nginx - high performance web server.
            systemd[1]: nginx.service: Unit entered failed state.
            systemd[1]: nginx.service: Failed with result 'exit-code'.
            

            Le début de mon sites-enabled/rutorrent.conf :

            server {
                listen 80 default_server;
                listen 443 default_server ssl http2;
                server_name mon.domain.fr;
                ssl_certificate /etc/letsencrypt/live/mon.domain.fr/fullchain.p$
                ssl_certificate_key /etc/letsencrypt/live/mon.domain.fr/privkey$
            
            }
                charset utf-8;
                index index.html index.php;
                client_max_body_size 10M;
            
            access_log /var/log/nginx/rutorrent-access.log combined;
            error_log /var/log/nginx/rutorrent-error.log error;
            
            error_page 500 502 503 504 /50x.html;
            
            auth_basic "seedbox";
            auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd";
            
            root /var/www;
            
             location = /50x.html {
                root /usr/share/nginx/html;
            }  

            Et un /etc/letsencrypt/live/mon.domain.fr# ls -l me renvoi

             
            -bash: /etc/letsencrypt/live/mon.domain.fr#: No such file or directory

            Merci pour votre aide.

            7 jours plus tard

            Bonsoir. Finalement affaire résolu.
            Un problème avec le nom de domaine.

            8 jours plus tard

            Salut,
            j'ai suivi les tutos pour installer rutorrent sous debian 9, puis le tuto pour le certificat SSL signé... mais autant j'avais pas de problème d'accès après le premier tuto, mais maintenant je ne peux plus accéder à mondomaine.ovh/rutorrent du tout. J'ai une erreur, la connexion a échoué. Par où commencer ? merci

            2 mois plus tard

            Bonjour 🙂
            Est-ce que quelqu'un aurait un mini tuto pour la mise en place du renouvellement automatique ?
            Merci !

              4 jours plus tard

              Bonjour
              J'ai un problème pour renouveler le certificat SSL

              service nginx stop
              ./certbot-auto renew
              service nginx start
              

              J'ai ce message d'erreur qui apparaît

              -bash: ./certbot-auto: No such file or directory

              Une petite solution ?

              Bonjour,

              Tu dois te situer dans le dossier ou est installé certbot-auto.

              Surement /opt/certbot-auto/ ou sinon tu dois saisir le chemin complet dans ta commande

              J'ai fait une recherche du dossier/fichier certbot-auto dans divers dosssier (/home /opt /root ....)

              find /<DOSSIER>/  certbot-auto

              La réponse reste : find: `certbot-auto': No such file or directory

              Possible qu'il ne soit plus présent ?

                Peerotechnik

                Tu n'es pas ou plus dans le dossier qui contient certbot-auto (il s'agit du dossier /tmp d'après ce tuto) ou tu l'as supprimé (ou le système a vidé /tmp).

                Tente de refaire d'abord les 1ères étapes du tuto :

                service nginx stop
                
                apt-get update && apt-get upgrade
                
                cd /tmp
                wget https://dl.eff.org/certbot-auto
                chmod a+x ./certbot-auto
                ./certbot-auto --help all
                ./certbot-auto renew
                service nginx start

                  Que faut t'il faire si l'on souhaite ajouter un "sous" domaine à un certificat actuel? Il faut tout supprimer et recommencer? Si oui comment on supprime? Ou alors on peut ajouter un sous-domaine à un certificat existant?

                  Hum.. je pense que je suis sur la voie avec

                  --expand tells Certbot to update an existing certificate with a new certificate that contains all of the old domains and one or more additional new domains. With the --expand option, use the -d option to specify all existing domains and one or more new domains.

                  Je vais essayer

                    Hello,

                    Petit problème lorsque je veux créer le certificat lié à mon nom de domaine, j'obtiens cette erreur :
                    Failed authorization procedure. mondomaine.org (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://mondomaine.org/.well-known/acme-challenge

                    Du coup pas de certificat et forcément pas de dossier live dans mon /etc/letsencrypt.
                    Si quelqu'un a une idée du souci, merci !

                      spider1163

                      Merci spider,

                      Je pense aussi que mon fichier a disparu....je vais suivre ton conseil.

                      Après une réinstallation et la commande ./certbot-auto renew

                      Voici le message reçu
                      Processing /etc/letsencrypt/renewal/<monsite.com>.conf
                      Cert not yet due for renewal

                      Mon certificat n'a pas été renouvelé !

                        fana
                        As-tu mis le message d'erreur complet ?
                        Et je suppose que tu as remlacé mondomaine.org par ton vrai ndd ?

                        L'erreur la plus courante semble être la 404 :
                        https://community.letsencrypt.org/t/the-client-lacks-sufficient-authorization-404/5309
                        Failed authorization procedure. mydomain.net (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://mydomain.net/.well-known/acme-challenge/789[...]eSA [255.255.255.255]: 404

                        Peux-tu atteindre le lien de ton message d'erreur via un navigateur ?
                        ex: http://mydomain.net/.well-known/acme-challenge/789[...]eSA

                        • fana a répondu à ça.

                          Peerotechnik

                          Salut.

                          J'avais le même problème que toi. J'ai repris le début du tuto comme le propose @spider1163 .
                          Lors de cette commande

                          ./certbot-auto --help all

                          le certificat n'ai toujours pas renouvelé.
                          Du coup j'ai repris la fin du tuto avec ces commandes

                          service nginx stop
                          ./certbot-auto renew
                          service nginx start

                          Après quelques minutes d'attente mon certificat c'est bien renouvelé pour 3 mois.

                          spider1163

                          Ouep j'ai mis mon vrai nom de domaine (un nom de domaine No-ip ça y joue ?)

                          Voilà le message d'erreur complet :
                          `Saving debug log to /var/log/letsencrypt/letsencrypt.log
                          Plugins selected: Authenticator standalone, Installer None
                          Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
                          to cancel): mondomaine.org
                          Obtaining a new certificate
                          Performing the following challenges:
                          http-01 challenge for mondomaine.org
                          Waiting for verification...
                          Cleaning up challenges
                          Failed authorization procedure. mondomaine.org (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://mondomaine.org/.well-known/acme-challenge/8hDJj2iIXso1IoftpbwUtjs9cJguxR5Q31ZOASKcpIs: "<!DOCTYPE html>
                          <html>
                          <head>
                          <meta charset="utf-8">
                          <style>body{font-family:Arial,Helvetica,sans-serif;font-size:12px;text-alig"

                          IMPORTANT NOTES:
                          - The following errors were reported by the server:

                          Domain: mondomaine.org
                          Type: unauthorized
                          Detail: Invalid response from
                          http://mondomaine.org/.well-known/acme-challenge/8hDJj2iIXso1IoftpbwUtjs9cJguxR5Q31ZOASKcpIs:
                          "<!DOCTYPE html>
                          <html>
                          <head>
                          <meta charset="utf-8">
                          <style>body{font-family:Arial,Helvetica,sans-serif;font-size:12px;text-alig"

                          To fix these errors, please make sure that your domain name was
                          entered correctly and the DNS A/AAAA record(s) for that domain
                          contain(s) the right IP address.`

                            fana
                            Un domaine NO-IP ne devrait pas poser souci, ça reste un sous-domaine comme un autre. (EDIT: je viens de tester, pas de souci)
                            As-tu bien renseigné l'adresse IP de ton serveur dans la console NO-IP ?
                            Ton serveur est-il bien accessible via le navigateur ?
                            A mon avis il y a un souci à ce niveau là, car l'URL donnée en erreur semble injoignable :
                            Qu'obtiens-tu en te rendant sur l'adresse du type http://mondomaine.org/.well-known/acme-challenge/8hDJj2iIXso1IoftpbwUtjs9cJguxR5Q31ZOASKcpIs ?

                            C'est bien là que ce situe mon problème.
                            L'URL reste injoignable

                            Avec la commande ./certbot-auto renew le renouvellement de mon certificat ne se fait pas, j'ai donc du opter pour une autre approche.

                            J'ai pu renouveler mon certificat pour 3 mois en faisant la commande suivante:

                            service nginx stop
                            ./certbot-auto certonly 

                            Au dialogue suivant, j'ai sélectionné #2 (standalone)

                            How would you like to authenticate with the ACME CA?
                            -----------------
                            1: Nginx Web Server plugin - Alpha (nginx)
                            2: Spin up a temporary webserver (standalone)
                            3: Place files in webroot directory (webroot)

                            - Puis indiquer ses noms de domaines (séparés par Espace ou Virgule)
                            - Une annonce dit que ces noms de domaine existent déjà. (ref: /etc/letsencrypt/renewal/<monsite.com>.conf)
                            - Que veux-tu faire ?
                            Choisir option #2 (Renew & replace...)

                            1: Keep the existing certificate for now
                            2: Renew & replace the cert (limit ~5 per 7 days)

                            Et voilà que mon certificat est prolongé de 90 jours.

                            service nginx start

                            pour clore l'intervention.

                            13 jours plus tard

                            spider1163 c'était un problème avec le port 80 qui était ouvert sur un autre équipement 😉

                            25 jours plus tard

                            Bonjour,

                            J'ai comme un gros couill... laissé mon certificat expiré.
                            La commande renew ne fonctionne pas et si je refais toute la procédure, ça ne fonctionne pas non plus.

                            Est-ce qu'il y à un moyen de nettoyer tout ce qui correspond a lets encrypt pour reppartir sur une base propre ?
                            Vu la question, vous vous doutez que je ne suis pas un tueur

                            Merci d'avance pour votre aide,
                            Arcenik