nghttpx: Don't allow blacked listed cipher suites for HTTP/2 connection

This commit is contained in:
Tatsuhiro Tsujikawa 2015-08-19 23:33:53 +09:00
parent 059280d1a5
commit 1c12606e70
6 changed files with 888 additions and 24 deletions

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script read cipher suite list csv file [1] and prints out ECDHE
# or DHE with AEAD ciphers only. The output is used by
# src/shrpx_ssl.cc.
# This script read cipher suite list csv file [1] and prints out id
# and name of black listed cipher suites. The output is used by
# src/ssl.cc.
#
# [1] http://www.iana.org/assignments/tls-parameters/tls-parameters-4.csv
# [2] http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
@ -13,13 +13,294 @@ import re
import sys
import csv
pat = re.compile(r'\ATLS_(?:ECDHE|DHE)_.*_GCM')
# From RFC 7540
blacklist = [
'TLS_NULL_WITH_NULL_NULL',
'TLS_RSA_WITH_NULL_MD5',
'TLS_RSA_WITH_NULL_SHA',
'TLS_RSA_EXPORT_WITH_RC4_40_MD5',
'TLS_RSA_WITH_RC4_128_MD5',
'TLS_RSA_WITH_RC4_128_SHA',
'TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5',
'TLS_RSA_WITH_IDEA_CBC_SHA',
'TLS_RSA_EXPORT_WITH_DES40_CBC_SHA',
'TLS_RSA_WITH_DES_CBC_SHA',
'TLS_RSA_WITH_3DES_EDE_CBC_SHA',
'TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA',
'TLS_DH_DSS_WITH_DES_CBC_SHA',
'TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA',
'TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA',
'TLS_DH_RSA_WITH_DES_CBC_SHA',
'TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA',
'TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA',
'TLS_DHE_DSS_WITH_DES_CBC_SHA',
'TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA',
'TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA',
'TLS_DHE_RSA_WITH_DES_CBC_SHA',
'TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA',
'TLS_DH_anon_EXPORT_WITH_RC4_40_MD5',
'TLS_DH_anon_WITH_RC4_128_MD5',
'TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA',
'TLS_DH_anon_WITH_DES_CBC_SHA',
'TLS_DH_anon_WITH_3DES_EDE_CBC_SHA',
'TLS_KRB5_WITH_DES_CBC_SHA',
'TLS_KRB5_WITH_3DES_EDE_CBC_SHA',
'TLS_KRB5_WITH_RC4_128_SHA',
'TLS_KRB5_WITH_IDEA_CBC_SHA',
'TLS_KRB5_WITH_DES_CBC_MD5',
'TLS_KRB5_WITH_3DES_EDE_CBC_MD5',
'TLS_KRB5_WITH_RC4_128_MD5',
'TLS_KRB5_WITH_IDEA_CBC_MD5',
'TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA',
'TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA',
'TLS_KRB5_EXPORT_WITH_RC4_40_SHA',
'TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5',
'TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5',
'TLS_KRB5_EXPORT_WITH_RC4_40_MD5',
'TLS_PSK_WITH_NULL_SHA',
'TLS_DHE_PSK_WITH_NULL_SHA',
'TLS_RSA_PSK_WITH_NULL_SHA',
'TLS_RSA_WITH_AES_128_CBC_SHA',
'TLS_DH_DSS_WITH_AES_128_CBC_SHA',
'TLS_DH_RSA_WITH_AES_128_CBC_SHA',
'TLS_DHE_DSS_WITH_AES_128_CBC_SHA',
'TLS_DHE_RSA_WITH_AES_128_CBC_SHA',
'TLS_DH_anon_WITH_AES_128_CBC_SHA',
'TLS_RSA_WITH_AES_256_CBC_SHA',
'TLS_DH_DSS_WITH_AES_256_CBC_SHA',
'TLS_DH_RSA_WITH_AES_256_CBC_SHA',
'TLS_DHE_DSS_WITH_AES_256_CBC_SHA',
'TLS_DHE_RSA_WITH_AES_256_CBC_SHA',
'TLS_DH_anon_WITH_AES_256_CBC_SHA',
'TLS_RSA_WITH_NULL_SHA256',
'TLS_RSA_WITH_AES_128_CBC_SHA256',
'TLS_RSA_WITH_AES_256_CBC_SHA256',
'TLS_DH_DSS_WITH_AES_128_CBC_SHA256',
'TLS_DH_RSA_WITH_AES_128_CBC_SHA256',
'TLS_DHE_DSS_WITH_AES_128_CBC_SHA256',
'TLS_RSA_WITH_CAMELLIA_128_CBC_SHA',
'TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA',
'TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA',
'TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA',
'TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA',
'TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA',
'TLS_DHE_RSA_WITH_AES_128_CBC_SHA256',
'TLS_DH_DSS_WITH_AES_256_CBC_SHA256',
'TLS_DH_RSA_WITH_AES_256_CBC_SHA256',
'TLS_DHE_DSS_WITH_AES_256_CBC_SHA256',
'TLS_DHE_RSA_WITH_AES_256_CBC_SHA256',
'TLS_DH_anon_WITH_AES_128_CBC_SHA256',
'TLS_DH_anon_WITH_AES_256_CBC_SHA256',
'TLS_RSA_WITH_CAMELLIA_256_CBC_SHA',
'TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA',
'TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA',
'TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA',
'TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA',
'TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA',
'TLS_PSK_WITH_RC4_128_SHA',
'TLS_PSK_WITH_3DES_EDE_CBC_SHA',
'TLS_PSK_WITH_AES_128_CBC_SHA',
'TLS_PSK_WITH_AES_256_CBC_SHA',
'TLS_DHE_PSK_WITH_RC4_128_SHA',
'TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA',
'TLS_DHE_PSK_WITH_AES_128_CBC_SHA',
'TLS_DHE_PSK_WITH_AES_256_CBC_SHA',
'TLS_RSA_PSK_WITH_RC4_128_SHA',
'TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA',
'TLS_RSA_PSK_WITH_AES_128_CBC_SHA',
'TLS_RSA_PSK_WITH_AES_256_CBC_SHA',
'TLS_RSA_WITH_SEED_CBC_SHA',
'TLS_DH_DSS_WITH_SEED_CBC_SHA',
'TLS_DH_RSA_WITH_SEED_CBC_SHA',
'TLS_DHE_DSS_WITH_SEED_CBC_SHA',
'TLS_DHE_RSA_WITH_SEED_CBC_SHA',
'TLS_DH_anon_WITH_SEED_CBC_SHA',
'TLS_RSA_WITH_AES_128_GCM_SHA256',
'TLS_RSA_WITH_AES_256_GCM_SHA384',
'TLS_DH_RSA_WITH_AES_128_GCM_SHA256',
'TLS_DH_RSA_WITH_AES_256_GCM_SHA384',
'TLS_DH_DSS_WITH_AES_128_GCM_SHA256',
'TLS_DH_DSS_WITH_AES_256_GCM_SHA384',
'TLS_DH_anon_WITH_AES_128_GCM_SHA256',
'TLS_DH_anon_WITH_AES_256_GCM_SHA384',
'TLS_PSK_WITH_AES_128_GCM_SHA256',
'TLS_PSK_WITH_AES_256_GCM_SHA384',
'TLS_RSA_PSK_WITH_AES_128_GCM_SHA256',
'TLS_RSA_PSK_WITH_AES_256_GCM_SHA384',
'TLS_PSK_WITH_AES_128_CBC_SHA256',
'TLS_PSK_WITH_AES_256_CBC_SHA384',
'TLS_PSK_WITH_NULL_SHA256',
'TLS_PSK_WITH_NULL_SHA384',
'TLS_DHE_PSK_WITH_AES_128_CBC_SHA256',
'TLS_DHE_PSK_WITH_AES_256_CBC_SHA384',
'TLS_DHE_PSK_WITH_NULL_SHA256',
'TLS_DHE_PSK_WITH_NULL_SHA384',
'TLS_RSA_PSK_WITH_AES_128_CBC_SHA256',
'TLS_RSA_PSK_WITH_AES_256_CBC_SHA384',
'TLS_RSA_PSK_WITH_NULL_SHA256',
'TLS_RSA_PSK_WITH_NULL_SHA384',
'TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256',
'TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256',
'TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256',
'TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256',
'TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256',
'TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256',
'TLS_EMPTY_RENEGOTIATION_INFO_SCSV',
'TLS_ECDH_ECDSA_WITH_NULL_SHA',
'TLS_ECDH_ECDSA_WITH_RC4_128_SHA',
'TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA',
'TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA',
'TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA',
'TLS_ECDHE_ECDSA_WITH_NULL_SHA',
'TLS_ECDHE_ECDSA_WITH_RC4_128_SHA',
'TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA',
'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA',
'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA',
'TLS_ECDH_RSA_WITH_NULL_SHA',
'TLS_ECDH_RSA_WITH_RC4_128_SHA',
'TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA',
'TLS_ECDH_RSA_WITH_AES_128_CBC_SHA',
'TLS_ECDH_RSA_WITH_AES_256_CBC_SHA',
'TLS_ECDHE_RSA_WITH_NULL_SHA',
'TLS_ECDHE_RSA_WITH_RC4_128_SHA',
'TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA',
'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA',
'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA',
'TLS_ECDH_anon_WITH_NULL_SHA',
'TLS_ECDH_anon_WITH_RC4_128_SHA',
'TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA',
'TLS_ECDH_anon_WITH_AES_128_CBC_SHA',
'TLS_ECDH_anon_WITH_AES_256_CBC_SHA',
'TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA',
'TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA',
'TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA',
'TLS_SRP_SHA_WITH_AES_128_CBC_SHA',
'TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA',
'TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA',
'TLS_SRP_SHA_WITH_AES_256_CBC_SHA',
'TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA',
'TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA',
'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256',
'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384',
'TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256',
'TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384',
'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256',
'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384',
'TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256',
'TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384',
'TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256',
'TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384',
'TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256',
'TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384',
'TLS_ECDHE_PSK_WITH_RC4_128_SHA',
'TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA',
'TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA',
'TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA',
'TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256',
'TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384',
'TLS_ECDHE_PSK_WITH_NULL_SHA',
'TLS_ECDHE_PSK_WITH_NULL_SHA256',
'TLS_ECDHE_PSK_WITH_NULL_SHA384',
'TLS_RSA_WITH_ARIA_128_CBC_SHA256',
'TLS_RSA_WITH_ARIA_256_CBC_SHA384',
'TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256',
'TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384',
'TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256',
'TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384',
'TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256',
'TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384',
'TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256',
'TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384',
'TLS_DH_anon_WITH_ARIA_128_CBC_SHA256',
'TLS_DH_anon_WITH_ARIA_256_CBC_SHA384',
'TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256',
'TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384',
'TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256',
'TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384',
'TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256',
'TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384',
'TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256',
'TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384',
'TLS_RSA_WITH_ARIA_128_GCM_SHA256',
'TLS_RSA_WITH_ARIA_256_GCM_SHA384',
'TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256',
'TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384',
'TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256',
'TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384',
'TLS_DH_anon_WITH_ARIA_128_GCM_SHA256',
'TLS_DH_anon_WITH_ARIA_256_GCM_SHA384',
'TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256',
'TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384',
'TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256',
'TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384',
'TLS_PSK_WITH_ARIA_128_CBC_SHA256',
'TLS_PSK_WITH_ARIA_256_CBC_SHA384',
'TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256',
'TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384',
'TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256',
'TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384',
'TLS_PSK_WITH_ARIA_128_GCM_SHA256',
'TLS_PSK_WITH_ARIA_256_GCM_SHA384',
'TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256',
'TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384',
'TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256',
'TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384',
'TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256',
'TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384',
'TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256',
'TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384',
'TLS_RSA_WITH_AES_128_CCM',
'TLS_RSA_WITH_AES_256_CCM',
'TLS_RSA_WITH_AES_128_CCM_8',
'TLS_RSA_WITH_AES_256_CCM_8',
'TLS_PSK_WITH_AES_128_CCM',
'TLS_PSK_WITH_AES_256_CCM',
'TLS_PSK_WITH_AES_128_CCM_8',
'TLS_PSK_WITH_AES_256_CCM_8',
]
ciphers = []
found = set()
for hl, name, _, _ in csv.reader(sys.stdin):
if not pat.match(name):
if name not in blacklist:
continue
found.add(name)
high, low = hl.split(',')
id = high + low[2:] + 'u'
@ -38,3 +319,8 @@ print '''\
for id, name in ciphers:
print '''\
case {}:'''.format(name)
if len(found) != len(blacklist):
print '{} found out of {}; not all cipher was found: {}'.format(
len(found), len(blacklist),
found.symmetric_difference(blacklist))

View File

@ -45,6 +45,7 @@
#endif // HAVE_SPDYLAY
#include "util.h"
#include "template.h"
#include "ssl.h"
using namespace nghttp2;
@ -473,7 +474,12 @@ int ClientHandler::validate_next_proto() {
auto http2_upstream = make_unique<Http2Upstream>(this);
if (!ssl::check_http2_requirement(conn_.tls.ssl)) {
if (!nghttp2::ssl::check_http2_requirement(conn_.tls.ssl)) {
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "TLSv1.2 was not negotiated. "
<< "HTTP/2 must not be negotiated.";
}
rv = http2_upstream->terminate_session(NGHTTP2_INADEQUATE_SECURITY);
if (rv != 0) {

View File

@ -46,6 +46,7 @@
#include "http2.h"
#include "util.h"
#include "base64.h"
#include "ssl.h"
using namespace nghttp2;
@ -1296,9 +1297,13 @@ int Http2Session::connection_made() {
}
auto must_terminate = !get_config()->downstream_no_tls &&
!ssl::check_http2_requirement(conn_.tls.ssl);
!nghttp2::ssl::check_http2_requirement(conn_.tls.ssl);
if (must_terminate) {
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "TLSv1.2 was not negotiated. HTTP/2 must not be negotiated.";
}
rv = terminate_session(NGHTTP2_INADEQUATE_SECURITY);
if (rv != 0) {

View File

@ -1093,23 +1093,6 @@ bool in_proto_list(const std::vector<std::string> &protos,
return false;
}
bool check_http2_requirement(SSL *ssl) {
auto tls_ver = SSL_version(ssl);
switch (tls_ver) {
case TLS1_2_VERSION:
break;
default:
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "TLSv1.2 was not negotiated. "
<< "HTTP/2 must not be negotiated.";
}
return false;
}
return true;
}
SSL_CTX *setup_server_ssl_context(std::vector<SSL_CTX *> &all_ssl_ctx,
CertLookupTree *cert_tree) {
if (get_config()->upstream_no_tls) {

View File

@ -119,6 +119,582 @@ TLSSessionInfo *get_tls_session_info(TLSSessionInfo *tls_info, SSL *ssl) {
return tls_info;
}
// The black listed cipher suites for HTTP/2 described in RFC 7540.
enum {
TLS_NULL_WITH_NULL_NULL = 0x0000u,
TLS_RSA_WITH_NULL_MD5 = 0x0001u,
TLS_RSA_WITH_NULL_SHA = 0x0002u,
TLS_RSA_EXPORT_WITH_RC4_40_MD5 = 0x0003u,
TLS_RSA_WITH_RC4_128_MD5 = 0x0004u,
TLS_RSA_WITH_RC4_128_SHA = 0x0005u,
TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 0x0006u,
TLS_RSA_WITH_IDEA_CBC_SHA = 0x0007u,
TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0008u,
TLS_RSA_WITH_DES_CBC_SHA = 0x0009u,
TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000Au,
TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x000Bu,
TLS_DH_DSS_WITH_DES_CBC_SHA = 0x000Cu,
TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = 0x000Du,
TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x000Eu,
TLS_DH_RSA_WITH_DES_CBC_SHA = 0x000Fu,
TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = 0x0010u,
TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x0011u,
TLS_DHE_DSS_WITH_DES_CBC_SHA = 0x0012u,
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x0013u,
TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0014u,
TLS_DHE_RSA_WITH_DES_CBC_SHA = 0x0015u,
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016u,
TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x0017u,
TLS_DH_anon_WITH_RC4_128_MD5 = 0x0018u,
TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x0019u,
TLS_DH_anon_WITH_DES_CBC_SHA = 0x001Au,
TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x001Bu,
TLS_KRB5_WITH_DES_CBC_SHA = 0x001Eu,
TLS_KRB5_WITH_3DES_EDE_CBC_SHA = 0x001Fu,
TLS_KRB5_WITH_RC4_128_SHA = 0x0020u,
TLS_KRB5_WITH_IDEA_CBC_SHA = 0x0021u,
TLS_KRB5_WITH_DES_CBC_MD5 = 0x0022u,
TLS_KRB5_WITH_3DES_EDE_CBC_MD5 = 0x0023u,
TLS_KRB5_WITH_RC4_128_MD5 = 0x0024u,
TLS_KRB5_WITH_IDEA_CBC_MD5 = 0x0025u,
TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA = 0x0026u,
TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA = 0x0027u,
TLS_KRB5_EXPORT_WITH_RC4_40_SHA = 0x0028u,
TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 = 0x0029u,
TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 = 0x002Au,
TLS_KRB5_EXPORT_WITH_RC4_40_MD5 = 0x002Bu,
TLS_PSK_WITH_NULL_SHA = 0x002Cu,
TLS_DHE_PSK_WITH_NULL_SHA = 0x002Du,
TLS_RSA_PSK_WITH_NULL_SHA = 0x002Eu,
TLS_RSA_WITH_AES_128_CBC_SHA = 0x002Fu,
TLS_DH_DSS_WITH_AES_128_CBC_SHA = 0x0030u,
TLS_DH_RSA_WITH_AES_128_CBC_SHA = 0x0031u,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032u,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033u,
TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x0034u,
TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035u,
TLS_DH_DSS_WITH_AES_256_CBC_SHA = 0x0036u,
TLS_DH_RSA_WITH_AES_256_CBC_SHA = 0x0037u,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 0x0038u,
TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x0039u,
TLS_DH_anon_WITH_AES_256_CBC_SHA = 0x003Au,
TLS_RSA_WITH_NULL_SHA256 = 0x003Bu,
TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x003Cu,
TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x003Du,
TLS_DH_DSS_WITH_AES_128_CBC_SHA256 = 0x003Eu,
TLS_DH_RSA_WITH_AES_128_CBC_SHA256 = 0x003Fu,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 0x0040u,
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x0041u,
TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA = 0x0042u,
TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x0043u,
TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA = 0x0044u,
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x0045u,
TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA = 0x0046u,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x0067u,
TLS_DH_DSS_WITH_AES_256_CBC_SHA256 = 0x0068u,
TLS_DH_RSA_WITH_AES_256_CBC_SHA256 = 0x0069u,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 0x006Au,
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x006Bu,
TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 0x006Cu,
TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 0x006Du,
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x0084u,
TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA = 0x0085u,
TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x0086u,
TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA = 0x0087u,
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x0088u,
TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA = 0x0089u,
TLS_PSK_WITH_RC4_128_SHA = 0x008Au,
TLS_PSK_WITH_3DES_EDE_CBC_SHA = 0x008Bu,
TLS_PSK_WITH_AES_128_CBC_SHA = 0x008Cu,
TLS_PSK_WITH_AES_256_CBC_SHA = 0x008Du,
TLS_DHE_PSK_WITH_RC4_128_SHA = 0x008Eu,
TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA = 0x008Fu,
TLS_DHE_PSK_WITH_AES_128_CBC_SHA = 0x0090u,
TLS_DHE_PSK_WITH_AES_256_CBC_SHA = 0x0091u,
TLS_RSA_PSK_WITH_RC4_128_SHA = 0x0092u,
TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA = 0x0093u,
TLS_RSA_PSK_WITH_AES_128_CBC_SHA = 0x0094u,
TLS_RSA_PSK_WITH_AES_256_CBC_SHA = 0x0095u,
TLS_RSA_WITH_SEED_CBC_SHA = 0x0096u,
TLS_DH_DSS_WITH_SEED_CBC_SHA = 0x0097u,
TLS_DH_RSA_WITH_SEED_CBC_SHA = 0x0098u,
TLS_DHE_DSS_WITH_SEED_CBC_SHA = 0x0099u,
TLS_DHE_RSA_WITH_SEED_CBC_SHA = 0x009Au,
TLS_DH_anon_WITH_SEED_CBC_SHA = 0x009Bu,
TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x009Cu,
TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x009Du,
TLS_DH_RSA_WITH_AES_128_GCM_SHA256 = 0x00A0u,
TLS_DH_RSA_WITH_AES_256_GCM_SHA384 = 0x00A1u,
TLS_DH_DSS_WITH_AES_128_GCM_SHA256 = 0x00A4u,
TLS_DH_DSS_WITH_AES_256_GCM_SHA384 = 0x00A5u,
TLS_DH_anon_WITH_AES_128_GCM_SHA256 = 0x00A6u,
TLS_DH_anon_WITH_AES_256_GCM_SHA384 = 0x00A7u,
TLS_PSK_WITH_AES_128_GCM_SHA256 = 0x00A8u,
TLS_PSK_WITH_AES_256_GCM_SHA384 = 0x00A9u,
TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 = 0x00ACu,
TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 = 0x00ADu,
TLS_PSK_WITH_AES_128_CBC_SHA256 = 0x00AEu,
TLS_PSK_WITH_AES_256_CBC_SHA384 = 0x00AFu,
TLS_PSK_WITH_NULL_SHA256 = 0x00B0u,
TLS_PSK_WITH_NULL_SHA384 = 0x00B1u,
TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 = 0x00B2u,
TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 = 0x00B3u,
TLS_DHE_PSK_WITH_NULL_SHA256 = 0x00B4u,
TLS_DHE_PSK_WITH_NULL_SHA384 = 0x00B5u,
TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 = 0x00B6u,
TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 = 0x00B7u,
TLS_RSA_PSK_WITH_NULL_SHA256 = 0x00B8u,
TLS_RSA_PSK_WITH_NULL_SHA384 = 0x00B9u,
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BAu,
TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BBu,
TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BCu,
TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BDu,
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BEu,
TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BFu,
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C0u,
TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C1u,
TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C2u,
TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C3u,
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C4u,
TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C5u,
TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 0x00FFu,
TLS_ECDH_ECDSA_WITH_NULL_SHA = 0xC001u,
TLS_ECDH_ECDSA_WITH_RC4_128_SHA = 0xC002u,
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC003u,
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA = 0xC004u,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005u,
TLS_ECDHE_ECDSA_WITH_NULL_SHA = 0xC006u,
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA = 0xC007u,
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC008u,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xC009u,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00Au,
TLS_ECDH_RSA_WITH_NULL_SHA = 0xC00Bu,
TLS_ECDH_RSA_WITH_RC4_128_SHA = 0xC00Cu,
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA = 0xC00Du,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA = 0xC00Eu,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA = 0xC00Fu,
TLS_ECDHE_RSA_WITH_NULL_SHA = 0xC010u,
TLS_ECDHE_RSA_WITH_RC4_128_SHA = 0xC011u,
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA = 0xC012u,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xC013u,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014u,
TLS_ECDH_anon_WITH_NULL_SHA = 0xC015u,
TLS_ECDH_anon_WITH_RC4_128_SHA = 0xC016u,
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA = 0xC017u,
TLS_ECDH_anon_WITH_AES_128_CBC_SHA = 0xC018u,
TLS_ECDH_anon_WITH_AES_256_CBC_SHA = 0xC019u,
TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA = 0xC01Au,
TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA = 0xC01Bu,
TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA = 0xC01Cu,
TLS_SRP_SHA_WITH_AES_128_CBC_SHA = 0xC01Du,
TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA = 0xC01Eu,
TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA = 0xC01Fu,
TLS_SRP_SHA_WITH_AES_256_CBC_SHA = 0xC020u,
TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA = 0xC021u,
TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA = 0xC022u,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC023u,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC024u,
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC025u,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC026u,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0xC027u,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0xC028u,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 = 0xC029u,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 = 0xC02Au,
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02Du,
TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02Eu,
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 = 0xC031u,
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = 0xC032u,
TLS_ECDHE_PSK_WITH_RC4_128_SHA = 0xC033u,
TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA = 0xC034u,
TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA = 0xC035u,
TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA = 0xC036u,
TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 = 0xC037u,
TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 = 0xC038u,
TLS_ECDHE_PSK_WITH_NULL_SHA = 0xC039u,
TLS_ECDHE_PSK_WITH_NULL_SHA256 = 0xC03Au,
TLS_ECDHE_PSK_WITH_NULL_SHA384 = 0xC03Bu,
TLS_RSA_WITH_ARIA_128_CBC_SHA256 = 0xC03Cu,
TLS_RSA_WITH_ARIA_256_CBC_SHA384 = 0xC03Du,
TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256 = 0xC03Eu,
TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384 = 0xC03Fu,
TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256 = 0xC040u,
TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384 = 0xC041u,
TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256 = 0xC042u,
TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384 = 0xC043u,
TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 = 0xC044u,
TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 = 0xC045u,
TLS_DH_anon_WITH_ARIA_128_CBC_SHA256 = 0xC046u,
TLS_DH_anon_WITH_ARIA_256_CBC_SHA384 = 0xC047u,
TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 = 0xC048u,
TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 = 0xC049u,
TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 = 0xC04Au,
TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 = 0xC04Bu,
TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 = 0xC04Cu,
TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 = 0xC04Du,
TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 = 0xC04Eu,
TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 = 0xC04Fu,
TLS_RSA_WITH_ARIA_128_GCM_SHA256 = 0xC050u,
TLS_RSA_WITH_ARIA_256_GCM_SHA384 = 0xC051u,
TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256 = 0xC054u,
TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384 = 0xC055u,
TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256 = 0xC058u,
TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384 = 0xC059u,
TLS_DH_anon_WITH_ARIA_128_GCM_SHA256 = 0xC05Au,
TLS_DH_anon_WITH_ARIA_256_GCM_SHA384 = 0xC05Bu,
TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 = 0xC05Eu,
TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 = 0xC05Fu,
TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 = 0xC062u,
TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 = 0xC063u,
TLS_PSK_WITH_ARIA_128_CBC_SHA256 = 0xC064u,
TLS_PSK_WITH_ARIA_256_CBC_SHA384 = 0xC065u,
TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 = 0xC066u,
TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 = 0xC067u,
TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 = 0xC068u,
TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 = 0xC069u,
TLS_PSK_WITH_ARIA_128_GCM_SHA256 = 0xC06Au,
TLS_PSK_WITH_ARIA_256_GCM_SHA384 = 0xC06Bu,
TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 = 0xC06Eu,
TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 = 0xC06Fu,
TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 = 0xC070u,
TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 = 0xC071u,
TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC072u,
TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC073u,
TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC074u,
TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC075u,
TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC076u,
TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC077u,
TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC078u,
TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC079u,
TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC07Au,
TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC07Bu,
TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC07Eu,
TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC07Fu,
TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256 = 0xC082u,
TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384 = 0xC083u,
TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256 = 0xC084u,
TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384 = 0xC085u,
TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC088u,
TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC089u,
TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC08Cu,
TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC08Du,
TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 = 0xC08Eu,
TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 = 0xC08Fu,
TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 = 0xC092u,
TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 = 0xC093u,
TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC094u,
TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC095u,
TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC096u,
TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC097u,
TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC098u,
TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC099u,
TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC09Au,
TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC09Bu,
TLS_RSA_WITH_AES_128_CCM = 0xC09Cu,
TLS_RSA_WITH_AES_256_CCM = 0xC09Du,
TLS_RSA_WITH_AES_128_CCM_8 = 0xC0A0u,
TLS_RSA_WITH_AES_256_CCM_8 = 0xC0A1u,
TLS_PSK_WITH_AES_128_CCM = 0xC0A4u,
TLS_PSK_WITH_AES_256_CCM = 0xC0A5u,
TLS_PSK_WITH_AES_128_CCM_8 = 0xC0A8u,
TLS_PSK_WITH_AES_256_CCM_8 = 0xC0A9u,
};
bool check_http2_requirement(SSL *ssl) {
auto tls_ver = SSL_version(ssl);
switch (tls_ver) {
case TLS1_2_VERSION:
break;
default:
return false;
}
auto cipher = SSL_get_current_cipher(ssl);
// Cipher suites in RFC 7540 balck list are not allowed in HTTP/2.
switch (SSL_CIPHER_get_id(cipher) & 0xffffu) {
case TLS_NULL_WITH_NULL_NULL:
case TLS_RSA_WITH_NULL_MD5:
case TLS_RSA_WITH_NULL_SHA:
case TLS_RSA_EXPORT_WITH_RC4_40_MD5:
case TLS_RSA_WITH_RC4_128_MD5:
case TLS_RSA_WITH_RC4_128_SHA:
case TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5:
case TLS_RSA_WITH_IDEA_CBC_SHA:
case TLS_RSA_EXPORT_WITH_DES40_CBC_SHA:
case TLS_RSA_WITH_DES_CBC_SHA:
case TLS_RSA_WITH_3DES_EDE_CBC_SHA:
case TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA:
case TLS_DH_DSS_WITH_DES_CBC_SHA:
case TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA:
case TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA:
case TLS_DH_RSA_WITH_DES_CBC_SHA:
case TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA:
case TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA:
case TLS_DHE_DSS_WITH_DES_CBC_SHA:
case TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA:
case TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA:
case TLS_DHE_RSA_WITH_DES_CBC_SHA:
case TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA:
case TLS_DH_anon_EXPORT_WITH_RC4_40_MD5:
case TLS_DH_anon_WITH_RC4_128_MD5:
case TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA:
case TLS_DH_anon_WITH_DES_CBC_SHA:
case TLS_DH_anon_WITH_3DES_EDE_CBC_SHA:
case TLS_KRB5_WITH_DES_CBC_SHA:
case TLS_KRB5_WITH_3DES_EDE_CBC_SHA:
case TLS_KRB5_WITH_RC4_128_SHA:
case TLS_KRB5_WITH_IDEA_CBC_SHA:
case TLS_KRB5_WITH_DES_CBC_MD5:
case TLS_KRB5_WITH_3DES_EDE_CBC_MD5:
case TLS_KRB5_WITH_RC4_128_MD5:
case TLS_KRB5_WITH_IDEA_CBC_MD5:
case TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA:
case TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA:
case TLS_KRB5_EXPORT_WITH_RC4_40_SHA:
case TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5:
case TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5:
case TLS_KRB5_EXPORT_WITH_RC4_40_MD5:
case TLS_PSK_WITH_NULL_SHA:
case TLS_DHE_PSK_WITH_NULL_SHA:
case TLS_RSA_PSK_WITH_NULL_SHA:
case TLS_RSA_WITH_AES_128_CBC_SHA:
case TLS_DH_DSS_WITH_AES_128_CBC_SHA:
case TLS_DH_RSA_WITH_AES_128_CBC_SHA:
case TLS_DHE_DSS_WITH_AES_128_CBC_SHA:
case TLS_DHE_RSA_WITH_AES_128_CBC_SHA:
case TLS_DH_anon_WITH_AES_128_CBC_SHA:
case TLS_RSA_WITH_AES_256_CBC_SHA:
case TLS_DH_DSS_WITH_AES_256_CBC_SHA:
case TLS_DH_RSA_WITH_AES_256_CBC_SHA:
case TLS_DHE_DSS_WITH_AES_256_CBC_SHA:
case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:
case TLS_DH_anon_WITH_AES_256_CBC_SHA:
case TLS_RSA_WITH_NULL_SHA256:
case TLS_RSA_WITH_AES_128_CBC_SHA256:
case TLS_RSA_WITH_AES_256_CBC_SHA256:
case TLS_DH_DSS_WITH_AES_128_CBC_SHA256:
case TLS_DH_RSA_WITH_AES_128_CBC_SHA256:
case TLS_DHE_DSS_WITH_AES_128_CBC_SHA256:
case TLS_RSA_WITH_CAMELLIA_128_CBC_SHA:
case TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA:
case TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA:
case TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA:
case TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA:
case TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA:
case TLS_DHE_RSA_WITH_AES_128_CBC_SHA256:
case TLS_DH_DSS_WITH_AES_256_CBC_SHA256:
case TLS_DH_RSA_WITH_AES_256_CBC_SHA256:
case TLS_DHE_DSS_WITH_AES_256_CBC_SHA256:
case TLS_DHE_RSA_WITH_AES_256_CBC_SHA256:
case TLS_DH_anon_WITH_AES_128_CBC_SHA256:
case TLS_DH_anon_WITH_AES_256_CBC_SHA256:
case TLS_RSA_WITH_CAMELLIA_256_CBC_SHA:
case TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA:
case TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA:
case TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA:
case TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA:
case TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA:
case TLS_PSK_WITH_RC4_128_SHA:
case TLS_PSK_WITH_3DES_EDE_CBC_SHA:
case TLS_PSK_WITH_AES_128_CBC_SHA:
case TLS_PSK_WITH_AES_256_CBC_SHA:
case TLS_DHE_PSK_WITH_RC4_128_SHA:
case TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA:
case TLS_DHE_PSK_WITH_AES_128_CBC_SHA:
case TLS_DHE_PSK_WITH_AES_256_CBC_SHA:
case TLS_RSA_PSK_WITH_RC4_128_SHA:
case TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA:
case TLS_RSA_PSK_WITH_AES_128_CBC_SHA:
case TLS_RSA_PSK_WITH_AES_256_CBC_SHA:
case TLS_RSA_WITH_SEED_CBC_SHA:
case TLS_DH_DSS_WITH_SEED_CBC_SHA:
case TLS_DH_RSA_WITH_SEED_CBC_SHA:
case TLS_DHE_DSS_WITH_SEED_CBC_SHA:
case TLS_DHE_RSA_WITH_SEED_CBC_SHA:
case TLS_DH_anon_WITH_SEED_CBC_SHA:
case TLS_RSA_WITH_AES_128_GCM_SHA256:
case TLS_RSA_WITH_AES_256_GCM_SHA384:
case TLS_DH_RSA_WITH_AES_128_GCM_SHA256:
case TLS_DH_RSA_WITH_AES_256_GCM_SHA384:
case TLS_DH_DSS_WITH_AES_128_GCM_SHA256:
case TLS_DH_DSS_WITH_AES_256_GCM_SHA384:
case TLS_DH_anon_WITH_AES_128_GCM_SHA256:
case TLS_DH_anon_WITH_AES_256_GCM_SHA384:
case TLS_PSK_WITH_AES_128_GCM_SHA256:
case TLS_PSK_WITH_AES_256_GCM_SHA384:
case TLS_RSA_PSK_WITH_AES_128_GCM_SHA256:
case TLS_RSA_PSK_WITH_AES_256_GCM_SHA384:
case TLS_PSK_WITH_AES_128_CBC_SHA256:
case TLS_PSK_WITH_AES_256_CBC_SHA384:
case TLS_PSK_WITH_NULL_SHA256:
case TLS_PSK_WITH_NULL_SHA384:
case TLS_DHE_PSK_WITH_AES_128_CBC_SHA256:
case TLS_DHE_PSK_WITH_AES_256_CBC_SHA384:
case TLS_DHE_PSK_WITH_NULL_SHA256:
case TLS_DHE_PSK_WITH_NULL_SHA384:
case TLS_RSA_PSK_WITH_AES_128_CBC_SHA256:
case TLS_RSA_PSK_WITH_AES_256_CBC_SHA384:
case TLS_RSA_PSK_WITH_NULL_SHA256:
case TLS_RSA_PSK_WITH_NULL_SHA384:
case TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256:
case TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256:
case TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256:
case TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256:
case TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256:
case TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256:
case TLS_EMPTY_RENEGOTIATION_INFO_SCSV:
case TLS_ECDH_ECDSA_WITH_NULL_SHA:
case TLS_ECDH_ECDSA_WITH_RC4_128_SHA:
case TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA:
case TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA:
case TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA:
case TLS_ECDHE_ECDSA_WITH_NULL_SHA:
case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:
case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:
case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
case TLS_ECDH_RSA_WITH_NULL_SHA:
case TLS_ECDH_RSA_WITH_RC4_128_SHA:
case TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA:
case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA:
case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA:
case TLS_ECDHE_RSA_WITH_NULL_SHA:
case TLS_ECDHE_RSA_WITH_RC4_128_SHA:
case TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:
case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:
case TLS_ECDH_anon_WITH_NULL_SHA:
case TLS_ECDH_anon_WITH_RC4_128_SHA:
case TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA:
case TLS_ECDH_anon_WITH_AES_128_CBC_SHA:
case TLS_ECDH_anon_WITH_AES_256_CBC_SHA:
case TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA:
case TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA:
case TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA:
case TLS_SRP_SHA_WITH_AES_128_CBC_SHA:
case TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA:
case TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA:
case TLS_SRP_SHA_WITH_AES_256_CBC_SHA:
case TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA:
case TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA:
case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:
case TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256:
case TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384:
case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:
case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384:
case TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256:
case TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384:
case TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256:
case TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384:
case TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256:
case TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384:
case TLS_ECDHE_PSK_WITH_RC4_128_SHA:
case TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA:
case TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA:
case TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA:
case TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256:
case TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384:
case TLS_ECDHE_PSK_WITH_NULL_SHA:
case TLS_ECDHE_PSK_WITH_NULL_SHA256:
case TLS_ECDHE_PSK_WITH_NULL_SHA384:
case TLS_RSA_WITH_ARIA_128_CBC_SHA256:
case TLS_RSA_WITH_ARIA_256_CBC_SHA384:
case TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256:
case TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384:
case TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256:
case TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384:
case TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256:
case TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384:
case TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256:
case TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384:
case TLS_DH_anon_WITH_ARIA_128_CBC_SHA256:
case TLS_DH_anon_WITH_ARIA_256_CBC_SHA384:
case TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256:
case TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384:
case TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256:
case TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384:
case TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256:
case TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384:
case TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256:
case TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384:
case TLS_RSA_WITH_ARIA_128_GCM_SHA256:
case TLS_RSA_WITH_ARIA_256_GCM_SHA384:
case TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256:
case TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384:
case TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256:
case TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384:
case TLS_DH_anon_WITH_ARIA_128_GCM_SHA256:
case TLS_DH_anon_WITH_ARIA_256_GCM_SHA384:
case TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256:
case TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384:
case TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256:
case TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384:
case TLS_PSK_WITH_ARIA_128_CBC_SHA256:
case TLS_PSK_WITH_ARIA_256_CBC_SHA384:
case TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256:
case TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384:
case TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256:
case TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384:
case TLS_PSK_WITH_ARIA_128_GCM_SHA256:
case TLS_PSK_WITH_ARIA_256_GCM_SHA384:
case TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256:
case TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384:
case TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256:
case TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384:
case TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256:
case TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384:
case TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256:
case TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384:
case TLS_RSA_WITH_AES_128_CCM:
case TLS_RSA_WITH_AES_256_CCM:
case TLS_RSA_WITH_AES_128_CCM_8:
case TLS_RSA_WITH_AES_256_CCM_8:
case TLS_PSK_WITH_AES_128_CCM:
case TLS_PSK_WITH_AES_256_CCM:
case TLS_PSK_WITH_AES_128_CCM_8:
case TLS_PSK_WITH_AES_256_CCM_8:
return false;
}
return true;
}
} // namespace ssl
} // namespace nghttp2

View File

@ -59,6 +59,14 @@ struct TLSSessionInfo {
TLSSessionInfo *get_tls_session_info(TLSSessionInfo *tls_info, SSL *ssl);
// Returns true if SSL/TLS requirement for HTTP/2 is fulfilled.
// To fulfill the requirement, the following 2 terms must be hold:
//
// 1. The negotiated protocol must be TLSv1.2.
// 2. The negotiated cipher cuite is not listed in the black list
// described in RFC 7540.
bool check_http2_requirement(SSL *ssl);
} // namespace ssl
} // namespace nghttp2