bmcweb: update TLS cipher suites to mozilla modern

This is the second attempt to make cipher suites more restrictive.  This
was previously attempted in patchset
54fd221a9139f46c7c95b4a22cc09e6e7ce4cbbc

Which caused some compatibility issues.  This is the second attempt,
which does a better job.  OWASP does not enable eppiliptic curve TLS 1.2
cipher suites, which at this time are required for bmcweb to function.

Previously, bmcweb was utilitizing the "mozilla compatibility" cipher
suites.  This is overly lenient on broken ciphers and can cause some
issues with security reviews.

This commit also fixes our TLS logic to support _only_ TLS 1.2 and 1.3,
as only updating the cipher suites caused us to fall into TLS 1.3 only,
which broke compatibility with a lot of operating systems.

Tested by:
Ran the testssl.sh script here:
https://github.com/drwetter/testssl.sh

Observed the following in the output:

    testssl.sh       3.0rc3 from https://testssl.sh/dev/
    (977dc1ac4 2019-02-06 22:42:14 -- )

      This program is free software. Distribution and
             modification under GPLv2 permitted.
      USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

       Please file bugs @ https://testssl.sh/bugs/

 Using "OpenSSL 1.0.2-chacha (1.0.2k-dev)" [~183 ciphers]
 on Hades:/home/ed/testssl.sh/bin/openssl.Linux.x86_64
 (built: "Jan 18 17:12:17 2019", platform: "linux-x86_64")

 Start 2019-02-08 11:04:50        -->> 10.243.49.64:18080 (10.243.49.64) <<--

 rDNS (10.243.49.64):    wolfpass.jf.intel.com.
 Service detected:       HTTP

 Testing protocols via sockets except NPN+ALPN

 SSLv2      not offered (OK)
 SSLv3      not offered (OK)
 TLS 1      not offered
 TLS 1.1    not offered
 TLS 1.2    offered (OK)
 TLS 1.3    offered (OK): final
 NPN/SPDY   not offered
 ALPN/HTTP2 not offered

 Testing cipher categories

 NULL ciphers (no encryption)                  not offered (OK)
 Anonymous NULL Ciphers (no authentication)    not offered (OK)
 Export ciphers (w/o ADH+NULL)                 not offered (OK)
 LOW: 64 Bit + DES, RC[2,4] (w/o export)       not offered (OK)
 Triple DES Ciphers                            not offered (OK)
 128 Bit ciphers (SEED, IDEA, 128 Bit CBC)     offered
 High encryption (AES/Aria/Camellia, !AEAD)    offered (OK)
 Strong encryption (AEAD ciphers)              offered (OK)

 Testing robust (perfect) forward secrecy, (P)FS -- omitting Null Authentication/Encryption, 3DES, RC4

 PFS is offered (OK)          TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 ECDHE-ECDSA-AES256-GCM-SHA384
                              ECDHE-ECDSA-AES256-SHA384 ECDHE-ECDSA-CHACHA20-POLY1305 TLS_AES_128_GCM_SHA256
                              ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES128-SHA256
 Elliptic curves offered:     prime256v1 secp384r1 secp521r1 X25519 X448

 Testing server preferences

 Has server cipher order?     yes (OK) -- only for < TLS 1.3
 Negotiated protocol          TLSv1.3
 Negotiated cipher            TLS_AES_256_GCM_SHA384, 253 bit ECDH (X25519)
 Cipher order
    TLSv1.2:   ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES256-SHA384 ECDHE-ECDSA-CHACHA20-POLY1305 ECDHE-ECDSA-AES128-GCM-SHA256
               ECDHE-ECDSA-AES128-SHA256
    TLSv1.3:   TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 TLS_AES_128_GCM_SHA256

 Testing server defaults (Server Hello)

 TLS extensions (standard)    "renegotiation info/#65281" "EC point formats/#11" "session ticket/#35" "supported versions/#43"
                              "key share/#51" "supported_groups/#10" "max fragment length/#1" "encrypt-then-mac/#22"
                              "extended master secret/#23"
 Session Ticket RFC 5077 hint 7200 seconds, session tickets keys seems to be rotated < daily
 SSL Session ID support       yes
 Session Resumption           Tickets: yes, ID: no
 TLS clock skew               Random values, no fingerprinting possible
 Signature Algorithm          ECDSA with SHA256
 Server key size              EC 256 bits
 Server key usage             --
 Server extended key usage    --
 Serial / Fingerprints        669B86F0 / SHA1 0F6BF7C8F1AB59767FCA372A88F7F5457CFE00FB
                              SHA256 1D8C3AC5BA670C8C4EE8F5A76C8597226D89744510A4998B1A7888EF566256E5
 Common Name (CN)             testhost
 subjectAltName (SAN)         missing (NOT ok) -- Browsers are complaining
 Issuer                       self-signed (NOT ok)
 Trust (hostname)             certificate does not match supplied URI
 Chain of trust               NOT ok (self signed)
 EV cert (experimental)       no
 "eTLS" (visibility info)     not present
 Certificate Validity (UTC)   3648 >= 60 days (2019-02-07 10:23 --> 2029-02-04 10:23)
 # of certificates provided   1
 Certificate Revocation List  --
 OCSP URI                     --
                              NOT ok -- neither CRL nor OCSP URI provided
 OCSP stapling                not offered
 OCSP must staple extension   --
 DNS CAA RR (experimental)    not offered
 Certificate Transparency     --

 Testing HTTP header response @ "/"

 HTTP Status Code             200 OK
 HTTP clock skew              -83092 sec from localtime
 Strict Transport Security    365 days=31536000 s, includeSubDomains, preload
 Public Key Pinning           --
 Server banner                iBMC
 Application banner           --
 Cookie(s)                    (none issued at "/")
 Security headers             X-Frame-Options DENY
                              X-XSS-Protection 1; mode=block
                              X-Content-Type-Options nosniff
                              Content-Security-Policy default-src 'self'
                              X-UA-Compatible IE=11
 Reverse Proxy banner         --

 Testing vulnerabilities

 Heartbleed (CVE-2014-0160)                not vulnerable (OK), no heartbeat extension
 CCS (CVE-2014-0224)                       not vulnerable (OK)
 Ticketbleed (CVE-2016-9244), experiment.  not vulnerable (OK), reply empty
 ROBOT                                     Server does not support any cipher suites that use RSA key transport
 Secure Renegotiation (CVE-2009-3555)      not vulnerable (OK)
 Secure Client-Initiated Renegotiation     VULNERABLE (NOT ok), DoS threat
 CRIME, TLS (CVE-2012-4929)                not vulnerable (OK)
 BREACH (CVE-2013-3587)                    potentially NOT ok, uses gzip HTTP compression. - only supplied "/" tested
                                           Can be ignored for static pages or if no secrets in the page
 POODLE, SSL (CVE-2014-3566)               not vulnerable (OK)
 TLS_FALLBACK_SCSV (RFC 7507)              No fallback possible, no protocol below TLS 1.2 offered (OK)
 SWEET32 (CVE-2016-2183, CVE-2016-6329)    not vulnerable (OK)
 FREAK (CVE-2015-0204)                     not vulnerable (OK)
 DROWN (CVE-2016-0800, CVE-2016-0703)      not vulnerable on this host and port (OK)
                                           no RSA certificate, thus certificate can't be used with SSLv2 elsewhere
 LOGJAM (CVE-2015-4000), experimental      not vulnerable (OK): no DH EXPORT ciphers, no DH key detected with <= TLS 1.2
 BEAST (CVE-2011-3389)                     no SSL3 or TLS1 (OK)
 LUCKY13 (CVE-2013-0169), experimental     potentially VULNERABLE, uses cipher block chaining (CBC) ciphers with TLS. Check patches
 RC4 (CVE-2013-2566, CVE-2015-2808)        no RC4 ciphers detected (OK)

 Testing 370 ciphers via OpenSSL plus sockets against the server, ordered by encryption strength

