Skip to content

Commit

Permalink
Test to allow loading certificate from file
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Mar 7, 2016
1 parent 3d63419 commit efa1b42
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions share/dictionary.freeradius.internal
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ ATTRIBUTE TLS-Client-Cert-X509v3-Basic-Constraints 1930 string internal
ATTRIBUTE TLS-Client-Cert-Subject-Alt-Name-Dns 1931 string internal
ATTRIBUTE TLS-Client-Cert-Subject-Alt-Name-Upn 1932 string internal
ATTRIBUTE TLS-PSK-Identity 1933 string internal
ATTRIBUTE TLS-Session-Cert-File 1934 string internal

# 1934 - 1939: reserved for future cert attributes

Expand Down
23 changes: 23 additions & 0 deletions src/main/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,29 @@ tls_session_t *tls_session_init_server(TALLOC_CTX *ctx, fr_tls_server_conf_t *co
SSL_set_msg_callback_arg(new_tls, session);
SSL_set_info_callback(new_tls, cbtls_info);


#ifdef WITH_TLS_SESSION_CERTS
/*
* Add the session certificate to the session.
*/
vp = fr_pair_find_by_num(request->state, 0, PW_TLS_SESSION_CERT_FILE, TAG_ANY);
if (vp) {
if (SSL_use_certificate_file(new_tls, vp->vp_strvalue, SSL_FILETYPE_PEM) != 1) {
REDEBUG("Failed loading TLS session certificate from file %s", vp->vp_strvalue);

while ((e = ERR_get_error()) != 0) {
char const *p;

p = ERR_error_string(e, NULL);
if (p) REDEBUG("%s", p);
}

} else {
RDEBUG("Loaded TLS session ertificate from file %s", vp->vp_strvalue);
}
}
#endif

/*
* In Server mode we only accept.
*/
Expand Down

0 comments on commit efa1b42

Please sign in to comment.