@@ -123,6 +123,16 @@ struct flb_config_map input_global_properties[] = {
123123 0 , FLB_FALSE , 0 ,
124124 "Enable threading on an input"
125125 },
126+ {
127+ FLB_CONFIG_MAP_STR , "tls.windows.certstore_name" , NULL ,
128+ 0 , FLB_FALSE , 0 ,
129+ "Sets the certstore name on an input (Windows)"
130+ },
131+ {
132+ FLB_CONFIG_MAP_STR , "tls.windows.use_enterprise_store" , NULL ,
133+ 0 , FLB_FALSE , 0 ,
134+ "Sets whether using enterprise certstore or not on an input (Windows)"
135+ },
126136
127137 {0 }
128138};
@@ -391,6 +401,10 @@ struct flb_input_instance *flb_input_new(struct flb_config *config,
391401 instance -> tls_crt_file = NULL ;
392402 instance -> tls_key_file = NULL ;
393403 instance -> tls_key_passwd = NULL ;
404+ # if defined(FLB_SYSTEM_WINDOWS )
405+ instance -> tls_win_certstore_name = NULL ;
406+ instance -> tls_win_use_enterprise_certstore = FLB_FALSE ;
407+ # endif
394408#endif
395409
396410 /* Plugin requires a co-routine context ? */
@@ -668,6 +682,15 @@ int flb_input_set_property(struct flb_input_instance *ins,
668682 else if (prop_key_check ("tls .ciphers ", k , len ) == 0 ) {
669683 flb_utils_set_plugin_string_property ("tls.ciphers" , & ins -> tls_ciphers , tmp );
670684 }
685+ # if defined(FLB_SYSTEM_WINDOWS )
686+ else if (prop_key_check ("tls.windows.certstore_name" , k , len ) == 0 && tmp ) {
687+ flb_utils_set_plugin_string_property ("tls.windows.certstore_name" , & ins -> tls_win_certstore_name , tmp );
688+ }
689+ else if (prop_key_check ("tls.windows.use_enterprise_store" , k , len ) == 0 && tmp ) {
690+ ins -> tls_win_use_enterprise_certstore = flb_utils_bool (tmp );
691+ flb_sds_destroy (tmp );
692+ }
693+ # endif
671694#endif
672695 else if (prop_key_check ("storage .type ", k , len ) == 0 && tmp ) {
673696 /* Set the storage type */
@@ -826,6 +849,12 @@ void flb_input_instance_destroy(struct flb_input_instance *ins)
826849 flb_sds_destroy (ins -> tls_ciphers );
827850 }
828851
852+ #if defined(FLB_SYSTEM_WINDOWS )
853+ if (ins -> tls_win_certstore_name ) {
854+ flb_sds_destroy (ins -> tls_win_certstore_name );
855+ }
856+ #endif
857+
829858 /* release the tag if any */
830859 flb_sds_destroy (ins -> tag );
831860
@@ -1260,6 +1289,36 @@ int flb_input_instance_init(struct flb_input_instance *ins,
12601289 return -1 ;
12611290 }
12621291 }
1292+
1293+ #if defined (FLB_SYSTEM_WINDOWS )
1294+ if (ins -> tls_win_use_enterprise_certstore ) {
1295+ ret = flb_tls_set_certstore_name (ins -> tls , ins -> tls_win_use_enterprise_certstore );
1296+ if (ret == -1 ) {
1297+ flb_error ("[input %s] error set up to use enterprise certstore in TLS context" ,
1298+ ins -> name );
1299+
1300+ return -1 ;
1301+ }
1302+ }
1303+
1304+ if (ins -> tls_win_certstore_name ) {
1305+ ret = flb_tls_set_certstore_name (ins -> tls , ins -> tls_win_certstore_name );
1306+ if (ret == -1 ) {
1307+ flb_error ("[input %s] error specify certstore name in TLS context" ,
1308+ ins -> name );
1309+
1310+ return -1 ;
1311+ }
1312+
1313+ ret = flb_tls_load_system_certificates (ins -> tls );
1314+ if (ret == -1 ) {
1315+ flb_error ("[input %s] error set up to load certstore with a user-defined name in TLS context" ,
1316+ ins -> name );
1317+
1318+ return -1 ;
1319+ }
1320+ }
1321+ #endif
12631322 }
12641323
12651324 struct flb_config_map * m ;
0 commit comments