@@ -263,6 +263,7 @@ func (c *enrollCmd) fleetServerBootstrap(ctx context.Context) (string, error) {
263263 c .options .FleetServer .ConnStr , c .options .FleetServer .ServiceToken ,
264264 c .options .FleetServer .PolicyID ,
265265 c .options .FleetServer .Host , c .options .FleetServer .Port ,
266+ c .options .Insecure ,
266267 c .options .FleetServer .Cert , c .options .FleetServer .CertKey , c .options .FleetServer .ElasticsearchCA ,
267268 c .options .FleetServer .Headers ,
268269 c .options .FleetServer .ProxyURL ,
@@ -460,6 +461,7 @@ func (c *enrollCmd) enroll(ctx context.Context, persistentConfig map[string]inte
460461 c .options .FleetServer .ConnStr , c .options .FleetServer .ServiceToken ,
461462 c .options .FleetServer .PolicyID ,
462463 c .options .FleetServer .Host , c .options .FleetServer .Port ,
464+ c .options .Insecure ,
463465 c .options .FleetServer .Cert , c .options .FleetServer .CertKey , c .options .FleetServer .ElasticsearchCA ,
464466 c .options .FleetServer .Headers ,
465467 c .options .FleetServer .ProxyURL , c .options .FleetServer .ProxyDisabled , c .options .FleetServer .ProxyHeaders )
@@ -759,7 +761,7 @@ func storeAgentInfo(s saver, reader io.Reader) error {
759761
760762func createFleetServerBootstrapConfig (
761763 connStr , serviceToken , policyID , host string ,
762- port uint16 ,
764+ port uint16 , insecure bool ,
763765 cert , key , esCA string ,
764766 headers map [string ]string ,
765767 proxyURL string ,
@@ -817,6 +819,12 @@ func createFleetServerBootstrapConfig(
817819 },
818820 }
819821 }
822+ if insecure {
823+ if cfg .Server .TLS == nil {
824+ cfg .Server .TLS = & tlscommon.Config {}
825+ }
826+ cfg .Server .TLS .VerificationMode = tlscommon .VerifyNone
827+ }
820828
821829 if localFleetServer {
822830 cfg .Client .Transport .Proxy .Disable = true
0 commit comments