logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).

#1 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 16:34:54

hamzouz
A quel serveur veux tu que je me connecte ? J'ai pas tout saisi, tu veux que je me connecte au serveur hébergeant le site c'est bien ça ?


La commande demandée ci-dessous
root@CertBot:~# netstat -lpn | grep 443
tcp6       0      0 :::443                  :::*                    LISTEN      25541/apache2

#2 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 16:03:27

hamzouz
Je commence à penser sérieusement qu'il n'est pas possible de délivrer de certificats pour le site de l'entreprise, qu'en penses tu ?
Mise à part les pistes que tu m'as donné, j'ai tenté beaucoup de choses de mon côté et toujours rien pour ce p***n de HTTPS.....

#3 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 15:59:15

hamzouz
Oui, tout est activé.. J'ai activé tout les modules qui vont bien
Voilà ce que j'obtiens lorsque je tape la commande

root@CertBot:~# lsof -i :443
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
apache2 25541     root    6u  IPv6  53296      0t0  TCP *:https (LISTEN)
apache2 25624 www-data    6u  IPv6  53296      0t0  TCP *:https (LISTEN)
apache2 25625 www-data    6u  IPv6  53296      0t0  TCP *:https (LISTEN)

#4 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 15:34:25

hamzouz
Lorsque j'utilise mes certificats auto-signé, ça ne fonctionne pas non plus..

root@CertBot:~# openssl s_client -connect glpi.cefim.eu:443
connect: Connection refused
connect:errno=111


Fichier vhost:

GNU nano 2.2.6                                                  Fichier : default-ssl.conf

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost
                ServerName glpi.cefim.eu:443
                DocumentRoot /var/www/html


                # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
                # error, crit, alert, emerg.
                # It is also possible to configure the loglevel for particular
                # modules, e.g.
                #LogLevel info ssl:warn


                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined


                # For most configuration files from conf-available/, which are
                # enabled or disabled at a global level, it is possible to
                # include a line for only one particular virtual host. For example the
                # following line enables the CGI configuration for this host only
                # after it has been globally disabled with "a2disconf".
                #Include conf-available/serve-cgi-bin.conf


                #   SSL Engine Switch:
                #   Enable/Disable SSL for this virtual host.
                SSLEngine on


                #   A self-signed (snakeoil) certificate can be created by installing
                #   the ssl-cert package. See
                #   /usr/share/doc/apache2/README.Debian.gz for more info.
                #   If both key and certificate are stored in the same file, only the
                #   SSLCertificateFile directive is needed.
                SSLCertificateFile      /etc/apache2/ssl/apache.crt
                SSLCertificateKeyFile /etc/apache2/ssl/apache.key
#   Server Certificate Chain:
                #   Point SSLCertificateChainFile at a file containing the
                #   concatenation of PEM encoded CA certificates which form the
                #   certificate chain for the server certificate. Alternatively
                #   the referenced file can be the same as SSLCertificateFile
                #   when the CA certificates are directly appended to the server
                #   certificate for convinience.
                #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt


                #   Certificate Authority (CA):
                #   Set the CA certificate verification path where to find CA
                #   certificates for client authentication or alternatively one
                #   huge file containing all of them (file must be PEM encoded)
                #   Note: Inside SSLCACertificatePath you need hash symlinks
                #                to point to the certificate files. Use the provided
                #                Makefile to update the hash symlinks after changes.
                #SSLCACertificatePath /etc/ssl/certs/
                #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt


                #   Certificate Revocation Lists (CRL):
                #   Set the CA revocation path where to find CA CRLs for client
                #   authentication or alternatively one huge file containing all
                #   of them (file must be PEM encoded)
                #   Note: Inside SSLCARevocationPath you need hash symlinks
                #                to point to the certificate files. Use the provided
                #                Makefile to update the hash symlinks after changes.
                #SSLCARevocationPath /etc/apache2/ssl.crl/
                #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl


                #   Client Authentication (Type):
                #   Client certificate verification type and depth.  Types are
                #   none, optional, require and optional_no_ca.  Depth is a
                #   number which specifies how deeply to verify the certificate
                #   issuer chain before deciding the certificate is not valid.
                #SSLVerifyClient require
                #SSLVerifyDepth  10
