IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Sécurité Discussion :

Authentification client ssl


Sujet :

Sécurité

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre chevronné

    Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2009
    Messages
    377
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Novembre 2009
    Messages : 377
    Par défaut Authentification client ssl
    Bonjour,

    je suis en train d'avoir des maux de tête avec une authentification cliente sur un serveur Glassfish v.3

    Voici ce que j'ai fait :
    - J'ai générer une CA et un certificat client (donc signé par la CA).
    - Import du certif client dans firefox
    - Configuration de Glassfish pour demander l'authentification cliente
    - Import de la CA dans le ficheir cacert.jks de glassfish avec la commande suivante :

    Import New CA into Trusted Certs

    keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts
    Ce qui se passe :
    - L'échange ssl se passe bien, le serveur demande au client son certificat, celui-ci l'envoie. Mais le serveur ferme directement la connexion (reset tcp).

    Ce que j'ai observé :

    - Si je place le certificat client dans le jks et non celui de la CA cela fonctionne.

    J'ai contrôlé :

    Le certificat est bien dans le .jks avec la commande :

    keytool -list -v -keystore cacert.jks
    Nom d'alias : rootrainbowca
    Date de création : 19 sept. 2013
    Type d'entrée*: trustedCertEntry

    Propriétaire : CN=RootRainbowCA, O=test, L=Swiss, ST=Swiss, C=CH
    Emetteur : CN=RootRainbowCA, O=test, L=Swiss, ST=Swiss, C=CH
    Numéro de série : ee32855de951fd43
    Valide du : Thu Sep 19 08:52:01 CEST 2013 au : Sun Sep 17 08:52:01 CEST 2023
    Empreintes du certificat :
    MD5: CE:9B:38:2D:FA:28:B7:24:B6D:B6:A4:90:65:36:75
    SHA1 : E9:16:2C5:59:8C:35:4C4:85:46:5F:C4:C4:36:8D:A2:043:15
    SHA256 : 4D:688:81:10:68:B9:1D:74:CD:31:0B:3B:F1:4D:0F:BE:28:C5:34:E3:28:12:0F:7C:BF:AB:8F:755:85:09
    Nom de l'algorithme de signature : SHA1withRSA
    Version : 1
    Tester que le certificat est bien signé par la CA :

    openssl verify -CAfile rootrainbow.crt rainbox6.crt
    -> OK


    J'ai aussi remarqué que lorsque j'ouvre le keystore avec un keytool UI j'ai 3 colonnes :
    - valid date
    - self-signed
    - trusted C.A

    Et que le trusted C.A. n'est pas coché pour ma CA. Je pense que le soucis viens de la.. mais aucune option pour la cocher et en ligne de commande il me semble que j'utilise la bonne commande

    [EDIT]
    J'ai ajouté ma CA dans java/jdk/security/lib/cacert et maintenant il est bien coché.

    J'ai finalement ajouter ma ca un peu partout :
    - Centre de certificat windows
    - /java/jdk/jre/lib/security/cacert
    - /java/jre/lib/security/cacert
    [/EDIT]

    Merci de votre aide

  2. #2
    Membre chevronné

    Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2009
    Messages
    377
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Novembre 2009
    Messages : 377
    Par défaut
    Et mes scripts pour la création de la CA :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    #!/bin/sh
    
    
    #### Create the root CA.....
    
    base="/etc/ssl/private"
    
    # Generate the key.
    sudo openssl genrsa -out /etc/ssl/private/caSwiss.key 2048
    
    # Generate a certificate request.
    sudo openssl req -new -key /etc/ssl/private/caSwiss.key -out /etc/ssl/private/caSwiss.csr -config /etc/ssl/openssl.cnf -subj "/C=CH/ST=Swiss/L=Swiss/O=Swiss/CN=RootRainbow"
    
    # Self sign root key.
    sudo openssl x509 -trustout -req -days 3650 -in /etc/ssl/private/caSwiss.csr -signkey /etc/ssl/private/caSwiss.key -out /etc/ssl/private/caSwiss.crt

    Et pour les certificats :.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    #!/bin/sh
    # The base of where our SSL stuff lives.
    base="/etc/ssl/private"
    # Were we would like to store keys... in this case we take the username given to us and store everything there.
    mkdir -p $base/users/$1/
    
    
    echo "\n[+] gen key"
    # Let's create us a key for this user... yeah not sure why people want to use DES3 but at least let's make us a nice big key.
    openssl genrsa -des3 -out $base/users/$1/$1.key 2048
    
    #echo "\n[+] Do requset"
    
    # Create a Certificate Signing Request for said key.
    openssl req -new -key $base/users/$1/$1.key -out $base/users/$1/$1.csr -config /etc/ssl/openssl.cnf -subj "/C=CH/ST=Swiss/L=Swiss/O=Swiss/CN=rainbow"
    
    #echo "\n[+] Sign with CA"
    
    
    # Sign the key with our CA's key and cert and create the user's certificate out of it.
    openssl ca -in $base/users/$1/$1.csr -cert $base/caSwiss.crt -keyfile $base/caSwiss.key -out $base/users/$1/$1.crt -config /etc/ssl/openssl.cnf
    
    echo "\n[+] do pkcs12"
    
    # This is the tricky bit... convert the certificate into a form that most browsers will understand PKCS12 to be specific.
    # The export password is the password used for the browser to extract the bits it needs and insert the key into the user's keychain.
    # Take the same precaution with the export password that would take with any other password based authentication scheme.
    sudo openssl pkcs12 -export -clcerts -in $base/users/$1/$1.crt -inkey $base/users/$1/$1.key -out $base/users/$1/$1.p12
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    ####################################################################
    [ ca ]
    default_ca	= root_rainbow		# The default ca section
    
    ####################################################################
    [ root_rainbow ]
    
    dir				= /etc/ssl/			# Where everything is kept.
    database		= $dir/index.txt			# database index file.s.
    serial			= $dir/serial 				# The current serial number.
    private_key		= $dir/private/caSwiss.key	# The private key.
    
    certs			= $dir/certs				# Where the issued certs are kept.
    crl_dir			= $dir/private/crl			# Where the issued crl are kept.
    certificate		= $dir/private/caSwiss.crt	# The CA certificate.
    new_certs_dir	= $dir						# Default place for new certs.
    policy			= policy_match				# Set the policys to use.
    
    
    #unique_subject	= no					# Set to 'no' to allow creation of
    										# several ctificates with same subject.
    
    #crlnumber	= $dir/crlnumber			# the current crl number
    										# must be commented out to leave a V1 CRL
    #crl			= $dir/crl.pem 				# The current CRL
    
    #RANDFILE	= $dir/private/.rand		# private random number file
    
    #x509_extensions	= usr_cert				# The extentions to add to the cert
    
    # Comment out the following two lines for the "traditional"
    # (and highly broken) format.
    name_opt 	= ca_default		# Subject Name options
    cert_opt 	= ca_default		# Certificate field options
    
    # Extension copying option: use with caution.
    # copy_extensions = copy
    
    # Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
    # so this is commented out by default to leave a V1 CRL.
    # crlnumber must also be commented out to leave a V1 CRL.
    # crl_extensions	= crl_ext
    
    default_days	= 3650			# how long to certify for
    default_crl_days= 30			# how long before next CRL
    default_md	= sha1			# which md to use.
    preserve	= no			# keep passed DN ordering
    
    # A few difference way of specifying how similar the request should look
    # For type CA, the listed attributes must be the same, and the optional
    # and supplied fields are just that :-)
    policy		= policy_match
    
    # For the CA policy
    [ policy_match ]
    countryName				= match
    stateOrProvinceName		= match
    organizationName		= match
    organizationalUnitName	= optional
    commonName				= supplied
    emailAddress			= optional

  3. #3
    Membre chevronné

    Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2009
    Messages
    377
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Novembre 2009
    Messages : 377
    Par défaut
    Après quelques heures de débogages :

    #!/bin/sh

    #### Create the root CA.....
    base="/etc/ssl/private"

    # Generate the key.
    sudo openssl genrsa -out /etc/ssl/private/caSwiss.key 2048

    # Test .
    openssl req -new -x509 -days 3650 -key /etc/ssl/private/caSwiss.key -out /etc/ssl/private/caSwiss.crt -subj "/C=CH/ST=Fribourg/L=Fribourg/O=Swiss/CN=RootRainbow"

    Le problème venait du faite que je n'avais pas l'option x509 activé pour ma CA. Apparemment openssl est plus "concilliant" que mon glassfish.

    Pour rappel un certificat racine root est un certificat x509 auto-signé.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Authentification client SSL - chaîne de certificats
    Par Nounourson dans le forum Tomcat et TomEE
    Réponses: 0
    Dernier message: 11/07/2009, 00h01
  2. Authentification client SSL
    Par ahulane dans le forum Tomcat et TomEE
    Réponses: 1
    Dernier message: 15/05/2007, 14h03
  3. [RESEAU] Authentification client linux sur serveur windows
    Par rvfranck dans le forum Windows Serveur
    Réponses: 1
    Dernier message: 19/06/2006, 18h57
  4. Authentification client linux sur serveur windows
    Par rvfranck dans le forum Réseau
    Réponses: 4
    Dernier message: 19/06/2006, 07h27
  5. [JBoss][Jaas] Authentification client standalone
    Par mauvais_karma dans le forum Wildfly/JBoss
    Réponses: 5
    Dernier message: 18/05/2005, 11h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo