random musings on ssl/tls configuration

42
Random musings on SSL/TLS by Cyrus Dasadia (@ExtremeUnix)

Upload: extremeunix

Post on 08-Jun-2015

355 views

Category:

Internet


0 download

DESCRIPTION

Few notes I collected while trying to figure out proper SSL/TLS configuration

TRANSCRIPT

Page 1: Random musings on SSL/TLS configuration

Random musings onSSL/TLS by Cyrus Dasadia (@ExtremeUnix)

Page 2: Random musings on SSL/TLS configuration

Reason for configuring SSL

Identity

Confidentiality/Privacy

Integrity

Page 3: Random musings on SSL/TLS configuration

Secure my application

Step 1: Create CSR

Page 4: Random musings on SSL/TLS configuration

Secure my application

Step 1: Create CSR

Step 2: Buy / Self-sign a SSL Certificate

Page 5: Random musings on SSL/TLS configuration

Secure my application

Step 1: Create CSR

Step 2: Buy / Self-sign a SSL Certificate

Step 3: Configure Apache/Nginx web-server

Page 6: Random musings on SSL/TLS configuration

Secure my application

Step 1: Create CSR

Step 2: Buy / Self-sign a SSL Certificate

Step 3: Configure Apache/Nginx web-server

Step 4: Security Accomplished!!

Page 7: Random musings on SSL/TLS configuration

Thank you! Questions?

Page 8: Random musings on SSL/TLS configuration

You were mostly wrong

Cipher suites ?OpenSSL on system/application?Certificate Key?TLS version supported?

Page 9: Random musings on SSL/TLS configuration

SSL == TLS

Page 10: Random musings on SSL/TLS configuration

SSL ≠ TLS or is it ?

Netscape created SSL as a product

SSL v1.0 - ??SSL v2.0 - 1995SSL v3.0 - 1996

Page 11: Random musings on SSL/TLS configuration

SSL ≠ TLS or is it ?

Netscape created SSL as a product

SSL v1.0 - ??SSL v2.0 - 1995SSL v3.0 - 1996

TLS came as a standard.

TLS v1.0 - 1999TLS v1.1 - 2006TLS v1.2 - 2008TLS v1.3 - draft

Page 12: Random musings on SSL/TLS configuration

SSL/TLS connection

Page 13: Random musings on SSL/TLS configuration

X.509

Hostname validation certs

Extended validation certs

Page 14: Random musings on SSL/TLS configuration

Protocol Versions

● Disable SSL v2.0● Avoid SSL v3.0 ● Disable TLS compression (removed in

TLS 1.3)● Highest priority to TLS 1.2

Page 15: Random musings on SSL/TLS configuration

Ciphers

Plain text

Key

SupaCipher EncryptedText

Page 16: Random musings on SSL/TLS configuration

Ciphers: TLS

Symmetric

Block chaining

Recommended AES128 with GCM (Galois/Counter Mode)

Page 17: Random musings on SSL/TLS configuration

Ciphers: TLS

Avoid these ciphers:DESEXP-*RC4

Page 18: Random musings on SSL/TLS configuration

KeyExchange

RSA: Fast but no forward secrecy.

DHE: Forward secrecy but not fast enough.

ECDHE: Fast and forward secrecy

Page 19: Random musings on SSL/TLS configuration

Lets see them in action

https://www.ssllabs.com/ssltest

Page 20: Random musings on SSL/TLS configuration
Page 21: Random musings on SSL/TLS configuration
Page 22: Random musings on SSL/TLS configuration
Page 23: Random musings on SSL/TLS configuration
Page 24: Random musings on SSL/TLS configuration

Few takeaways: Keys

● 1024 bits is asking for trouble● 2048 bits minimal viable● 4096 good standard● Switch to ECDSA in future!

Page 25: Random musings on SSL/TLS configuration

Few takeaways: Keys

Generating ECDSA keys:256 bit key:openssl ecparam -name prime256v1 -genkey -out my.key

512 bit key:openssl ecparam -name secp521r1 -genkey -out my.key

Page 26: Random musings on SSL/TLS configuration

Few takeaways: Choosing a CA

● At least Supports Certificate Revocation List (CRL)

● Supports Online Certificate Status Protocol (OCSP)

● Accept trustiness of your Country/Corp CA

Page 27: Random musings on SSL/TLS configuration

Few takeaways: Renegotiation

Disable Client Initiated Renegotiation

Apache:

Nginx:

Page 28: Random musings on SSL/TLS configuration

Few takeaways: Performance

● Enable session resumption● Keep-Alive is your friend● Cache-Control: public

Page 29: Random musings on SSL/TLS configuration

Few takeaways: Security bits

● Ensure 3rd party CDN’s use SSL● Do not mix connection types

Page 30: Random musings on SSL/TLS configuration

Few takeaways: Security bits

Enable HSTS (HTTP Strict Transport Security) if possible.

Apache: (mod_headers) Header add Strict-Transport-Security "max-age=15768000;includeSubDomains"

nginx: (mod_headers) add_header Strict-Transport-Security "max-age=15768000;includeSubDomains"

Page 31: Random musings on SSL/TLS configuration

Few takeaway: Security bits

Apache :SSLProtocol ALL -SSLv2SSLHonorCipherOrder onSSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS

courtesy: @hynek

Page 32: Random musings on SSL/TLS configuration

Few takeaway: Security bits

nginx :ssl_prefer_server_ciphers on;ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;

courtesy: @hynek

Page 33: Random musings on SSL/TLS configuration

STARTTLS ≠ TLS

Page 34: Random musings on SSL/TLS configuration

STARTTLS ≠ TLS

Plain text communications viz. IMAP, POP, SMTP needed support for encrypted connections

Page 35: Random musings on SSL/TLS configuration

STARTTLS ≠ TLS

Simple solution, use a different port

IMAP uses port 143, SSL/TLS port 993.POP uses port 110, SSL/TLS port 995.SMTP uses port 25, SSL/TLS port 465.and LDAP, XMPP, etc.

Page 36: Random musings on SSL/TLS configuration

STARTTLS ≠ TLS

Simple solution, use a different port

IMAP uses port 143, SSL/TLS port 993.POP uses port 110, SSL/TLS port 995.SMTP uses port 25, SSL/TLS port 465.and LDAP, XMPP, etc.

But having 2 ports is just waste of resources....

Page 37: Random musings on SSL/TLS configuration

STARTTLS ≠ TLS

STARTTLS can simply be called to upgrade a plaintextconnection to TLS.

Page 38: Random musings on SSL/TLS configuration

Summary

Disable SSL v2.0

Page 39: Random musings on SSL/TLS configuration

Summary

Disable SSL v2.0

Use ECDHE wherever possible

Page 40: Random musings on SSL/TLS configuration

Summary

Disable SSL v2.0

Use ECDHE wherever possible

Page 41: Random musings on SSL/TLS configuration

Summary

Disable SSL v2.0

Use ECDHE wherever possible

Do not trust default pkgs

Page 42: Random musings on SSL/TLS configuration

< Thank you >