#   Set various options for the SSL engine.
                #   o FakeBasicAuth:
                #        Translate the client X.509 into a Basic Authorisation.  This means that
                #        the standard Auth/DBMAuth methods can be used for access control.  The
                #        user name is the `one line' version of the client's X.509 certificate.
                #        Note that no password is obtained from the user. Every entry in the user
                #        file needs this password: `xxj31ZMTZzkVA'.
                #   o ExportCertData:
                #        This exports two additional environment variables: SSL_CLIENT_CERT and
                #        SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
                #        server (always existing) and the client (only existing when client
                #        authentication is used). This can be used to import the certificates
                #        into CGI scripts.
                #   o StdEnvVars:
                #        This exports the standard SSL/TLS related `SSL_*' environment variables.
                #        Per default this exportation is switched off for performance reasons,
                #        because the extraction step is an expensive operation and is usually
                #        useless for serving static content. So one usually enables the
                #        exportation for CGI and SSI requests only.
                #   o OptRenegotiate:
                #        This enables optimized SSL connection renegotiation handling when SSL
                #        directives are used in per-directory context.
                #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>


                #   SSL Protocol Adjustments:
                #   The safe and default but still SSL/TLS standard compliant shutdown
                #   approach is that mod_ssl sends the close notify alert but doesn't wait for
                #   the close notify alert from client. When you need a different shutdown
                #   approach you can use one of the following variables:
                #   o ssl-unclean-shutdown:
                #        This forces an unclean shutdown when the connection is closed, i.e. no
                #        SSL close notify alert is send or allowed to received.  This violates
                #        the SSL/TLS standard but is needed for some brain-dead browsers. Use
                #        this when you receive I/O errors because of the standard approach where
                #        mod_ssl sends the close notify alert.
                #   o ssl-accurate-shutdown:
                #        This forces an accurate shutdown when the connection is closed, i.e. a
                #        SSL close notify alert is send and mod_ssl waits for the close notify
                #        alert of the client. This is 100% SSL/TLS standard compliant, but in
                #        practice often causes hanging connections with brain-dead browsers. Use
                #        this only for browsers where you know that their SSL implementation


                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>


                #   SSL Protocol Adjustments:
                #   The safe and default but still SSL/TLS standard compliant shutdown
                #   approach is that mod_ssl sends the close notify alert but doesn't wait for
                #   the close notify alert from client. When you need a different shutdown
                #   approach you can use one of the following variables:
                #   o ssl-unclean-shutdown:
                #        This forces an unclean shutdown when the connection is closed, i.e. no
                #        SSL close notify alert is send or allowed to received.  This violates
                #        the SSL/TLS standard but is needed for some brain-dead browsers. Use
                #        this when you receive I/O errors because of the standard approach where
                #        mod_ssl sends the close notify alert.
                #   o ssl-accurate-shutdown:
                #        This forces an accurate shutdown when the connection is closed, i.e. a
                #        SSL close notify alert is send and mod_ssl waits for the close notify
                #        alert of the client. This is 100% SSL/TLS standard compliant, but in
                #        practice often causes hanging connections with brain-dead browsers. Use
                #        this only for browsers where you know that their SSL implementation
                #        works correctly.
                #   Notice: Most problems of broken clients are also related to the HTTP
                #   keep-alive facility, so you usually additionally want to disable
                #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
                #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
                #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
                #   "force-response-1.0" for this.
                BrowserMatch "MSIE [2-6]" \
                                nokeepalive ssl-unclean-shutdown \
                                downgrade-1.0 force-response-1.0
                # MSIE 7 and newer should be able to use keepalive
                BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown


        </VirtualHost>
</IfModule>


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

#5 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 10:24:41

hamzouz
Les fichiers .crt et .key sont présent dans le répertoire /etc/apache2/ssl
J'ai crée mon certificat, que faut il faire ensuite svp ?

#6 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 09:47:19

hamzouz
Oui, mais il me semble que ce répertoire doit être crée automatiquement lorsque l'on lance la commande certbo-auto non ?
Moi, il me met echec de connexion sur le port 443 et il ne génère aucun certificats nulle part...
Que me conseilles tu stp ? je suis à bout là....

#7 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 08:45:56

hamzouz
le service apache n'arrive pas à redémarrer.... Voici les logs renvoyés

