File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,7 @@ struct flb_input_instance {
359359 /* TLS settings */
360360 int use_tls ; /* bool, try to use TLS for I/O */
361361 int tls_verify ; /* Verify certs (default: true) */
362+ int tls_verify_hostname ; /* Verify hostname (default: false) */
362363 int tls_debug ; /* mbedtls debug level */
363364 char * tls_vhost ; /* Virtual hostname for SNI */
364365 char * tls_ca_path ; /* Path to certificates */
Original file line number Diff line number Diff line change @@ -308,6 +308,7 @@ struct flb_input_instance *flb_input_new(struct flb_config *config,
308308 instance -> tls = NULL ;
309309 instance -> tls_debug = -1 ;
310310 instance -> tls_verify = FLB_TRUE ;
311+ instance -> tls_verify_hostname = FLB_FALSE ;
311312 instance -> tls_vhost = NULL ;
312313 instance -> tls_ca_path = NULL ;
313314 instance -> tls_ca_file = NULL ;
@@ -553,6 +554,10 @@ int flb_input_set_property(struct flb_input_instance *ins,
553554 ins -> tls_verify = flb_utils_bool (tmp );
554555 flb_sds_destroy (tmp );
555556 }
557+ else if (prop_key_check ("tls .verify_hostname ", k , len ) == 0 && tmp ) {
558+ ins -> tls_verify_hostname = flb_utils_bool (tmp );
559+ flb_sds_destroy (tmp );
560+ }
556561 else if (prop_key_check ("tls .debug ", k , len ) == 0 && tmp ) {
557562 ins -> tls_debug = atoi (tmp );
558563 flb_sds_destroy (tmp );
@@ -1121,6 +1126,16 @@ int flb_input_instance_init(struct flb_input_instance *ins,
11211126
11221127 return -1 ;
11231128 }
1129+
1130+ if (ins -> tls_verify_hostname == FLB_TRUE ) {
1131+ ret = flb_tls_set_verify_hostname (ins -> tls , ins -> tls_verify_hostname );
1132+ if (ret == -1 ) {
1133+ flb_error ("[input %s] error set up to verify hostname in TLS context" ,
1134+ ins -> name );
1135+
1136+ return -1 ;
1137+ }
1138+ }
11241139 }
11251140
11261141 struct flb_config_map * m ;
You can’t perform that action at this time.
0 commit comments