Skip to content

Commit

Permalink
Add handling for Subject Alternative Name (SAN) URIs Closes #5450
Browse files Browse the repository at this point in the history
Manual merge with minor changes
  • Loading branch information
alandekok committed Dec 10, 2024
1 parent 4445c59 commit ae72e44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions share/dictionary.freeradius.internal
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ ATTRIBUTE TLS-Client-Cert-X509v3-Basic-Constraints 1930 string
ATTRIBUTE TLS-Client-Cert-Subject-Alt-Name-Dns 1931 string
ATTRIBUTE TLS-Client-Cert-Subject-Alt-Name-Upn 1932 string
ATTRIBUTE TLS-PSK-Identity 1933 string
ATTRIBUTE TLS-Cert-Subject-Alt-Name-Uri 1934 string
ATTRIBUTE TLS-Client-Cert-Subject-Alt-Name-Uri 1935 string
ATTRIBUTE TLS-Client-Cert-X509v3-Extended-Key-Usage-OID 1936 string
ATTRIBUTE TLS-Client-Cert-Valid-Since 1937 string
ATTRIBUTE TLS-Cache-Method 1938 integer
Expand Down
12 changes: 10 additions & 2 deletions src/main/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2928,7 +2928,7 @@ static ocsp_status_t ocsp_check(REQUEST *request, X509_STORE *store, X509 *issue
/*
* For creating certificate attributes.
*/
static char const *cert_attr_names[9][2] = {
static char const *cert_attr_names[10][2] = {
{ "TLS-Client-Cert-Serial", "TLS-Cert-Serial" },
{ "TLS-Client-Cert-Expiration", "TLS-Cert-Expiration" },
{ "TLS-Client-Cert-Subject", "TLS-Cert-Subject" },
Expand All @@ -2937,6 +2937,7 @@ static char const *cert_attr_names[9][2] = {
{ "TLS-Client-Cert-Subject-Alt-Name-Email", "TLS-Cert-Subject-Alt-Name-Email" },
{ "TLS-Client-Cert-Subject-Alt-Name-Dns", "TLS-Cert-Subject-Alt-Name-Dns" },
{ "TLS-Client-Cert-Subject-Alt-Name-Upn", "TLS-Cert-Subject-Alt-Name-Upn" },
{ "TLS-Client-Cert-Subject-Alt-Name-Uri", "TLS-Cert-Subject-Alt-Name-Uri" },
{ "TLS-Client-Cert-Valid-Since", "TLS-Cert-Valid-Since" }
};

Expand All @@ -2949,6 +2950,7 @@ static char const *cert_attr_names[9][2] = {
#define FR_TLS_SAN_DNS (6)
#define FR_TLS_SAN_UPN (7)
#define FR_TLS_VALID_SINCE (8)
#define FR_TLS_SAN_URI (9)

/*
* Before trusting a certificate, you must make sure that the
Expand Down Expand Up @@ -3186,6 +3188,13 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
}
break;
#endif /* GEN_OTHERNAME */
#ifdef GEN_URI
case GEN_URI:
vp = fr_pair_make(talloc_ctx, certs, cert_attr_names[FR_TLS_SAN_URI][lookup],
(char const *) ASN1_STRING_get0_data(name->d.uniformResourceIdentifier), T_OP_SET);
rdebug_pair(L_DBG_LVL_2, request, vp, NULL);
break;
#endif /* GEN_URI */
default:
/* XXX TODO handle other SAN types */
break;
Expand Down Expand Up @@ -5452,4 +5461,3 @@ fr_tls_status_t tls_ack_handler(tls_session_t *ssn, REQUEST *request)
}
}
#endif /* WITH_TLS */

0 comments on commit ae72e44

Please sign in to comment.