mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-05 20:02:19 +03:00
TLS: Support client checking sent SNI to received server's PKI CN
For coap-client, if either -R or -C options are specified, then allowing self-signed certificates is now disabled.
This commit is contained in:
1 parent
6c01c83272
commit
6c5a0bcb4f
14 files changed
+137
-45
No files matched your search
@@ -298,12 +298,13 @@ definitions have to be in DER, not PEM, format. Otherwise all of
|
||||
Disable remote peer certificate checking.
|
||||
|
||||
*-C* cafile::
|
||||
PEM file or PKCS11 URI for the CA certificate and any intermediate CAs that was
|
||||
PEM file or PKCS11 URI for the CA certificate and any intermediate CAs that was
|
||||
used to sign the server
|
||||
certfile. Ideally the client certificate should be signed by the same CA so that
|
||||
mutual authentication can take place. The contents of cafile are added
|
||||
to the trusted store of root CAs. Using the *-C* or *-R* options will trigger
|
||||
the validation of the server certificate unless overridden by the *-n* option.
|
||||
the validation of the server certificate (including not allowing self-signed
|
||||
certificates) unless overridden by the *-n* option.
|
||||
|
||||
*-J* pkcs11_pin::
|
||||
The user pin to unlock access to the PKCS11 token.
|
||||
@@ -320,8 +321,8 @@ PEM file or PKCS11 URI for the CA certificate and any intermediate CAs that was
|
||||
to be in this list and is trusted for the validation. Using
|
||||
*-R trust_casfile* disables common CA mutual authentication which can only
|
||||
be done by using *-C cafile*. Using the *-C* or *-R* options will
|
||||
trigger the validation of the server certificate unless overridden by the
|
||||
*-n* option.
|
||||
trigger the validation of the server certificate (including not allowing
|
||||
self-signed certificates) unless overridden by the *-n* option.
|
||||
|
||||
*-Y* ::
|
||||
Do not load the default system Trusted Root CA Store.
|
||||
|
||||
@@ -515,6 +515,8 @@ typedef struct coap_dtls_pki_t {
|
||||
uint8_t use_cid; /* 1 if DTLS Connection ID is to be
|
||||
* used (Client only, server always enabled)
|
||||
* if supported */
|
||||
uint8_t allow_sni_cn_mismatch:1; /* 1 if SNI and returnd CN allowed to mismatch
|
||||
* (Client only). Not normally set */
|
||||
uint8_t reserved[2]; /* Reserved - must be set to 0 for
|
||||
future compatibility */
|
||||
|
||||
@@ -574,8 +576,8 @@ for different versions of the coap_dtls_pki_t structure in the future.
|
||||
*verify_peer_cert* Set to 1 to check that the peer's certificate is valid if
|
||||
provided, else 0. If not set, check_common_ca, allow_self_signed,
|
||||
allow_expired_certs, cert_chain_validation, cert_chain_verify_depth,
|
||||
check_cert_revocation, allow_no_crl, allow_expired_crl, allow_bad_md_hash
|
||||
and allow_short_rsa_length settings are all ignored.
|
||||
check_cert_revocation, allow_no_crl, allow_expired_crl, allow_bad_md_hash,
|
||||
allow_short_rsa_length and allow_sni_cn_mismatch settings are all ignored.
|
||||
|
||||
*check_common_ca* Set to 1 to check that the CA that signed the peer's
|
||||
certificate is the same CA that signed the local certificate
|
||||
@@ -624,7 +626,11 @@ allow_no_crl, allow_expired_crl, allow_bad_md_hash and
|
||||
allow_short_rsa_length settings are all ignored.
|
||||
|
||||
*use_cid* Set to 1 if the DTLS Client is to try to used Connection-ID.
|
||||
Server is alwys enabled if support available.
|
||||
Server is always enabled if support available.
|
||||
|
||||
*allow_sni_cn_mismatch* Set to 1 if the DTLS Client is not to compare the
|
||||
Common Name (CN) of the received certificate with the sent SNI hostname.
|
||||
This is not recommended.
|
||||
|
||||
*SECTION: PKI/RPK: coap_dtls_pki_t: Reserved*
|
||||
|
||||
@@ -1168,6 +1174,8 @@ setup_server_context_pki(const char *public_cert_file,
|
||||
dtls_pki.allow_bad_md_hash = 0;
|
||||
dtls_pki.allow_short_rsa_length = 0;
|
||||
dtls_pki.is_rpk_not_cert = 0; /* Set to 1 if RPK */
|
||||
dtls_pki.use_cid = 0;
|
||||
dtls_pki.allow_sni_cn_mismatch = 0;
|
||||
dtls_pki.validate_cn_call_back = verify_cn_callback;
|
||||
dtls_pki.cn_call_back_arg = valid_cn_list;
|
||||
dtls_pki.validate_sni_call_back = verify_pki_sni_callback;
|
||||
|
||||
@@ -425,6 +425,8 @@ setup_client_session_pki(const char *host,
|
||||
dtls_pki.allow_bad_md_hash = 0;
|
||||
dtls_pki.allow_short_rsa_length = 0;
|
||||
dtls_pki.is_rpk_not_cert = 0; /* Set to 1 if RPK */
|
||||
dtls_pki.use_cid = 0;
|
||||
dtls_pki.allow_sni_cn_mismatch = 0;
|
||||
dtls_pki.validate_cn_call_back = verify_cn_callback;
|
||||
dtls_pki.cn_call_back_arg = NULL;
|
||||
dtls_pki.validate_sni_call_back = NULL;
|
||||
|
||||
@@ -390,6 +390,8 @@ setup_server_context_pki(const char *public_cert_file,
|
||||
dtls_pki.allow_bad_md_hash = 0;
|
||||
dtls_pki.allow_short_rsa_length = 0;
|
||||
dtls_pki.is_rpk_not_cert = 0; /* Set to 1 if RPK */
|
||||
dtls_pki.use_cid = 0;
|
||||
dtls_pki.allow_sni_cn_mismatch = 0;
|
||||
dtls_pki.validate_cn_call_back = verify_cn_callback;
|
||||
dtls_pki.cn_call_back_arg = valid_cn_list;
|
||||
dtls_pki.validate_sni_call_back = verify_pki_sni_callback;
|
||||
|
||||
@@ -211,6 +211,9 @@ setup_server_context_pki(const char *public_cert_file,
|
||||
dtls_pki.check_cert_revocation = 1;
|
||||
dtls_pki.allow_no_crl = 1;
|
||||
dtls_pki.allow_expired_crl = 1;
|
||||
dtls_pki.is_rpk_not_cert = 0; /* Set to 1 if RPK */
|
||||
dtls_pki.use_cid = 0;
|
||||
dtls_pki.allow_sni_cn_mismatch = 0;
|
||||
dtls_pki.pki_key.key_type = COAP_PKI_KEY_DEFINE;
|
||||
dtls_pki.pki_key.key.define.ca.s_byte = ca_file;
|
||||
dtls_pki.pki_key.key.define.public_cert.s_byte = public_cert_file;
|
||||
|
||||
Reference in new issue
Block a user