| At line 2 added 5 lines |
|
| [{TableOfContents }] |
|
|
|
| At line 3 changed one line |
| apache2.conf aggiungere/modificare : |
| apache2.conf (o httpd.conf se incluso in apache2.conf) aggiungere/modificare : |
| At line 24 added one line |
| !! Attivazione disattivazione moduli |
| At line 20 changed one line |
| !! accesso sicuro SSL |
| Esistono molti moduli aggiuntivi per il server apache (ssl, php, jk ecc.ecc.) |
| Il primo passo è naturalmente controllare se il modulo è già presente ed è già attivo eventualmente scaricare la versione adatta alla versione del server. I moduli già disponibili si trovano nella directory mods-avalable. |
|
| Per attivare/disattivare un modulo: |
|
| %%prettify |
| {{{ |
| # a2enmod ssl <-- abilita il modulo creando i link simbolici nella cartella mods-enabled |
| # a2dismod ssl <-- disabilita il modulo |
| }}} |
|
|
| !! Accesso sicuro SSL |
| Il primo requisito è possedere i file con la chiave del server e il certificato. |
| nel nostro esempio i file si trovano in /root/sec/selfsigned-cert.pem e /root/sec/rsa-private-key.pem. |
| [Come ottenere/creare i certificati|x509] |
|
| ! Modulo ssl |
| At line 27 changed one line |
| in apache2.conf impostare |
| in apache2.conf (o httpd.conf se incluso in apache2.conf) impostare |
| At line 37 changed 2 lines |
| i file virtualhost devono includere le chiamate al servizio ssl |
| esempio 1 : sito intermanete SSL |
| I file virtualhost devono includere le chiamate al servizio ssl. |
| At line 62 added one line |
| Esempio 1 : sito interamente SSL |
| At line 43 removed one line |
|
| At line 51 removed one line |
|
| At line 54 removed one line |
|
| At line 76 added 32 lines |
| UseCanonicalName Off |
| ServerSignature On |
| # Force clients from the Internet to use HTTPS |
| RewriteEngine on |
| RewriteRule ^/$ https://www.nostrosito.it/ [R] |
| </VirtualHost> |
| <VirtualHost qui:443> |
| ServerAdmin log@telnext.it |
| ServerName www.nostrosito.it |
| DocumentRoot /home/www/www.nostrosito.it/htdocs/ |
| # Per tomcat |
| JkMount /*.jsp wrkr |
| JkMount /servlet/* wrkr |
| JkMount /manager/* wrkr |
| ErrorLog /home/www/www.nostrosito.it/logs/error_log |
| CustomLog /home/www/www.nostrosito.it/logs/access_log combined |
| HostnameLookups Off |
| UseCanonicalName Off |
| ServerSignature On |
| <Directory "/home/www/www.nostrosito.it/htdocs/"> |
| Options Indexes FollowSymLinks |
| AllowOverride None |
| Order allow,deny |
| Allow from all |
| </Directory> |
| SSLEngine on |
| SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL |
| SSLCertificateFile /root/sec/selfsigned-cert.pem |
| SSLCertificateKeyFile /root/sec/rsa-private-key.pem |
| </VirtualHost> |
| }}} |
| /% |
| At line 109 added 14 lines |
| Esempio 2 : sito solo in parte SSL nel nostro esempio tutto il contenuto della directory denominata 'protected' |
| %%prettify |
| {{{ |
| <VirtualHost qui:80> |
| ServerAdmin log@telnext.it |
| ServerName www.nostrosito.it |
| DocumentRoot /home/www/www.nostrosito.it/htdocs |
| # Per tomcat |
| JkMount /*.jsp wrkr |
| JkMount /servlet/* wrkr |
| JkMount /manager/* wrkr |
| ErrorLog /home/www/www.nostrosito.it/logs/error_log |
| CustomLog /home/www/www.nostrosito.it/logs/access_log combined |
| HostnameLookups Off |
| At line 59 changed 5 lines |
| <Directory "/home/www/www.vaol.it/htdocs/protected"> |
| #SSLEngine on |
| #SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL |
| #SSLCertificateFile /root/sec/selfsigned-cert.pem |
| #SSLCertificateKeyFile /root/sec/rsa-private-key.pem |
| <Directory "/home/www/www.nostrosito.it/htdocs/protected"> |
| At line 66 changed 7 lines |
| RewriteRule ^/$ https://www.vaol.it/ [R] |
| #RewriteEngine on |
| #RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.[0-9]+$ |
| #RewriteCond %{HTTPS} !=on |
| #RewriteRule .* - [F] |
| #Order deny,allow |
| #Allow from all |
| RewriteRule ^/$ https://www.nostrosito.it/ [R] |
| |
| At line 74 changed one line |
| <Directory "/home/www/www.vaol.it/htdocs/"> |
| <Directory "/home/www/www.nostrosito.it/htdocs/"> |
| At line 81 removed one line |
|
| At line 84 changed 6 lines |
| ServerName www.vaol.it |
|
| # DocumentRoot: The directory out of which you will serve your |
| # documents. By default, all requests are taken from this directory, but |
| # symbolic links and aliases may be used to point to other locations. |
| DocumentRoot /home/www/www.vaol.it/htdocs/protected |
| ServerName www.nostrosito.it |
| DocumentRoot /home/www/www.nostrosito.it/htdocs/ |
| At line 146 added 18 lines |
| ErrorLog /home/www/www.nostrosito.it/logs/error_log |
| CustomLog /home/www/www.nostrosito.it/logs/access_log combined |
| HostnameLookups Off |
| UseCanonicalName Off |
| ServerSignature On |
| <Directory "/home/www/www.nostrosito.it/htdocs/protected/"> |
| Options Indexes FollowSymLinks |
| AllowOverride None |
| Order allow,deny |
| Allow from all |
| </Directory> |
| SSLEngine on |
| SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL |
| SSLCertificateFile /root/sec/selfsigned-cert.pem |
| SSLCertificateKeyFile /root/sec/rsa-private-key.pem |
| </VirtualHost> |
| }}} |
| /% |
| At line 95 changed 3 lines |
| ErrorLog /home/www/www.vaol.it/logs/error_log |
| CustomLog /home/www/www.vaol.it/logs/access_log combined |
|
| Per adattare il file alle impostazioni modificare i parametri : |
| %%prettify |
| {{{ |
| www.nostrosito.it -> nome del sito |
| SSLCertificateFile /root/sec/selfsigned-cert.pem --> percorso assoluto al nostro server key |
| SSLCertificateKeyFile /root/sec/rsa-private-key.pem --> percorso assoluto al nostro server cert |
| At line 174 added one line |
| ulterioni info sul file virtualhost si possono trovare [qui|Tomcat] |
| At line 176 added one line |
| La direttiva rewriteRoule necessita del modulo rewrite attivabile per apache al solito |
| At line 180 added 6 lines |
| !Togliere informazioni sul sistema e apache |
|
| Per apache2 aggiungerle in /etc/apache2/apache.conf, per apache aggiungerle in /etc/apache/httpd.conf |
|
| ServerSignature Off\\ |
| ServerTokens Prod\\ |