diff options
author | Jack Lloyd <[email protected]> | 2019-05-20 14:44:08 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-05-20 15:11:05 -0400 |
commit | 67df17d31d61f013d537abc7744f707435351125 (patch) | |
tree | cde44420bdcf69fccf8f79123479b6ef0a2712d0 /src/lib/tls/tls_policy.cpp | |
parent | 8e781e5a1be3ecc456c8e109571a084ec8bb792e (diff) |
Fix various issues in TLS found using BoGo
- BoGo sends unparseable OCSP responses, so we have to accomodate for
this by delaying decoding until verification and simply ignoring
OCSP responses that we can't parse.
- Check that there is no trailing garbage at the end of various messages.
- Don't send empty SNI
- Check the TLS record header versions (previously ignored)
- For CBC 1/n-1 splitting split every record instead of just first.
I think this is not a problem but it is what BoGo expects.
- New Channel::application_protocol virtual (previously was
implemented on both Client and Server but not shared).
- Changes to resumption version handling.
- Fix server version selection when newer versions are disabled.
New policy hooks added in service of BoGo:
- maximum_certificate_chain_size gives the maximum cert chain in bytes
that we'll accept.
- allow_resumption_for_renegotiation specifies if a renegotiation
attempt can be simply (re-)resumed instead.
- abort_handshake_on_undesired_renegotiation - previously we just
ignored it with a warning alert. Now behavior is configurable.
- request_client_certificate_authentication
- require_client_certificate_authentication
Diffstat (limited to 'src/lib/tls/tls_policy.cpp')
-rw-r--r-- | src/lib/tls/tls_policy.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/lib/tls/tls_policy.cpp b/src/lib/tls/tls_policy.cpp index 4caaf623a..58ba73ade 100644 --- a/src/lib/tls/tls_policy.cpp +++ b/src/lib/tls/tls_policy.cpp @@ -25,6 +25,8 @@ std::vector<Signature_Scheme> Policy::allowed_signature_schemes() const for(Signature_Scheme scheme : all_signature_schemes()) { + if(signature_scheme_is_known(scheme) == false) + continue; const bool sig_allowed = allowed_signature_method(signature_algorithm_of_scheme(scheme)); const bool hash_allowed = allowed_signature_hash(hash_function_of_scheme(scheme)); @@ -57,7 +59,7 @@ std::vector<std::string> Policy::allowed_ciphers() const //"AES-128", //"Camellia-256", //"Camellia-128", - //"SEED" + //"SEED", //"3DES", }; } @@ -292,19 +294,19 @@ Protocol_Version Policy::latest_supported_version(bool datagram) const { if(datagram) { - if(allow_dtls12()) + if(acceptable_protocol_version(Protocol_Version::DTLS_V12)) return Protocol_Version::DTLS_V12; - if(allow_dtls10()) + if(acceptable_protocol_version(Protocol_Version::DTLS_V10)) return Protocol_Version::DTLS_V10; throw Invalid_State("Policy forbids all available DTLS version"); } else { - if(allow_tls12()) + if(acceptable_protocol_version(Protocol_Version::TLS_V12)) return Protocol_Version::TLS_V12; - if(allow_tls11()) + if(acceptable_protocol_version(Protocol_Version::TLS_V11)) return Protocol_Version::TLS_V11; - if(allow_tls10()) + if(acceptable_protocol_version(Protocol_Version::TLS_V10)) return Protocol_Version::TLS_V10; throw Invalid_State("Policy forbids all available TLS version"); } @@ -329,6 +331,13 @@ bool Policy::hide_unknown_users() const { return false; } bool Policy::server_uses_own_ciphersuite_preferences() const { return true; } bool Policy::negotiate_encrypt_then_mac() const { return true; } bool Policy::support_cert_status_message() const { return true; } +bool Policy::allow_resumption_for_renegotiation() const { return true; } +bool Policy::only_resume_with_exact_version() const { return true; } +bool Policy::require_client_certificate_authentication() const { return false; } +bool Policy::request_client_certificate_authentication() const { return require_client_certificate_authentication(); } +bool Policy::abort_connection_on_undesired_renegotiation() const { return false; } + +size_t Policy::maximum_certificate_chain_size() const { return 0; } // 1 second initial timeout, 60 second max - see RFC 6347 sec 4.2.4.1 size_t Policy::dtls_initial_timeout() const { return 1*1000; } @@ -431,7 +440,11 @@ std::vector<uint16_t> Policy::ciphersuite_list(Protocol_Version version, for(auto&& suite : Ciphersuite::all_known_ciphersuites()) { // Can we use it? - if(suite.valid() == false) + if(!suite.valid()) + continue; + + // Can we use it in this version? + if(!suite.usable_in_version(version)) continue; // Is it acceptable to the policy? @@ -442,17 +455,6 @@ std::vector<uint16_t> Policy::ciphersuite_list(Protocol_Version version, if(!have_srp && suite.kex_method() == Kex_Algo::SRP_SHA) continue; - if(!version.supports_aead_modes()) - { - // Are we doing AEAD in a non-AEAD version? - if(suite.mac_algo() == "AEAD") - continue; - - // Older (v1.0/v1.1) versions also do not support any hash but SHA-1 - if(suite.mac_algo() != "SHA-1") - continue; - } - if(!value_exists(kex, suite.kex_algo())) continue; // unsupported key exchange |