Diferencia entre revisiones de «Entidad Certificadora en Ubuntu Server»

De Ardemans Wiki
Saltar a: navegación, buscar
(Entidad Certificadora en Ubuntu Server)
(Generando certificado Raíz)
Línea 80: Línea 80:
 
</pre>
 
</pre>
  
Nos hará una serie de preguntas sobre el certificado. En el common name damos el nombre que queremos que aparezca como entidad certificadora
+
Nos hará una serie de preguntas sobre el certificado. En el common name damos el nombre que queremos que aparezca como entidad certificadora.
 +
 
 +
Después copiamos los ficheros resultantes en el lugar que hemos especificado en el fichero de configuración.
 +
 
 +
<pre>
 +
# mv ArdemansCA.pem certs
 +
# mv ArdemansCAkey.pem private
 +
</pre>

Revisión de 13:46 27 abr 2012

Entidad Certificadora en Ubuntu Server

Existe ya un documento de Ubuntu que lo explica muy bien, pero como apunte personal voy a describir aquí los pasos que he seguido yo para tener una entidad certificadora propia.

También se puede consultar esta otra página de ubuntu explicando el uso de Open SSL

Instalación de paquetes necesarios

En realidad, solo he tenido que instalar el paquete openssl en mi ubuntu server 10.04LTS

Preparando los directorios de la CA

Toda la configuración se encuentra en el fichero /etc/ssl/openssl.cnf. Antes de tocar nada ahí he creado los siguientes directorios (si no lo estaban ya)

/etc/ssl/CA
/etc/ssl/certs
/etc/ssl/crl
/etc/ssl/newcerts
/etc/ssl/private

Configuración de SSL

El fichero de configuración de SSL queda como sigue:

####################################################################
[ ca ]
default_ca      = CA_Ardemans           # The default ca section

####################################################################
[ CA_Ardemans ]

dir             = /etc/ssl                              # Where everything is kept
certs           = $dir/certs                            # Where the issued certs are kept
crl_dir         = $dir/crl                              # Where the issued crl are kept
database        = $dir/CA/index.txt                     # database index file.
#unique_subject = no                                    # 'no' to allow creation ctificates with same subject.
new_certs_dir   = $dir/newcerts                         # default place for new certs.
certificate     = $dir/certs/ArdemansCA.pem             # The CA certificate
serial          = $dir/CA/serial                        # The current serial number
crlnumber       = $dir/crlnumber                        # current crl number must be commented out to leave a V1 CRL
crl             = $dir/crl.pem                          # The current CRL
private_key     = $dir/private/ArdemansCAkey.pem        # The private key
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    = 365                   # 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

Generando certificado Raíz

En nuestro caso este no será más que un certificado autofirmado, que podremos generar con el siguiente comando:

# openssl req -x509 -new -newkey rsa:2048 -keyout ArdemansCAkey.pem -out ArdemansCA.pem -days 3650

Nos hará una serie de preguntas sobre el certificado. En el common name damos el nombre que queremos que aparezca como entidad certificadora.

Después copiamos los ficheros resultantes en el lugar que hemos especificado en el fichero de configuración.

# mv ArdemansCA.pem certs
# mv ArdemansCAkey.pem private