[Thu Jun 15 06:25:04.167263 2017] [mpm_event:notice] [pid 14209:tid 3074565952] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Thu Jun 15 06:25:04.176805 2017] [core:notice] [pid 14209:tid 3074565952] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jun 15 09:45:51.362057 2017] [mpm_event:notice] [pid 14209:tid 3074565952] AH00493: SIGUSR1 received.  Doing graceful restart
AH00112: Warning: DocumentRoot [/var/lib/letsencrypt/tls_sni_01_page/] does not exist
[Thu Jun 15 09:45:51.402253 2017] [ssl:warn] [pid 14209:tid 3074565952] AH01906: 6dfde6ffc09d310919a7eeb31b94bea7.c2b21cdeae0fcb3e3a69c213d1e980dc.acme.invalid:443:0 server certificate is a CA cer$
[Thu Jun 15 09:45:51.402770 2017] [mpm_event:notice] [pid 14209:tid 3074565952] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Thu Jun 15 09:45:51.402808 2017] [core:notice] [pid 14209:tid 3074565952] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jun 15 09:45:58.305453 2017] [mpm_event:notice] [pid 14209:tid 3074565952] AH00493: SIGUSR1 received.  Doing graceful restart
[Thu Jun 15 09:45:58.364167 2017] [mpm_event:notice] [pid 14209:tid 3074565952] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Thu Jun 15 09:45:58.364227 2017] [core:notice] [pid 14209:tid 3074565952] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jun 15 09:57:59.760156 2017] [mpm_event:notice] [pid 14209:tid 3074565952] AH00491: caught SIGTERM, shutting down
[Thu Jun 15 09:58:01.146789 2017] [mpm_event:notice] [pid 15343:tid 3074557760] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Thu Jun 15 09:58:01.147134 2017] [core:notice] [pid 15343:tid 3074557760] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jun 15 10:15:06.485903 2017] [mpm_event:notice] [pid 15343:tid 3074557760] AH00491: caught SIGTERM, shutting down
[Thu Jun 15 10:15:55.579381 2017] [mpm_event:notice] [pid 15524:tid 3074451264] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Thu Jun 15 10:15:55.579736 2017] [core:notice] [pid 15524:tid 3074451264] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jun 15 10:26:16.369921 2017] [mpm_event:notice] [pid 15524:tid 3074451264] AH00491: caught SIGTERM, shutting down

#8 Re : Scripts, programmes et robots » Automatisation de CertBot » 15-06-2017 08:43:29

hamzouz

Configure un virtual host écoutant sur le port 443 (tu peux utiliser l'exemple de base d'apache juste pour vérifier que ça marche)



j'ai configuré mon virtual host comme ci-dessous:

NameVirtualHost 52.17.128.132

<VirtualHost 52.17.128.132:443>
        # The ServerName directive sets the request scheme, hostname and port t$
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName glpi.cefim.eu
        ServerAdmin hlakhal362@gmail.com
        DocumentRoot /var/www/cefim

        SSLEngine on
        SSLCertificateFile /etc/apache2/serv.crt
        SSLCertificateKeyFile /etc/apache2/server.key
 




Cependant, le chemin où sont stocké les certificats, je sais pas quoi mettre exactement....

Après avoir défini le port du virtualhost je redémarre le serveur apache et je test la commande certbot --apache c'est bien ça ?

#9 Re : Scripts, programmes et robots » Automatisation de CertBot » 14-06-2017 15:42:07

hamzouz
Je suis parti vérifier, le site est héberger par AWS et lorsque je me connecte en tant qu'admin, aucune règle de filtrage n'est en place et le port 443 du HTTPS est autoriser.
Mais quand je lance le scan de ports, il me marque "state = closed".... comment c'est possible ?????
Aurais-tu une idée ? Ca commence à faire pas mal de temps que je suis là dessus et je suis persuadé que c'est une petite erreur de rien du tout (comme d'habitude lolilol).

Si tu pouvais m'accompagner sur la démarche à suivre pour la sécurisation d'un site via certbot, ça me rendrait un grand service !

Merciiiiiiii !!!!

#10 Re : Scripts, programmes et robots » Automatisation de CertBot » 13-06-2017 14:13:42

hamzouz
Pauvre entreprise, j'ai envie de dire................ lol:lol::lol:
Merci beaucoup pour ton aide, je vais aller essayer puis je te tiens au courant !

#11 Re : Scripts, programmes et robots » Automatisation de CertBot » 13-06-2017 14:06:59

hamzouz
je vais jeter un oeil au lien que tu m'a donné, c'est gentil de ta part.

L'administrateur, c'est moi depuis 3 mois et encore 1 dernière semaine donc je pense que je vais devoir m'y coller zen.gifzen.gifzen.gif.
Il faut modifier la table de redirections de ports dans l'interface d'administration du routeur c'est bien ça ?

#12 Re : Scripts, programmes et robots » Automatisation de CertBot » 13-06-2017 13:51:57

