@@ -1634,6 +1634,7 @@ static CONF_PARSER tls_server_config[] = {
1634
1634
{ "CA_file" , FR_CONF_OFFSET (PW_TYPE_FILE_INPUT | PW_TYPE_DEPRECATED , fr_tls_server_conf_t , ca_file ), NULL },
1635
1635
{ "ca_file" , FR_CONF_OFFSET (PW_TYPE_FILE_INPUT , fr_tls_server_conf_t , ca_file ), NULL },
1636
1636
{ "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 },
1637
1638
#ifdef PSK_MAX_IDENTITY_LEN
1638
1639
{ "psk_identity" , FR_CONF_OFFSET (PW_TYPE_STRING , fr_tls_server_conf_t , psk_identity ), NULL },
1639
1640
{ "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_
3851
3852
SSL_CTX_set_default_passwd_cb (ctx , cbtls_password );
3852
3853
}
3853
3854
}
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
+ }
3854
3872
3855
3873
#ifdef PSK_MAX_IDENTITY_LEN
3856
3874
/*
0 commit comments