@@ -1634,6 +1634,7 @@ static CONF_PARSER tls_server_config[] = {
16341634 { "CA_file" , FR_CONF_OFFSET (PW_TYPE_FILE_INPUT | PW_TYPE_DEPRECATED , fr_tls_server_conf_t , ca_file ), NULL },
16351635 { "ca_file" , FR_CONF_OFFSET (PW_TYPE_FILE_INPUT , fr_tls_server_conf_t , ca_file ), NULL },
16361636 { "private_key_password" , FR_CONF_OFFSET (PW_TYPE_STRING | PW_TYPE_SECRET , fr_tls_server_conf_t , private_key_password ), NULL },
1637+ { "private_key_password_file" , FR_CONF_OFFSET (PW_TYPE_FILE_INPUT , fr_tls_server_conf_t , private_key_password_file ), NULL },
16371638#ifdef PSK_MAX_IDENTITY_LEN
16381639 { "psk_identity" , FR_CONF_OFFSET (PW_TYPE_STRING , fr_tls_server_conf_t , psk_identity ), NULL },
16391640 { "psk_hexphrase" , FR_CONF_OFFSET (PW_TYPE_STRING | PW_TYPE_SECRET , fr_tls_server_conf_t , psk_password ), NULL },
@@ -3851,6 +3852,23 @@ SSL_CTX *tls_init_ctx(fr_tls_server_conf_t *conf, int client, char const *chain_
38513852 SSL_CTX_set_default_passwd_cb (ctx , cbtls_password );
38523853 }
38533854 }
3855+ if (conf -> private_key_password_file ) {
3856+ FILE * passwordfile = fopen (conf -> private_key_password_file , "r" );
3857+ if (passwordfile ) {
3858+ char password [256 ];
3859+ if (fgets (password , sizeof (password ), passwordfile )) {
3860+ SSL_CTX_set_default_passwd_cb_userdata (ctx , password );
3861+ SSL_CTX_set_default_passwd_cb (ctx , cbtls_password );
3862+ }
3863+ else {
3864+ ERROR (LOG_PREFIX ": Error reading private_key_password_file %s" , conf -> private_key_password_file );
3865+ }
3866+ fclose (passwordfile );
3867+ }
3868+ else {
3869+ ERROR (LOG_PREFIX ": Error opening private_key_password_file %s" , conf -> private_key_password_file );
3870+ }
3871+ }
38543872
38553873#ifdef PSK_MAX_IDENTITY_LEN
38563874 /*
0 commit comments