hamzouz
le port est fermé sur glpi.cefim.eu. Je sais pas comment on fait pour l'ouvrir étant donné que le site est avec une adresse IP publique.
Le serveur web que j'ai utilisé est apache. J'ai ajouté un nouveau vhost en spécifiant servername etc...

Je ne sais vraiment pas d'où vient l'erreur et ça m'énerve légèrement...... scratchhead.gifscratchhead.gifscratchhead.gif

#13 Re : Scripts, programmes et robots » Automatisation de CertBot » 13-06-2017 13:19:20

hamzouz
Encore une fois merci de prendre le temps d'étudier mon problème.

Tu pourrais me dire où est ce qu'on peut vérifier le port 443 ?

PS: le site que je cherche à sécuriser est glpi.cefim.eu et le domaine nous appartenant est cefim.eu

Merci.

#14 Re : Scripts, programmes et robots » Automatisation de CertBot » 13-06-2017 10:35:37

hamzouz
J'ai encore un petit soucis .... lorsque j'essaie de générer un certificat pour le domaine suivant, on me retourne l'erreur ci-dessous.


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


   Domain: glpi.cefim.eu
   Type:   connection
   Detail: Failed to connect to 52.17.128.132:443 for tls-sni-01
   challenge


   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

#15 Re : Scripts, programmes et robots » Automatisation de CertBot » 12-06-2017 13:06:38

hamzouz
Je galère depuis ce matin dessus à tenter de trouver une solution mais je crois que tu as raison, je vais aller en parler au directeur.
Pour l'histoire du LAN, je lui avais dit lorsqu'il m'a confié cette tâche que je ne voyais pas l'intérêt de mettre ça en place pour les équipement réseaux, mais bon....
Je vais rechercher ça de suite, merci beaucoup beaucoup pour le temps que tu m'as accordé.

erreur retourné:

root@CertBot:/usr/local/sbin# certbot-auto --apache certonly -d routeur.cefim.lan
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
An unexpected error occurred:
The request message was malformed :: Error creating new authz :: Name does not end in a public suffix
Please see the logfiles in /var/log/letsencrypt for more details.

#16 Re : Scripts, programmes et robots » Automatisation de CertBot » 12-06-2017 12:05:14

hamzouz
Salut daufinsyd, désolé de ne pas avoir vu plus tôt ta réponse !

Je vais tenter d'expliquer un peu mieux mon problème. Je voudrais permettre la connexion en https à l'interface d'administration du routeur pfsense du réseau local. En fait, quand on tape dans l'URL le lien "https://192.168.1.254:666" le navigateur renvoie le message comme quoi la connexion est risquée. Je voulais donc mettre en place un serveur où est installé dessus apache et certbot et pouvoir envoyer à partir du serveur certbot le certificat dont a besoin le routeur pfsense afin de permettre la connexion en ssl sans le message de risque du navigateur.

Lorsque je rentre la commande qui va bien, on me retourne ce message d'erreur. Il faut obligatoirement acheter un nom de domaine pour pouvoir mettre certbot en place ?

C:\Users\Cefim\Desktop\clé\certbot.PNG

#17 Scripts, programmes et robots » Automatisation de CertBot » 08-06-2017 16:33:06

hamzouz
Réponses : 30
Bonjour tout le monde,

Actuellement en stage de fin d'études en DUT Réseaux & Télécom, le directeur de la boîte m'a demandé d'installer un système Debian sur un serveur. Ce serveur doit générer et stocker les certificats pour la mise en place de connexions HTTPS au sein du réseau local (pour accéder à l'interface web d'administration des équipements réseau par exemple). Mon tuteur m'a parlé de l'outil CertBot qui fonctionne avec un serveur web et une crontab en gros, d'après ce que j'ai saisi......
J'ai bien installé le système et le serveur web apache et crontab. j'ai autorisé le ssl sur apache, etc...
La question que je me pose c'est de savoir s'il serait possible d'automatiser CertBot. Je cherche à savoir si il est possible d'envoyer les certificats stockés sur le serveur aux équipements qui en ont besoin ?
Ou bien il est obligatoire d'installer CertBot sur les équipement que l'on veut sécuriser ??

En espérant que vous aurez bien compris mon problème, je vous souhaite tous une excellente soirée.

PS: j'aimerais bien régler ce problème au plus vite étant donné que mon stage s'arrête dans 2 semaines. Merci d'avance.

Pied de page des forums

Propulsé par FluxBB