#
# EXEMPLE DE FICHIER DE CONFIGURATION OPENSSL POUR UN CA OUVERT
# MODIF IMCP imcp.ba@trousperdu.org imcp.ba@free.fr
# Ce fichier de configuration est le fichier de base de openssl
# legerement modifie (le minimum) et commente pour les besoins du CA libre :
# modifie cote CA : pour gerer les certifications
# modifie cote Clients ; pour faire des demandes de CSR codees par mails .
# Beaucoup de sections sont specialisees; Mais ce fichier peut
# etre utilise comme fichier de configuration openssl par defaut,
# par un client qui genere un CSR ou faire le TP
# (qui peut le plus, peut le moins !)
# Lire en premiere approche la section [ req_distinguished_name ]
# Procedure avec openssl sous linux :
#
# creer un directory de travail par exemplee
# mkdir BLIbCA;
# cd BLIbCA; # ce placer dedans
# Copier coller ce fichier dans votre directory de travail
# sous le nom "caconfig"
#
# Dans votre shell tapper la commande
# export OPENSSL_CONF="caconfig";
# avant de lancer les commandes openssl
# du TP de certification de ce site.
# utiliser
# grep -v -e "^#" caconfig | uniq
#
# pour extraire les lignes actives
#####################################################################################
# Historiquement la distinction
# entre une requette csr : req
# et un certifcat : ca
# n'est pas toujours evidante.
# Certains auteurs apellent les csr (demande de certification)
# des certificats temporaires (car pas encore signe)
# De plus, ayant le certificat, on peut en extraire le CSR (si on a garde la clef)
# Dans cette documentation on doit faire attention aux termes utilise !
#####################################################################################
#####################################################################################
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
#####################################################################################
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
# Extra OBJECT IDENTIFIER info:
#oid_file = $ENV::HOME/.oid
oid_section = new_oids
# To use this configuration file with the "-extfile" option of the
# "openssl x509" utility, name here the section containing the
# X.509v3 extensions to use:
# extensions = ...
#
# (Alternatively, use a configuration file that has only
# X.509v3 extensions in its main [= default] section.)
# DANS LE SCRIP BASH ecrire
#export OPENSSL_CONF="$dirsource/caconfig"; #le nom de ce fichier
###########################################################
# comment verifier un certificat par rapport au certificat du CA
#openssl verify -CAfile cacert.pem trucaverifier.crt
######################################################################################################
# Les [SECTION] sont definies pour eviter de passer trop de parametres a openssl !
# c'est fait pour SIMPLIFIER ecriture des commandes !!!!!
# DANS LE SCRIP ecrire :
# export OPENSSL_CONF="$dirsource/ca-config"; #le nom de ce fichier
# Pour changer le fichier de configuration par defaut, on utilise aussi option
# "-config ca-config" le nom du fichier de configuration
#
# Pour passer une section a ssl on utilise option
# "-extensions v3_ca" le nom de la section definie dans le fichier de conf
# "-policy policy_anything"
# Mais cela depend de la commande de basse ssl : ca req ...
# SECTION
# autre notations pour les string :
# basicConstraints=critical,CA:true,pathlen:1
# est equivalent a
# basicConstraints=critical,@bs_section
# [bs_section]
# CA=true
# pathlen=1
# ( @nomsection s'utilise comme une macro )
# les differentes Secrions peuvent faire referance les une aux autres, comme une arboresance
# utiliser la commande
# grep -SECTION caconfig
# pour visualiser les liens entre sections
#############################################################################################
[ new_oids ] ##### SECTION : OBJECT IDENTIFIER
# We can add new OIDs in here for use by 'ca' and 'req'.
# Add a simple OID like this:
# testoid1 = 1.2.3.4
# Or use config file substitution like this:
# testoid2 = ${testoid1}.5.6
#############################################################################################
[ ca ] ##### SECTION utilise dans "openssl ca " gestion des certificat
default_ca = CA_default # The default_ca section
# est le nom de la section si rien n'est specifie
# override : l'option "-name autresection" est prioritaire
#############################################################################################
[ CA_default ] ##### SECTION voir precedament [ ca ]
# LOCALISER LE SYSTEME DE FICHIER ET LES NOMS DE FICHIERS UTILISES "PAR DEFAUT"
#Directory de travail
#dir = ./demoCA # Where everything is kept
#dir = /root/cablib # ici est pas ailleur
dir = . # le CA courant est dans le directory de travail #MC
# du cote des certificats des clients
certs = $dir/certs # Where the issued certs are kept copie par hashDN.0 name #MC
crl_dir = $dir/crl # Where the issued crl are kept REVOCATION #MC
database = $dir/index.txt # database index file.
new_certs_dir = $dir/newcerts # default place for new certs. copie par serial name #MC
# Si vous voulez vraiment que des certificats de meme DN (dinstinguis name)
# differents puissent etre edites
# decommente la ligne suivante :
#(voir fichier index.txt.attr)
unique_subject = no # Set to 'no' to allow creation of (voir index.txt.att !!!!)
# several certificates with same subject.
#du cote du CA
certificate = $dir/cacert.pem # The CA certificate
serial = $dir/serial # The current serial number
#crlnumber = $dir/crlnumber # the current crl number #MC mis en commentaire !!!!!!
# must be commented out to leave a V1 CRL
crl = $dir/crl.pem # The current CRL
private_key = $dir/private/cakey.pem # The private key ; CHMOD 0600 : not READ
#le HAZARD
RANDFILE = $dir/private/.rand # private random number file #MC ???
#les extension son variees on dinstingue ici deux types USERE ou CA ??? AUTOSIGNE ou pas
x509_extensions = usr_cert # ???? NF # The extentions to add to the cert (de type user : PAR DEFAUT)
# On est dans "opensssl req -x509" (gestion des certificats autosignes);
# # X509_extensions != extensions != x509_extensions
# # si On est dans "opensssl CA" (gestion des certificats normaux);
# # On est dans "opensssl CA -new -x509" (gestion des certificats de la base);
# # pour certifier un autre ca utiliser l'option override :
# # -extensions v3_ca ... !!!
# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt = ca_default # Subject Name options (ca_ Minuscules !!!! ?) #MC
cert_opt = ca_default # Certificate field options (ca_ Minuscules !!!! ?) #MC
# 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
# Duree de vie des certificats :
default_days = 365 # how long to certify for (en mode general)
default_crl_days = 30 # how long before next CRL
default_md = sha1 # which md to use. #MC sha1 20 octets
preserve = no # keep passed DN ordering
# Pour valider un csr, le CA peut exiger un certains nombre de champs
# dans le DN !
# la police defini, dans l'espace de nomage, ce qui est indispensable
# est qui doit etre controle(match) et le reste
# ( les valeurs par defaut sont determinees ailleurs ...)
#
# la ligne suivante definit la police par defaut a utiliser :
# 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 #choix par defaut (en mode certifier : un [autre] CA)
# (override by -policy namepolicy)
#############################################################################################
# For the CA policy
[ policy_match ] ##### SECTION voir precedament [ CA_default ]
countryName = match # match :doit correspondre
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
#############################################################################################
# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ] ##### SECTION
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
#############################################################################################
[ req ] ##### SECTION utilise dans "openssl req" gestion des CSR
# dans le cas ou on fabrique une clef privee en meme temps !!!
default_bits = 1024 # * key taille !!!
default_keyfile = privkey.pem # * name of generated keys !!!
#default_md = md5 #MC [req] # * message digest algorithm !!!
# * les lignes precedentes sont la, dans le cas ou on fabrique une clef privee en meme temps !!!
distinguished_name = req_distinguished_name #la description par defaut du DN a utiliser
attributes = req_attributes
x509_extensions = v3_ca # The extentions to add to the self signed cert [ REQ ](SI AUTO => DE TYPE CA !!)
# on est dans "openssl REQ" gestion des csr special
# : openssl req -new -x509 (creation ca autosigne)
# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret
# Quel code caracteres peut on mettre a interieur du DN :
#
# This sets a mask for permitted string types. There are several options.
# default: PrintableString, T61String, BMPString.
# pkix : PrintableString, BMPString.
# utf8only: only UTF8Strings.
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
# so use this option with caution!
string_mask = nombstr
# l'option par defaut suivant a etait mise en commentaire car imcompatible avec la certification
# d'un autre CA ; donc, dans les commandes, openssl ca, on specifis toujours l'extension ( $extra )
# req_extensions = v3_req # The extensions to add to a certificate request (incompatible AUTO !!!) #MC
# pour les requettes clients precisser
# (openssl ca -policy policy_anything -extensions v3_req)
# openssl req -reqexts normal
# pour les requette d'un autre ca utiliser v3_ca
# (deja inclu dans extensions X509 pour ca auto signe)
#############################################################################################
# Cette section est celle qui definie le dialogue avec le demandeur
# pour etablir un CSR (openssl req -new ....)
#
# On peut etablir plusieurs sections de ce types
# pour differant type de questionnaires clients :
# la sectionn utilise par defaut est nome dans le section REQ precedante
# dans la variable distinguished_name
#
[ req_distinguished_name ] ##### SECTION voir [ req ]
countryName = Pays (C): Country Name (2 letter code)
countryName_default = FR # LP #LIBRE PAYS
countryName_min = 2
countryName_max = 2
stateOrProvinceName = Etat ou province (ST): State or Province Name (full name)
stateOrProvinceName_default = MIDI-PYRENEES
localityName = Ville ou localitee (L): Locality Name (eg, city)
localityName_default = UN BLED POMME
0.organizationName = Organisation (O): Organization Name (eg, company)
0.organizationName_default = LES GESTIONNAIRES DU COIN PERDU
# we can do this but it is not needed normally :-)
#1.organizationName = Second Organization Name (eg, company)
#1.organizationName_default = LiberteOCulte
organizationalUnitName = Unitee (OU): Organizational Unit Name (eg, section)
organizationalUnitName_default = http://imcp.ba.free.fr/cours/savebox
#organizationalUnitName_default = http://www.trousperdu.org
commonName = Nom (CN): Common Name (eg, YOUR name) # ou url exacte pour un serveur SSL/TLS
commonName_default = LA DEBROUILLE
commonName_max = 64
emailAddress = Email (E): Email Address
emailAddress_max = 64
#option "-batch" le certificat est signe sans qu'aucune question ne soit posee.
#
# Une autre methode pour ne pas avoir de question
# est de donner, a openssl req, le DN sous forme implicite d'une string
# -subj '/C=LP/ST=etat/0U=http:\/\/.......'
# SET-ex3 = SET extension number 3
#############################################################################################
[ req_attributes ] #### SECTION #EXTRA pour les modes automatique de connection : SSH ....
challengePassword = A challenge password (pour SSH ....) #MC [ req_attributes ]
challengePassword_mi = 4
challengePassword_max = 20
unstructuredName = An optional company name
#############################################################################################
[ usr_cert ] #### SECTION (exemple generique) a adapte pour certifier : les user; le cas autosigne x509_extension n'est pas definis pour utilisee
# These extensions are added when 'ca' signs a request.
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints = CA:FALSE
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# ( Ne rien mettre pour les avoirs tous ...)
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox
nsComment = "Certificat user_cert genere par CA libre BLib" #MC [ usr_cert ]
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier = hash #MC [ usr_cert ] ( hash ou hexa string value)
authorityKeyIdentifier = keyid,issuer #MC [ usr_cert ] keyid,issuer:always
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName = email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName = email:move
# Copy subject details
# issuerAltName = issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
############################################################################################
# LISTE DES SECTIONS REELES DIPONIBLES POUR CERTIFIER DIFFERENT CAS :
#############################################################################################
[ v3_req ] #### SECTION standard user (a utiliser en req -extensions v3_req) (-reqexts)
# Extensions to add to a certificate request # ?? les deux !
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment #MC [ v3_req ] ne rien mettre => tout
nsComment = "Certificat user genere par CA libre BLib" #MC [ v3_req ] ajout
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier = hash #MC [ v3_req ] ajout certificat : X509v3 Subject Key Identifier 20 octets
authorityKeyIdentifier = keyid,issuer #MC [ v3_req ] ajout certificat : X509v3 Authority Key Identifier
#MC issuer ?
#Utilisation du Subject Alternative Name (SAN) !!!!!!!!!!!!!!!
#subjectAltName = @alt_names
#############################################################################################
[ v3_ca ] #### SECTION (a utiliser en REQ -extensions v3_ca) (deja inclue dans X509 si auto signe !)
# Extensions for a typical CA # autosigne ou pas
# PKIX recommendation.
subjectKeyIdentifier = hash #MC [ v3_ca ] ( hash ou hexa string value)
#authorityKeyIdentifier = keyid:always,issuer:always #MC [ v3_ca ] :alway => indispensable; sinon erreur !
#authorityKeyIdentifier = keyid,issuer:always #MC [ v3_ca ] pour un sous ca
authorityKeyIdentifier = keyid,issuer #MC [ v3_ca ] pour TEST KOKKK
# This is what PKIX recommends but some broken software chokes on critical
# extensions.
#basicConstraints = critical,CA:true #MC [ v3_ca ] pour un sous ca
# So we do this instead.
basicConstraints = CA:true #MC [ v3_ca ] pour ca
# basicConstraints = CA:true,pathlen:5 nombre de niveau de sous ca possible
# Key usage: this is typical for a CA certificate. However since it will
# prevent it being used as an test self-signed certificate it is best
# left out by default.
# keyUsage = cRLSign, keyCertSign
# Some might want this also
# nsCertType = sslCA, emailCA
# nsCertType = sslCA, emailCA, objCA #MC [ v3_ca ]
nsComment = "Certificat CA genere par CA libre BLib" #MC [ v3_ca ]
# Include email address in subject alt name: another PKIX recommendation
# subjectAltName = email:copy
# Copy issuer details
# issuerAltName = issuer:copy
# DER hex encoding of an extension: beware experts only!
# obj = DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints = critical, DER:30:03:01:01:FF
#############################################################################################
[ crl_ext ] #### SECTION pour revocation !!
# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
# issuerAltName = issuer:copy
authorityKeyIdentifier = keyid:always,issuer:always #MC [ crl_ext ]
#############################################################################################
[ proxy_cert_ext ] #### SECTION pour proxy certificat !!
# These extensions should be added when creating a proxy certificate
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints = CA:FALSE # dans [ proxy_cert_ext ]
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox.
nsComment = "Certificat proxy genere par CA libre BLib" #MC [ proxy_cert_ext ]
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier = hash #MC [ proxy_cert_ext ]
authorityKeyIdentifier = keyid,issuer:always #MC [ proxy_cert_ext ]
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName = email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName = email:move
# Copy subject details
# issuerAltName = issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
# This really needs to be in place for it to be a proxy certificate.
proxyCertInfo = critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo #MC [ proxy_cert_ext ]
#############################################################################################
# Copier coller le texte qui precede, dans cet encadre,
# pour obtenir votre fichier de configuration caconfig pret a l'emploi !
# Retour a la page d'appel du web miroir courant
#
# IMCP imcp.ba@trousperdu.org imcp.ba@free.fr
|