Mettere in sicurezza un server Linux

“Alzare” un server linux oggi è una operarazione tutto sommato alla portata dei più.
Metterlo in sicurezza sicuramente risulta più complesso.
Per agevolare i niubbi (e, per certi versi, i “dopolavoristi” come dice l’amico 0disse0) pubblico qualche info per evitare di essere “bucati” dopo poco tempo.
P.s.: per scoprire le vulnerabilità del proprio server si consiglia di utilizzare Nessus …

httpd.conf (Apache/WWW)
TraceEnable off
This directive overrides the behavior of TRACE for both the core server and mod_proxy. The default TraceEnable on permits TRACE requests per RFC 2616, which disallows any request body to accompany the request. TraceEnable off causes the core server and mod_proxy to return a 405 (Method not allowed) error to the client.
Finally, for testing and diagnostic purposes only, request bodies may be allowed using the non-compliant TraceEnable extended directive. The core (as an origin server) will restrict the request body to 64k (plus 8k for chunk headers if Transfer-Encoding: chunked is used). The core will reflect the full headers and all chunk headers with the response body. As a proxy server, the request body is not restricted to 64k.
ServerTokens
This directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server as well as information about compiled-in modules.
Si consiglia di commentare il parametro “ServerTokens” in questo modo:
#ServerTokens OS
e di settare da :
ServerSignature Off
a
ServerSignature On
il parametro “ServerSignature

RPC (Remote procedure control)
RPC, acronimo di Remote Procedure Call, è un meccanismo generale per la gestione di applicazioni client/server. Il sistema si basa su un demone, il portmapper, e un file che elenca i servizi disponibili associati al demone relativo. Il portmapper è un classico esempio di un programma che gestisce un servizio di rete in modo autonomo, cioè senza essere controllato da inetd
Si consiglia di stoppare il servizio (service portmap stop) e di non attivare il servizio all’avvio del server …

SSLv2 vs. SSLv3
Editare il file /etc/httpd/conf.d/ssl.conf e modificare:

da
SSLProtocol all -SSLv2
a
SSLProtocol -ALL +SSLv3 +TLSv1

da
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
a
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM

Fare ripartire i servizi che si appoggiano a SSL (Dovecot, Apache ed eventualmente Postfix)
Per testare la funzionalità di SSLv3:

openssl s_client -ssl3 -connect localhost:443
openssl s_client -tls1 -connect localhost:443

Per controllare se il protocollo SSLv2 è stato correttamente disattivato digitare:

openssl s_client -ssl2 -connect localhost:443

Se correttamente disattivato dovrebbe comparire:

CONNECTED(00000003)
29102:error:1407F0E5:SSL routines:SSL2_WRITE:ssl handshake failure:s2_pkt.c:428:

/etc/squid.conf (Squid/Proxy server)
Disabilitare il protocollo gopher
#acl Safe_ports port 70 # gopher

/etc/postfix/main.conf (Postfix/SMTP)
Abilitare i protocolli SSLv3 e TLSv1 (sono se si usa autenticazione)

smtp_tls_mandatory_protocols = !SSLv3, !TLSv1

  1. No trackbacks yet.

Lascia un Commento

Fill in your details below or click an icon to log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Log Out / Modifica )

Foto Twitter

You are commenting using your Twitter account. Log Out / Modifica )

Foto di Facebook

You are commenting using your Facebook account. Log Out / Modifica )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 32 other followers