pdf color - Dipartimento di Informatica ed Applicazioni
pdf color - Dipartimento di Informatica ed Applicazioni
pdf color - Dipartimento di Informatica ed Applicazioni
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
IIS + SSL<br />
Scenario - 1<br />
Scenario - 3<br />
Setup <strong>di</strong> un Sito WEB su https<br />
con transazioni sicure<br />
Corso <strong>di</strong> Sicurezza su Reti<br />
A.A. 2003/2004<br />
Prof.: Alfr<strong>ed</strong>o De Santis<br />
abcdefgh<br />
ijklmnopq<br />
rstuvwxyz<br />
abcdefgh<br />
ijklmnopq<br />
rstuvwxyz<br />
Realizzato da:<br />
Angelo Luciano<br />
Christian de Miranda<br />
Emiliano De Cristofaro<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Scenario<br />
Il protocollo Https<br />
Lo standard SSL<br />
OpenSSL<br />
IIS: installazione e configurazione<br />
Presentazione del nostro sito web<br />
abcdefgh<br />
ijklmnopq<br />
rstuvwxyz<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
abcdefghijklmnopqrstuvwxyz<br />
#@!£$%<br />
]*+!”&<br />
£%”;@<br />
#@!£$%]*+!”&£%”;@<br />
abcdefgh<br />
ijklmnopq<br />
rstuvwxyz<br />
abcdefgh<br />
ijklmnopq<br />
rstuvwxyz<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sommario<br />
Scenario - 2<br />
Scenario - 4<br />
Scenario<br />
Il protocollo Https<br />
Lo standard SSL<br />
OpenSSL<br />
IIS: installazione e configurazione<br />
Presentazione del nostro sito web<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Impe<strong>di</strong>re la trasmissione <strong>di</strong> dati in chiaro<br />
Evitare trasmissioni rischiose<br />
Numeri <strong>di</strong> carta <strong>di</strong> cre<strong>di</strong>to, password, pin<br />
Informazioni riservate, confidenziali<br />
Cr<strong>ed</strong>enziali<br />
Sfruttare le infrastrutture universalmente<br />
utilizzate per i siti “non sicuri”<br />
Evoluzione dei servizi non a carico dell’utente<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
offre servizi agli utenti con altissima qualità<br />
e cre<strong>di</strong>bilità<br />
garantisce la sicurezza e la riservatezza<br />
della trasmissione della propria banca dati<br />
evita danni economici derivanti dal furto <strong>di</strong><br />
informazioni riservate<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
Scenario - 5<br />
HTTPS - 2<br />
HTTPS - 4<br />
instaura un rapporto sicuro garantito da<br />
uno standard internazionale<br />
non teme per la sicurezza e la riservatezza<br />
dei propri dati personali e finanziari<br />
valuta il servizio offertogli sicuro, affidabile<br />
e <strong>di</strong> qualità<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Hyper Text Transfer Protocol Secure<br />
HTTP SSL<br />
Il browser (es. Internet Explorer):<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
effettua la richiesta <strong>di</strong> una determinata risorsa remota,<br />
residente sul WebServer<br />
interpreta il co<strong>di</strong>ce HTML della risposta, fornendo la<br />
formattazione e l’impaginazione opportune<br />
Il Web Server (es. IIS o Apache):<br />
attende le richieste, in ascolto sulla porta 80<br />
quando riceve una richiesta, fornisce al client la risorsa<br />
desiderata<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
HTTPS - 1<br />
HTTPS - 3<br />
HTTPS - 5<br />
Scenario<br />
Il protocollo Https<br />
Lo standard SSL<br />
OpenSSL<br />
IIS: installazione e configurazione<br />
Presentazione del nostro sito web<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
protocollo della suite TCP/IP<br />
fulcro della struttura del World Wide Web<br />
implementa il trasferimento <strong>di</strong> informazioni<br />
ipertestuali sulla rete<br />
standar<strong>di</strong>zzazione iniziata dalla IETF, sotto l’egida<br />
della W3C, nel 1994 e terminata nel 2000 con la<br />
versione 1.1<br />
basato su uno schema client/server<br />
request/response<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
L’HTTP deve co<strong>di</strong>ficare opportunamente le<br />
richieste del client e le risposte del server<br />
Per riferirsi ad una risorsa si utilizza una<br />
particolare stringa <strong>di</strong> caratteri<br />
Universal Resource Locator (URL)<br />
Es. http://nome_server:porta/path/nome_risorsa<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
HTTPS - 6<br />
SSL - 2<br />
SSL: CRITTOGRAFIA - 4<br />
HTTPS rappresenta un’importante evoluzione<br />
dei servizi offerti dall’HTTP<br />
introduce la sicurezza della trasmissione, utilizzando lo<br />
standard SSL<br />
Lo sforzo per la sicurezza è trasparente<br />
all’utente<br />
la complessità del protocollo è incapsulata nelle applicazioni<br />
client/server<br />
le applicazioni aggiungono lo strato software necessario alla<br />
realizzazione della trasmissione sicura<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Secure Sockets Layer<br />
Standard, non proprietario, proposto dalla<br />
Netscape Communications nel 1994<br />
Attualmente in uso la versione 3.0,<br />
standar<strong>di</strong>zzata dalla IETF nel 1996<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SSL consente la protezione <strong>di</strong> informazioni<br />
me<strong>di</strong>ante l’uso <strong>di</strong> algoritmi <strong>di</strong> cifratura<br />
crittografia simmetrica: utilizzo della stessa<br />
chiave per la co<strong>di</strong>fica e per la deco<strong>di</strong>fica<br />
crittografia asimmetrica: utilizzo <strong>di</strong> chiavi<br />
<strong>di</strong>verse (chiave pubblica, chiave privata)<br />
SSL utilizza uno schema ibrido<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SSL - 1<br />
SSL - 3<br />
SSL: CRITTOGRAFIA - 5<br />
Scenario<br />
Il protocollo Https<br />
Lo standard SSL<br />
OpenSSL<br />
IIS: installazione e configurazione<br />
Presentazione del nostro sito web<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Protezione dei dati<br />
Utilizzo <strong>di</strong> protocolli <strong>di</strong> crittografia per la trasmissione<br />
delle informazioni<br />
Integrità dei messaggi<br />
Utilizzo <strong>di</strong> funzioni hash sicure su firme <strong>di</strong>gitali<br />
Autenticazione dell’entità<br />
Utilizzo <strong>di</strong> certificati garantiti da autorità <strong>di</strong> certificazione<br />
per autenticare gli endpoint<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Crittografia simmetrica<br />
richi<strong>ed</strong>e che entrambe le parti conoscano la chiave<br />
la <strong>di</strong>ffusione della chiave rappresenta la principale debolezza<br />
richi<strong>ed</strong>e pochi cicli <strong>di</strong> CPU<br />
sicurezza basata sulla lunghezza della chiave<br />
in SSL la chiave varia tra 40 e 168 bit<br />
Crittografia asimmetrica<br />
schema introdotto in risposta ai limiti dello schema simmetrico<br />
è più lenta <strong>di</strong> circa 1000 volte rispetto alla crittografia simmetrica<br />
l’algoritmo RSA utilizza un’aritmetica modulare per implementare il<br />
concetto <strong>di</strong> chiave pubblica e privata<br />
le transazioni SSL iniziano con uno scambio asimmetrico della<br />
chiave <strong>di</strong> sessione<br />
utilizzo della chiave pubblica (nota a tutti) per la co<strong>di</strong>fica, chiave<br />
privata (segreta al destinatario) per la deco<strong>di</strong>fica<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
SSL: FIRME DIGITALI - 6<br />
SSL: CERTIFICATI - 8<br />
SSL: CERTIFICATI - 10<br />
L’associazione <strong>di</strong> una firma <strong>di</strong>gitale ai<br />
messaggi ne garantisce l’integrità<br />
la possibilità che un messaggio sia compromesso è<br />
minimizzata<br />
Una firma <strong>di</strong>gitale è un’impronta <strong>di</strong>gitale a<br />
cui viene applicata una funzione hash<br />
basata sul checksum del messaggio<br />
<strong>di</strong>fficile da invertire<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
I certificati <strong>di</strong>gitali sono utilizzati da SSL per<br />
l’autenticazione dei server<br />
Sono documenti <strong>di</strong>gitali che attestano<br />
l’associazione <strong>di</strong> una chiave pubblica ad un<br />
in<strong>di</strong>viduo o ad un’entità<br />
Valore intero<br />
Valore intero<br />
Unico per ogni CA<br />
Unico per ogni CA<br />
Identifica il certificato<br />
Identifica il certificato<br />
Algoritmo usato per<br />
Algoritmo usato per<br />
firmare il certificato<br />
firmare il certificato<br />
Periodo<br />
Periodo<br />
<strong>di</strong><br />
<strong>di</strong><br />
vali<strong>di</strong>tà<br />
vali<strong>di</strong>tà<br />
del<br />
del<br />
certificato<br />
certificato<br />
Opzionale:<br />
Opzionale:<br />
stringa<br />
stringa<br />
<strong>di</strong><br />
<strong>di</strong><br />
bit<br />
bit<br />
utile<br />
utile<br />
per<br />
per<br />
identificare<br />
identificare<br />
la<br />
la<br />
CA<br />
CA<br />
Diversi campi <strong>di</strong><br />
Diversi campi <strong>di</strong><br />
estensione<br />
estensione<br />
Standard X.509<br />
Version<br />
Serial Number<br />
Signature Algorithm ID<br />
Issuer Name<br />
Vali<strong>di</strong>ty Period<br />
Subject Name<br />
Subject’s Public Key Information<br />
Issuer Unique Identifier<br />
Subject Unique Identifier<br />
Extensions<br />
Firma deiPrecendetiCampi<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
1. Default<br />
1. Default<br />
2. Se presente “Issuer/subject<br />
2. Se presente “Issuer/subject<br />
unique identifier”<br />
unique identifier”<br />
3. Se ci sono estensioni<br />
3. Se ci sono estensioni<br />
Nome X.500 della CA<br />
Nome X.500 della CA<br />
che ha creato e firmato<br />
che ha creato e firmato<br />
il certificato<br />
il certificato<br />
Nome<br />
Nome<br />
utente<br />
utente<br />
del<br />
del<br />
certificato<br />
certificato<br />
Informazioni<br />
Informazioni<br />
sulla<br />
sulla<br />
chiave<br />
chiave<br />
pubblica<br />
pubblica<br />
e<br />
e<br />
relativo<br />
relativo<br />
algoritmo<br />
algoritmo<br />
Opzionale:<br />
Opzionale:<br />
stringa<br />
stringa<br />
<strong>di</strong><br />
<strong>di</strong><br />
bit<br />
bit<br />
per<br />
per<br />
identificare<br />
identificare<br />
il<br />
il<br />
soggetto<br />
soggetto<br />
Firma dell’Hash <strong>di</strong> tutti gli<br />
Firma dell’Hash <strong>di</strong> tutti gli<br />
altri campi<br />
altri campi<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SSL: FIRME DIGITALI - 7<br />
SSL: CERTIFICATI - 9<br />
SSL: CA - 11<br />
Client Server<br />
Le due parti computano<br />
l’impronta<br />
Calcolano l’hash<br />
Hash Hash<br />
Confrontano l’hash<br />
Se i risultati corrispondono, il<br />
messaggio non è stato alterato<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SSL utilizza lo standard X.509 per validare le<br />
identità<br />
i certificati conformi a tale standard contengono le<br />
informazioni sull’entità certificata, una chiave pubblica e<br />
un nome<br />
il certificato deve essere convalidato da un’autorità <strong>di</strong><br />
certificazione<br />
definito dalla ITUT nel 1988, rivisto nel 1993 e nel 1995<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
CERTIFICATION AUTHORITY<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
SSL: CA - 12<br />
SSL: CA - 14<br />
La patente abilita alla guida, ma è anche valida<br />
come documento <strong>di</strong> riconoscimento<br />
SSL: FUNZIONAMENTO - 16<br />
è rilasciata da un’autorità pubblica fidata, come la Prefettura<br />
o la Motorizzazione Civile<br />
la Prefettura rappresenta l’autorità certificante<br />
la nostra patente rappresenta un certificato che permette la<br />
nostra “autenticazione”<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Un’autorità richi<strong>ed</strong>e la garanzia <strong>di</strong> un’altra,<br />
ritenuta più affidabile<br />
tale proce<strong>di</strong>mento <strong>di</strong> fiducia è vitale per l’autenticazione <strong>di</strong><br />
un’entità<br />
es. il sito www.posteitaliane.it ha un certificato validato<br />
dall’autorità PosteCert, a sua volta validata dalla GTE Cyber<br />
Trust Root<br />
in una sessione https è possibile, nel browser, cliccare sul<br />
lucchetto in basso a destra per visualizzare la catena dei<br />
certificati interessati<br />
Client:<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
tipicamente è il browser web (deve<br />
supportare SSL)<br />
avvia la transazione<br />
Server:<br />
tipicamente è il server web (deve supportare<br />
SSL)<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SSL: CA - 13<br />
SSL: CA - 15<br />
Livello 2<br />
CA #3<br />
Un certificato <strong>di</strong>gitale garantisce l’identità <strong>di</strong><br />
un endpoint<br />
come un documento garantisce l’identità <strong>di</strong> una persona<br />
è necessario per implementare il concetto <strong>di</strong> transazione<br />
sicura <strong>ed</strong> affidabile<br />
Il certificato deve necessariamente essere<br />
autenticato da un’autorità affidabile<br />
ad es. VeriSign è responsabile della certificazione della<br />
maggior parte dei siti web<br />
Livello 1<br />
CA #1<br />
SSL: FUNZIONAMENTO - 17<br />
Livello 2<br />
CA #4<br />
Root CA<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Livello 2<br />
CA #5<br />
Livello 1<br />
CA #2<br />
Livello 2<br />
CA #6<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Una sessione SSL consta <strong>di</strong> uno stack a tre<br />
protocolli:<br />
Handshake Protocol (Inizializzazione della sessione)<br />
Records Protocol (Trasferimento dati)<br />
Alert Protocol (Messaggi <strong>di</strong> errore)<br />
Browser<br />
Handshake Protocol<br />
Record Protocol<br />
Alert Protocol<br />
Web Server<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
SSL: HANDSHAKE - 18<br />
SSL: HANDSHAKE - 20<br />
SSL: ALERT - 22<br />
Di norma, solo il client autentica il server<br />
i server web infatti utilizzano altri meto<strong>di</strong> per<br />
l’autenticazione del client<br />
ad es. il Web Site Server può verificare la carta <strong>di</strong><br />
cre<strong>di</strong>to dell’utente al <strong>di</strong> fuori della sessione SSL<br />
(virtual pos)<br />
in questo modo il server riserva preziose risorse<br />
per le transazioni criptate<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Client Server<br />
Client Hello<br />
Server Hello<br />
Certificato Server<br />
Scambio Chiave Server<br />
Richiesta Certificato<br />
Server Hello: OK<br />
Certificato Client<br />
Scambio Chiave Client<br />
Verifica Certificato<br />
Cambio Cifratura<br />
Fine<br />
Cambio Cifratura<br />
Fine<br />
Dati Applicazione<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Gestisce pacchetti informativi<br />
Se il client o il server rilevano un errore, essi<br />
inviano subito un “alert” contenente l’errore<br />
Messaggi alert: warning, critical, fatal<br />
in base al messaggio ricevuto la sessione è sospesa<br />
(warning, critical) o terminata (fatal)<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SSL: HANDSHAKE - 19<br />
SSL: RECORDS - 21<br />
OPENSSL - 1<br />
Passi fondamentali:<br />
negoziazione dei parametri <strong>di</strong> sessione (algoritmi <strong>di</strong><br />
cifratura)<br />
autenticazione del server me<strong>di</strong>ante invio <strong>di</strong> cr<strong>ed</strong>enziali<br />
SSL utilizza la crittografia asimmetrica solo per<br />
negoziare la chiave <strong>di</strong> sessione per la cifratura<br />
a chiave simmetrica<br />
i dati dell’applicazione vengono cifrati con algoritmi a<br />
chiave simmetrica durante la fase <strong>di</strong> trasferimento<br />
meccanismo <strong>di</strong> <strong>di</strong>gital envelope<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Gestisce la cifratura per i tutti i messaggi SSL<br />
Fornisce un formato comune per incapsulare<br />
messaggi <strong>di</strong> tipo Alert, ChangeChiperSpec,<br />
Handshake, messaggi <strong>di</strong> applicazione<br />
Tipo<br />
Dati<br />
Versione Lunghezza<br />
Hash<strong>ed</strong>-Bas<strong>ed</strong> Message Authentication Code (HMAC) Message Digest (MD5)<br />
Pad Lunghezza Pad<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Scenario<br />
Il protocollo Https<br />
Lo standard SSL<br />
OpenSSL<br />
IIS: installazione e configurazione<br />
Presentazione del nostro sito web<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
OPENSSL: INTRODUZIONE - 2<br />
OpenSSL: Open Secure Socket Layer Protocol<br />
OPENSSL: INTRODUZIONE - 4<br />
È un toolkit open source e multipiattaforma<br />
sviluppato da Eric A. Young e Tim J. Hudson<br />
attualmente alla versione 0.9.7d<br />
implementa il protocollo SSL (v.2/v.3) e TLS (v.1)<br />
fornisce una potente libreria <strong>di</strong> crittografia general-purpose<br />
richi<strong>ed</strong>e Windows 95 o superiore e Internet Explorer 4.0 o<br />
superiore<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sappiamo che per utilizzare SSL su un<br />
webserver è necessario installare un<br />
certificato X.509 valido<br />
Passi necessari:<br />
OPENSSL: CONFIGURAZIONE - 6<br />
preparare una richiesta <strong>di</strong> certificazione con i propri dati<br />
sottoporre la richiesta ad una CA ritenuta affidabile (es.<br />
VeriSign)<br />
installare correttamente il certificato ottenuto<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Per funzionare correttamente OpenSSL necessita<br />
<strong>di</strong> un file <strong>di</strong> configurazione per il setup della CA<br />
è possibile reperire in rete <strong>di</strong>versi file <strong>di</strong> configurazione o<br />
scriverlo manualmente<br />
www.dylanbeattie.net/docs/openssl.conf<br />
www.pvx.com, www.securityfocus.com<br />
Creare la struttura delle <strong>di</strong>rectory necessaria<br />
creare una <strong>di</strong>rectory <strong>di</strong> lavoro c:\ssl<br />
creare le sotto<strong>di</strong>rectory keys, requests e certs<br />
creare il file database.txt come un file <strong>di</strong> testo vuoto<br />
creare il file serial.txt contenente “01” e il “newline”<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
OPENSSL: INTRODUZIONE - 3<br />
OPENSSL: SETUP - 5<br />
OPENSSL: CA - 7<br />
Utilizziamo OpenSSL per creare una CA che<br />
vali<strong>di</strong> la richiesta <strong>di</strong> certificazione del nostro<br />
server web<br />
I certificati validati solo dalla propria CA sono<br />
<strong>di</strong> fatto utilizzabili solo in fase <strong>di</strong> testing<br />
quando un client acc<strong>ed</strong>e ai contenuti del server, la nostra<br />
autorità, che ha validato il certificato, non viene riconosciuta<br />
come affidabile<br />
altrimenti dovremmo richi<strong>ed</strong>ere, a pagamento, la<br />
certificazione ad un’autorità fidata<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
La versione per Windows (Win32 OpenSSL) è<br />
reperibile in rete gratuitamente<br />
www.shininglightpro.com/products/Win32OpenSSL.html<br />
E’ possibile scaricare la versione per Linux<br />
<strong>di</strong>rettamente dal sito www.openssl.org<br />
Scaricato il file eseguibile, seguire le<br />
impostazioni <strong>di</strong> default e installare il toolkit<br />
nella <strong>di</strong>r C:\OpenSSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Crea una coppia <strong>di</strong> chiavi pubblica e privata per la CA<br />
Crea un certificato master relativo alle chiavi generate<br />
Esporta il certificato in formato PCKS12<br />
per importare il certificato nel browser al fine <strong>di</strong> riconoscere<br />
come fidata la CA (e quin<strong>di</strong> tutte le entità da essa certificate)<br />
Valida le richieste <strong>di</strong> certificazione pervenute secondo<br />
lo standard X.509<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
OPENSSL: CA - 8<br />
OPENSSL: CA - 10<br />
standard<br />
X.509<br />
Generiamo la coppia <strong>di</strong> chiavi: utilizziamo RSA<br />
l’esponente pubblico (e) utilizzato <strong>di</strong> default è 65537<br />
l’utente può selezionare un <strong>di</strong>verso esponente<br />
il modulo (n) viene generato pseudo-casualmente dalla<br />
libreria rand.h <strong>di</strong> OpenSSL<br />
la tripla (n, d, e) viene memorizzata nel file ca.key secondo il<br />
formato PEM<br />
per una maggiore sicurezza, è possibile cifrare il file ca.key<br />
con un algoritmo a chiave simmetrica utilizzando una PASS<br />
PHRASE<br />
la chiave dell’algoritmo <strong>di</strong> cifratura è una funzione hash della<br />
PASS PHRASE<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Creare un certificato master relativo alle chiavi<br />
generate, memorizzate in ca.key, da usare per<br />
firmare gli altri certificati<br />
se il file ca.key è stato cifrato, verrà richiesta la PASS<br />
PHRASE per risalire alla chiave<br />
C:\ssl>c:\openssl\bin\openssl req –config openssl.conf –new<br />
–x509 –days 1001 –key keys/ca.key –out certs/ca.cer<br />
vali<strong>di</strong>tà del<br />
certificato<br />
OPENSSL: FIRMARE RICHIESTA - 12<br />
file <strong>di</strong> config<br />
per la CA<br />
file della<br />
chiave<br />
privata della<br />
CA<br />
richiesta <strong>di</strong><br />
certificato<br />
file della<br />
chiave privata<br />
file <strong>di</strong><br />
configurazione<br />
certificato creato<br />
in ca.cer<br />
crea un nuovo<br />
certificato<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Per firmare una richiesta <strong>di</strong> certificazione<br />
C:\ssl>c:\openssl\bin\openssl ca -policy policy_anything -<br />
config openssl.conf -cert certs/ca.cer -in requests/certreq.txt<br />
-keyfile keys/ca.key -days 360 -out certs/iis.cer<br />
certificato<br />
master della CA<br />
vali<strong>di</strong>tà del<br />
certificato<br />
certificato del<br />
webserver<br />
richiesta <strong>di</strong><br />
certificazione<br />
eventuali<br />
regole <strong>di</strong><br />
restrizione<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
OPENSSL: CA - 9<br />
C:\ssl>c:\openssl\bin\openssl genrsa –des3<br />
–out keys/ca.key 1024<br />
file ca.key dove è<br />
contenuta la tripla<br />
(n, d, e)<br />
OPENSSL: CA - 11<br />
certificato da<br />
esportare<br />
Lunghezza in<br />
bit della chiave<br />
viene usato il sistema RSA per<br />
generare la coppia <strong>di</strong> chiavi.<br />
L’esponente pubblico <strong>di</strong> default è<br />
65537. Con l’opzione –F4 si può<br />
scegliere un <strong>di</strong>verso esponente.<br />
utilizziamo l'algoritmo del<br />
triploDES per cifrare il file.<br />
Si genera la chiave <strong>di</strong><br />
cifratura del triploDES<br />
attraverso una funzione<br />
hash <strong>di</strong> una PASS PHRASE<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Esportare il certificato nel formato PKCS12<br />
C:\ssl>c:\openssl\bin\openssl pcks12 –export –in<br />
certs/ca.cer –inkey keys/ca.key out certs/ca.p12<br />
file della<br />
chiave privata<br />
OPENSSL: FIRMARE RICHIESTA - 13<br />
formato <strong>di</strong><br />
esportazione<br />
Certificato<br />
in formato<br />
PKCS12<br />
comando per<br />
l’esportazione<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Convertire il certificato nel formato X.509<br />
C:\ssl>c:\openssl\bin\openssl x509 -in certs/iis.cer -out<br />
certs/iisx509.cer<br />
certificato<br />
convertito<br />
allo standard<br />
standard<br />
X.509<br />
certificato da<br />
convertire<br />
Il comando lascia il nuovo certificato in<br />
c:\ssl\certs\iisx509.cer<br />
È firmato e pronto per essere installato sul webserver<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
IIS - 1<br />
IIS: INSTALLAZIONE - 3<br />
IIS: INSTALLAZIONE - 5<br />
Scenario<br />
Il protocollo Https<br />
Lo standard SSL<br />
OpenSSL<br />
IIS: installazione e configurazione<br />
Presentazione del nostro sito web<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Poiché IIS è un componente<br />
<strong>di</strong> Windows, per installarlo è<br />
necessario acc<strong>ed</strong>ere alla<br />
schermata <strong>di</strong><br />
installazione/rimozione <strong>di</strong><br />
componenti <strong>di</strong> Windows<br />
Per acc<strong>ed</strong>ervi:<br />
Pannello <strong>di</strong> controllo<br />
Installazione applicazioni<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Selezionare Internet Information Services e cliccare Avanti<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
IIS - 2<br />
Internet Information Service è il server web <strong>di</strong><br />
Microsoft su piattaforme Windows<br />
È fornito su:<br />
Windows 2000 PRO<br />
Windows 2000 Server<br />
Windows XP PRO<br />
Windows 2003 Server<br />
IIS: INSTALLAZIONE - 4<br />
IIS: INSTALLAZIONE - 6<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
A questo punto cliccare su Installazione componenti <strong>di</strong> Windows<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Ora il nostro Server Web è in<br />
ascolto sulla porta 80<br />
Lo possiamo facilmente verificare<br />
aprendo una sessione <strong>di</strong> Internet<br />
Explorer e <strong>di</strong>gitando nella URL:<br />
http://localhost/localstart.asp<br />
Il server web ci restituirà una<br />
pagina <strong>di</strong> benvenuto che ci<br />
informa dell’effettiva esecuzione<br />
del servizio web<br />
È possibile inoltre navigare<br />
all’interno della documentazione<br />
<strong>di</strong> IIS<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
IIS: CONFIGURAZIONE- 7<br />
IIS: CONFIGURAZIONE – 9<br />
IIS: CONFIGURAZIONE - 11<br />
Dopo il setup del server, passiamo ora alla<br />
fase <strong>di</strong> abilitazione della connessione protetta<br />
generiamo una richiesta <strong>di</strong> certificazione da<br />
sottoporre ad una CA<br />
ricevuto il certificato valido, passiamo alla sua<br />
installazione<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Per acc<strong>ed</strong>ere al tool <strong>di</strong> configurazione <strong>di</strong> IIS, cliccare su<br />
Internet Information Services<br />
Acc<strong>ed</strong>ere alla sch<strong>ed</strong>a Protezione <strong>di</strong>rectory<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
IIS: CONFIGURAZIONE - 8<br />
IIS: CONFIGURAZIONE - 10<br />
IIS: CONFIGURAZIONE - 12<br />
Al termine dell’installazione <strong>di</strong> IIS, ritornare nel pannello <strong>di</strong><br />
controllo e cliccare su Strumenti <strong>di</strong> amministrazione<br />
A questo punto cliccare su Certificato server…<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Per acc<strong>ed</strong>ere alla finestra<br />
delle proprietà del server<br />
selezionare Sito Web<br />
pr<strong>ed</strong>efinito:<br />
tasto destro del mouse<br />
clic su proprietà<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
IIS: CONFIGURAZIONE - 13<br />
IIS: CONFIGURAZIONE - 15<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Cliccando su Avanti si acc<strong>ed</strong>e al tool per la preparazione della richiesta<br />
dove verranno richiesti con una serie <strong>di</strong> form i dati e i parametri necessari<br />
IIS: CONFIGURAZIONE - 17<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
IIS: CONFIGURAZIONE - 14<br />
Selezionare Crea nuovo<br />
certificato e cliccare<br />
su Avanti<br />
Il software ci darà ora la possibilità <strong>di</strong> generare una richiesta,<br />
accorgendosi dell’assenza <strong>di</strong> richieste in sospeso<br />
IIS: CONFIGURAZIONE - 16<br />
IIS: CONFIGURAZIONE - 18<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
IIS: CONFIGURAZIONE - 19<br />
IIS: CONFIGURAZIONE - 21<br />
IIS: CERTIFICATO - 23<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Supponiamo <strong>di</strong> aver ottenuto da una CA la<br />
validazione della richiesta, installiamo:<br />
riportiamoci nella schermata <strong>di</strong> protezione<br />
<strong>di</strong>rectory, accessibile dalle proprietà del sito web<br />
pr<strong>ed</strong>efinito<br />
cliccare quin<strong>di</strong> nuovamente su certificato server…<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
IIS: CONFIGURAZIONE - 20<br />
IIS: CONFIGURAZIONE - 22<br />
IIS: CERTIFICATO - 24<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Poiché vi è una richesta in sospeso il tool ci permetterà <strong>di</strong><br />
elaborarla o eventualmente eliminarla<br />
Elaboriamo la nostra richiesta<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
IIS: CERTIFICATO - 25<br />
IIS: CERTIFICATO - 27<br />
IIS: CERTIFICATO - 29<br />
la CA ha rilasciato il certificato, conforme allo std X.509<br />
tale certificato è memorizzato nel path sopra in<strong>di</strong>cato<br />
importiamo il certificato<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Il certificato è ora installato sul<br />
server<br />
L’ultimo step consiste<br />
nell’abilitare il canale sicuro sul sito<br />
in modo che il server<br />
effettivamente sia in ascolto sulla<br />
porta SSL<br />
Cliccare su mo<strong>di</strong>fica nella<br />
sezione comunicazioni protette<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
IIS: CERTIFICATO - 26<br />
IIS: CERTIFICATO - 28<br />
IIS: CERTIFICATO - 30<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Abilitiamo il canale protetto SSL<br />
Per una maggiore sicurezza<br />
abilitiamo opzionalmente la<br />
crittografia a 128 bit (default 40 bit)<br />
Il protocollo SSL prev<strong>ed</strong>e<br />
opzionalmente che il server<br />
autentichi il client (<strong>di</strong> norma<br />
<strong>di</strong>sabilitato)<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Cliccando sul lucchetto in basso a<br />
destra del browser, viene<br />
visualizzata la schermata relativa<br />
alle informazioni sul certificato:<br />
Il beneficiario<br />
Autorità certificante<br />
Vali<strong>di</strong>tà<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
SITO WEB – 1<br />
SITO WEB - 3<br />
SITO WEB - 5<br />
Scenario<br />
Il protocollo Https<br />
Lo standard SSL<br />
OpenSSL<br />
IIS: installazione e configurazione<br />
Presentazione del nostro sito web<br />
AMMINISTRAZIONE DEL CONSORZIO:<br />
LA SOLUZIONE:<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
<strong>di</strong>spone già <strong>di</strong> un sistema back-end per la gestione<br />
interna <strong>di</strong> tali informazioni<br />
non <strong>di</strong>spone, invece, <strong>di</strong> un modo per <strong>di</strong>vulgarle ai propri<br />
soci in modo sicuro e automatizzato<br />
interfaccia Web che consente ai soli soci (dotati <strong>di</strong> una<br />
coppia user/pass) <strong>di</strong> acc<strong>ed</strong>ere alle informazioni riservate<br />
Dati su un canale sicuro in HTTPS<br />
Il co<strong>di</strong>ce del sito è scritto in ASP<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
è una tecnologia <strong>di</strong> scripting server-side <strong>di</strong> Microsoft che<br />
serve a creare pagine <strong>di</strong>namiche<br />
<strong>di</strong>rettamente integrato e supportato dal webserver IIS<br />
la tecnologia è simile al visual-basic <strong>ed</strong> è realizzata me<strong>di</strong>ante<br />
un preprocessore utilizzato dal webserver per il recupero dei<br />
parametri e per la produzione del co<strong>di</strong>ce html<br />
abbiamo utilizzato Microsoft Development Environment come<br />
ambiente <strong>di</strong> sviluppo per la scrittura del co<strong>di</strong>ce<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SITO WEB - 2<br />
SITO WEB - 4<br />
SITO WEB - 6<br />
Soluzione B2B<br />
Un consorzio <strong>di</strong> supermercati necessita <strong>di</strong> un sistema per<br />
<strong>di</strong>vulgare ai propri soci informazioni riservate<br />
GLI UTENTI:<br />
contratti commerciali confidenziali stipulati con le<br />
aziende fornitrici<br />
pianificazione promozionale annua del consorzio<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Il dominio degli utenti è rappresentato dall’insieme dei<br />
soci del consorzio<br />
Acc<strong>ed</strong>ono all’interfaccia tramite un normalissimo browser<br />
web che supporta SSL<br />
Si autenticano al sistema fornendo coppia user/pass<br />
Ottengono le informazioni riservate navigando all’interno<br />
dell’interfaccia<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Utilizziamo Microsoft Office come DBMS<br />
per la memorizzazione dei dati che vorremo proteggere<br />
L’accesso alla base <strong>di</strong> dati è estremamente<br />
semplice da realizzare con ASP<br />
l’astrazione generica <strong>di</strong> database fornita da ASP permette un<br />
accesso alla fonte in<strong>di</strong>pendente (o quasi) dal formato<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
SITO WEB - 7<br />
SITO WEB - 9<br />
SITO WEB - 11<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Connessione<br />
protetta con<br />
SSL a 128 bit<br />
Pannello <strong>di</strong> accesso all’area riservata<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Pagina principale del pannello <strong>di</strong> controllo<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SITO WEB - 8<br />
SITO WEB - 10<br />
SITO WEB - 12<br />
Homepage <strong>di</strong> www.miosito.com<br />
La connessione è ancora in chiaro<br />
Click<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Autenticazione<br />
utente<br />
Pannello <strong>di</strong> accesso all’area riservata<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
SITO WEB - 13<br />
SITO WEB - 15<br />
SITO WEB - 17<br />
E’ possibile anche<br />
consultare i dettagli<br />
<strong>di</strong> ogni contratto<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
SITO WEB – 14<br />
SITO WEB - 16<br />
SITO WEB - 18<br />
E’ possibile anche<br />
consultare i dettagli<br />
<strong>di</strong> ogni promozione<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL
BIBLIOGRAFIA - 1<br />
- D.E. Comer, Internetworking con TCP-IP , Ad<strong>di</strong>son Wesley, 1995<br />
-Cisco System, Introduction to socket layer, Cisco System Inc., 2001<br />
- Microsoft Corporation, Microsoft Internet Information Services 6.0 Resource<br />
Kit, Microsoft Press, 2003<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL<br />
BIBLIOGRAFIA - 2<br />
- www.ietf.org, sito della Internet Engineering Task Force<br />
- www.w3c.org, sito della World Wide Web Consortium<br />
- www.openssl.org, sito dell’OpenSSL Project<br />
- developer.netscape.com/docs/manuals/security/sslin/contents.htm,<br />
introduzione a SSL della Netscape<br />
- www.dylanbeattie.net, sito dove abbiamo recuperato il file <strong>di</strong> config per<br />
OpenSSL<br />
- www.shininglightpro.com, sito da dove abbiamo scaricato OpenSSL per<br />
Windows<br />
- www.microsoft.com/WindowsServer2003/iis/default.mspx, sito <strong>di</strong> help per<br />
iis 6.0<br />
Sicurezza su Reti 2004 – Setup <strong>di</strong> un sito web su https con SSL