Cria-se os certificados com o comando, onde precisará responder algumas configurações básicas de informações do mesmo:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crtNecessário criar um novo arquivo de parametros do SSL com o comando
sudo nano /etc/apache2/conf-available/ssl-params.confe colocar as seguintes informações neste arquivo recem criado
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
No arquivo /etc/apache2/sites-available/default-ssl.conf é necessário substituir estas linhas:
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.keyPor estas:
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.keySe o firewall estiver ativo, é necessário fazer alguns ajustes. Para conferir seu status, execute:
sudo ufw statusAtive alguns modulos do Apache:
sudo a2enmod sslPara conferir se o Apache foi corretamente configurado, execute
sudo a2enmod headers
sudo a2ensite default-ssl
sudo a2enconf ssl-params
sudo apache2ctl configtestSe tudo estiver certo, deve ter como resposta a seguinte mensagem:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message Syntax OKFeito tudo isto, basta reiniciar o Apache:
sudo systemctl restart apache2fonte: https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-18-04
Nenhum comentário:
Postar um comentário