diff --git a/src/shrpx_ssl.cc b/src/shrpx_ssl.cc index d290ba23..74f5eae4 100644 --- a/src/shrpx_ssl.cc +++ b/src/shrpx_ssl.cc @@ -57,6 +57,12 @@ namespace shrpx { namespace ssl { +// Recommended general purpose "Non-Backward Compatible" cipher by +// mozilla. +// +// https://wiki.mozilla.org/Security/Server_Side_TLS +#define DEFAULT_CIPHER_LIST "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK" + namespace { int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len, void *arg) @@ -243,9 +249,7 @@ SSL_CTX* create_ssl_context(const char *private_key_file, if(get_config()->ciphers) { ciphers = get_config()->ciphers.get(); } else { - // Recommended general purpose cipher by mozilla. - // https://wiki.mozilla.org/Security/Server_Side_TLS - ciphers = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK"; + ciphers = DEFAULT_CIPHER_LIST; } SSL_CTX_set_options(ssl_ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); @@ -392,7 +396,7 @@ SSL_CTX* create_ssl_client_context() if(get_config()->ciphers) { ciphers = get_config()->ciphers.get(); } else { - ciphers = "HIGH:!aNULL:!eNULL"; + ciphers = "HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK"; } if(SSL_CTX_set_cipher_list(ssl_ctx, ciphers) == 0) { LOG(FATAL) << "SSL_CTX_set_cipher_list " << ciphers << " failed: "