Hexcode  Cipher Suite Name (OpenSSL)       KeyExch.   Encryption  Bits     Cipher Suite Name (IANA/RFC)
-----------------------------------------------------------------------------------------------------------------------------
 x1302   TLS_AES_256_GCM_SHA384            ECDH 253   AESGCM      256      TLS_AES_256_GCM_SHA384
 x1303   TLS_CHACHA20_POLY1305_SHA256      ECDH 253   ChaCha20    256      TLS_CHACHA20_POLY1305_SHA256
 xc02c   ECDHE-ECDSA-AES256-GCM-SHA384     ECDH 521   AESGCM      256      TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
 xc024   ECDHE-ECDSA-AES256-SHA384         ECDH 521   AES         256      TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
 xcca9   ECDHE-ECDSA-CHACHA20-POLY1305     ECDH 521   ChaCha20    256      TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
 x1301   TLS_AES_128_GCM_SHA256            ECDH 253   AESGCM      128      TLS_AES_128_GCM_SHA256
 xc02b   ECDHE-ECDSA-AES128-GCM-SHA256     ECDH 521   AESGCM      128      TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
 xc023   ECDHE-ECDSA-AES128-SHA256         ECDH 521   AES         128      TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256

 Running client simulations (HTTP) via sockets

 Android 4.2.2                No connection
 Android 4.4.2                TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 521 bit ECDH (P-521)
 Android 5.0.0                TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256, 521 bit ECDH (P-521)
 Android 6.0                  TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256, 256 bit ECDH (P-256)
 Android 7.0                  TLSv1.2 ECDHE-ECDSA-CHACHA20-POLY1305, 253 bit ECDH (X25519)
 Chrome 65 Win 7              TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256, 253 bit ECDH (X25519)
 Chrome 70 Win 10             TLSv1.3 TLS_AES_128_GCM_SHA256, 253 bit ECDH (X25519)
 Firefox 59 Win 7             TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256, 253 bit ECDH (X25519)
 Firefox 62 Win 7             TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256, 253 bit ECDH (X25519)
 IE 6 XP                      No connection
 IE 7 Vista                   No connection
 IE 8 Win 7                   No connection
 IE 8 XP                      No connection
 IE 11 Win 7                  TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 IE 11 Win 8.1                TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 IE 11 Win Phone 8.1          TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256, 256 bit ECDH (P-256)
 IE 11 Win 10                 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 Edge 13 Win 10               TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 Edge 13 Win Phone 10         TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 Edge 15 Win 10               TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 253 bit ECDH (X25519)
 Opera 17 Win 7               TLSv1.2 ECDHE-ECDSA-AES128-SHA256, 256 bit ECDH (P-256)
 Safari 9 iOS 9               TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 Safari 9 OS X 10.11          TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 Safari 10 OS X 10.12         TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 Apple ATS 9 iOS 9            TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 Tor 17.0.9 Win 7             No connection
 Java 6u45                    No connection
 Java 7u25                    No connection
 Java 8u161                   TLSv1.2 ECDHE-ECDSA-AES256-SHA384, 256 bit ECDH (P-256)
 Java 9.0.4                   TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)
 OpenSSL 1.0.1l               TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 521 bit ECDH (P-521)
 OpenSSL 1.0.2e               TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bit ECDH (P-256)

 Done 2019-02-08 11:06:45 [ 118s] -->> 10.243.49.64:18080 (10.243.49.64) <<--

