You are on page 1of 3

Laboratorio Servidor web Apache

avanzado
Resoluciones

Certificados SSL
 

1. Crear certificado auto firmado para el sitio hosting-avanzado.intranet .

Crear directorios private y certs .

# cd /etc/apache2
# mkdir -p ssl/private ssl/certs

Creación de certificados.

# openssl \
req -x509 \
-nodes \
-days 1095 \
-newkey rsa:4096 \
-keyout /etc/apache2/ssl/private/hosting-avanzado.intranet.key \
-out /etc/apache2/ssl/certs/hosting-avanzado.intranet.crt

Complete los campos.

Generating a RSA private key


.............................+++++
.+++++
writing new private key to '/etc/apache2/ssl/private/hosting-
avanzado.intranet.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a
DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:AR
State or Province Name (full name) [Some-State]:BuenosAires
Locality Name (eg, city) []:Ciudad
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Hosting
Avanzado
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:hosting-avanzado.intranet
Email Address []:admin@hosting-avanzado.intranet
Nota: Puede modificar la información según su conveniencia.

2. Active el módulos ssl y headers .

Activar módulo.

# a2enmod ssl
# a2enmod headers
# systemctl reload apache2

3. Añada al servidor ajustes de seguridad para el manejo de certificados SSL.

Fichero /etc/apache2/conf-available/ssl-params.conf

SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder On
# Disable preloading HSTS for now. You can use the commented out header
line that includes
# the "preload" directive if you understand the implications.
# Header always set Strict-Transport-Security "max-age=63072000;
includeSubDomains; preload"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
# Requires Apache >= 2.4
SSLCompression off
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
# Requires Apache >= 2.4.11
SSLSessionTickets Off

Activar las nuevas configuraciones.

# a2enconf ssl-params.conf
# systemctl reload apache2

4. Configure el sitio hosting-avanzado.intranet para usar ssl .

Fichero sites-available\hosting-avanzado.intranet.conf .

La directiva Redirect redirige todas las peticiones al puerto 443 correspondiente a


ssl .

<VirtualHost *:80>

ServerAdmin webmaster@localhost
ServerName hosting-avanzado.intranet
Serveralias www.hosting-avanzado.intranet
Redirect "/" "https://hosting-avanzado.intranet
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Fichero sites-available\hosting-avanzado.intranet.ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@hosting-avanzado.intranet
      ServerName hosting-avanzado.intranet

      DocumentRoot /var/www/hosting-avanzado.intranet

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

      SSLEngine on

      SSLCertificateFile /etc/apache2/ssl/certs/hosting-
avanzado.intranet.crt
      SSLCertificateKeyFile /etc/apache2/ssl/private/hosting-
avanzado.intranet.key

              <FilesMatch "\.(cgi|shtml|phtml|php)$">
                      SSLOptions +StdEnvVars
              </FilesMatch>
              <Directory /usr/lib/cgi-bin>
                      SSLOptions +StdEnvVars
              </Directory>
      </VirtualHost>
</IfModule>

Activar sitio.

# a2ensite hosting-avanzado.intranet.ssl.conf
# systemctl reload apache2

5. Compruebe el acceso al sitio mediante navegador web.

URL: http://hosting-avanzado.intranet

Nota: El navegador puede informar sobre la procedencia del certificado y darnos a optar por
elegir entrar al sitio, esto es por que el certificado es auto firmado y no esta avalado por
alguna autoridad certificadora reconocida por los navegadores web.

You might also like