Change-Id: I92a77807848354379ea2cbaa31767eeceadae295
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index 32d7a73..34a7c04 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -282,7 +282,8 @@
 
 inline boost::asio::ssl::context getSslContext(const std::string &ssl_pem_file)
 {
-    boost::asio::ssl::context mSslContext{boost::asio::ssl::context::sslv23};
+    boost::asio::ssl::context mSslContext{
+        boost::asio::ssl::context::tls_server};
     mSslContext.set_options(boost::asio::ssl::context::default_workarounds |
                             boost::asio::ssl::context::no_sslv2 |
                             boost::asio::ssl::context::no_sslv3 |
@@ -305,55 +306,19 @@
         BMCWEB_LOG_ERROR << "Error setting tmp ecdh list\n";
     }
 
-    // From mozilla "compatibility"
-    std::string mozillaCompatibilityCiphers = "ECDHE-ECDSA-CHACHA20-POLY1305:"
-                                              "ECDHE-RSA-CHACHA20-POLY1305:"
-                                              "ECDHE-ECDSA-AES128-GCM-SHA256:"
-                                              "ECDHE-RSA-AES128-GCM-SHA256:"
-                                              "ECDHE-ECDSA-AES256-GCM-SHA384:"
-                                              "ECDHE-RSA-AES256-GCM-SHA384:"
-                                              "DHE-RSA-AES128-GCM-SHA256:"
-                                              "DHE-RSA-AES256-GCM-SHA384:"
-                                              "ECDHE-ECDSA-AES128-SHA256:"
-                                              "ECDHE-RSA-AES128-SHA256:"
-                                              "ECDHE-ECDSA-AES128-SHA:"
-                                              "ECDHE-RSA-AES256-SHA384:"
-                                              "ECDHE-RSA-AES128-SHA:"
-                                              "ECDHE-ECDSA-AES256-SHA384:"
-                                              "ECDHE-ECDSA-AES256-SHA:"
-                                              "ECDHE-RSA-AES256-SHA:"
-                                              "DHE-RSA-AES128-SHA256:"
-                                              "DHE-RSA-AES128-SHA:"
-                                              "DHE-RSA-AES256-SHA256:"
-                                              "DHE-RSA-AES256-SHA:"
-                                              "ECDHE-ECDSA-DES-CBC3-SHA:"
-                                              "ECDHE-RSA-DES-CBC3-SHA:"
-                                              "EDH-RSA-DES-CBC3-SHA:"
-                                              "AES128-GCM-SHA256:"
-                                              "AES256-GCM-SHA384:"
-                                              "AES128-SHA256:"
-                                              "AES256-SHA256:"
-                                              "AES128-SHA:"
-                                              "AES256-SHA:"
-                                              "DES-CBC3-SHA:"
-                                              "!DSS";
-
-    // From mozilla "modern"
-    std::string mozillaModernCiphers = "ECDHE-ECDSA-AES256-GCM-SHA384:"
-                                       "ECDHE-RSA-AES256-GCM-SHA384:"
-                                       "ECDHE-ECDSA-CHACHA20-POLY1305:"
-                                       "ECDHE-RSA-CHACHA20-POLY1305:"
-                                       "ECDHE-ECDSA-AES128-GCM-SHA256:"
-                                       "ECDHE-RSA-AES128-GCM-SHA256:"
-                                       "ECDHE-ECDSA-AES256-SHA384:"
-                                       "ECDHE-RSA-AES256-SHA384:"
-                                       "ECDHE-ECDSA-AES128-SHA256:"
-                                       "ECDHE-RSA-AES128-SHA256";
-
-    std::string aesOnlyCiphers = "AES128+EECDH:AES128+EDH:!aNULL:!eNULL";
+    std::string mozillaModern = "ECDHE-ECDSA-AES256-GCM-SHA384:"
+                                "ECDHE-RSA-AES256-GCM-SHA384:"
+                                "ECDHE-ECDSA-CHACHA20-POLY1305:"
+                                "ECDHE-RSA-CHACHA20-POLY1305:"
+                                "ECDHE-ECDSA-AES128-GCM-SHA256:"
+                                "ECDHE-RSA-AES128-GCM-SHA256:"
+                                "ECDHE-ECDSA-AES256-SHA384:"
+                                "ECDHE-RSA-AES256-SHA384:"
+                                "ECDHE-ECDSA-AES128-SHA256:"
+                                "ECDHE-RSA-AES128-SHA256";
 
     if (SSL_CTX_set_cipher_list(mSslContext.native_handle(),
-                                mozillaCompatibilityCiphers.c_str()) != 1)
+                                mozillaModern.c_str()) != 1)
     {
         BMCWEB_LOG_ERROR << "Error setting cipher list\n";
     }