# Fleet requires insecure flag to enroll

**URL:** <https://discuss.elastic.co/t/fleet-requires-insecure-flag-to-enroll/277395>\
**Category:** Beats\
**Tags:** docker, fleet\
**Created:** [June 30, 2021, 2:14am UTC](https://discuss.elastic.co/t/fleet-requires-insecure-flag-to-enroll/277395 "2021-06-30T02:14:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jukocross](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jukocross/32/31988_2.png) [@Jukocross](https://discuss.elastic.co/u/Jukocross)\
**Post date:** [June 30, 2021, 2:14am UTC](https://discuss.elastic.co/t/fleet-requires-insecure-flag-to-enroll/277395/1 "2021-06-30T02:14:14Z")

</div>

I tried setting up TLS with reference to [Encrypt traffic in a self-managed cluster | Fleet User Guide [7.13] | Elastic](https://www.elastic.co/guide/en/fleet/current/secure-connections.html).

However, I faced `Error: fail to enroll: fail to execute request to fleet-server: x509: certificate signed by unknown authority` without the insecure flag.

Exact flags was used on a centos container and was able to enroll successfully provided with the exact certificates.

Following is my docker-compose config to run the fleet server in my infrastructure.

```auto
fleet_server01:
    image: docker.elastic.co/beats/elastic-agent:${VERSION}
    container_name: fleet
    ports:
      - 8220:8220
    networks:
      - elastic
    hostname: docker-fleet-server
    volumes:
      - ./certs:$CERTS_DIR
    environment:
      FLEET_SERVER_ENABLE: 1
      FLEET_URL: $FLEET_URL #Host IP,Port 8220
      FLEET_CA: $CERTS_DIR/ca/ca.crt
      FLEET_SERVER_CERT: $CERTS_DIR/fleet_server01/fleet_server01.crt
      FLEET_SERVER_CERT_KEY: $CERTS_DIR/fleet_server01/fleet_server01.key
      FLEET_SERVER_ELASTICSEARCH_HOST: $ES_URL #Host IP, Port 9200
      FLEET_SERVER_SERVICE_TOKEN: $SERVICE_TOKEN
      FLEET_SERVER_ELASTICSEARCH_CA: $CERTS_DIR/ca/ca.crt
      FLEET_SERVER_POLICY_ID: $FLEET_POLICY_ID
      #FLEET_INSECURE: "true"

```

---

<div class="post-metadata">

**Author:** ![blaker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blaker/32/65621_2.png) [@blaker](https://discuss.elastic.co/u/blaker)\
**Post date:** [July 6, 2021, 3:53pm UTC](https://discuss.elastic.co/t/fleet-requires-insecure-flag-to-enroll/277395/2 "2021-07-06T15:53:11Z")

</div>

You need to make sure that the `FLEET_URL` matches the name defined in the `FLEET_SERVER_CERT`. If it does not match exactly it will fail with the given error.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 3, 2021, 5:53pm UTC](https://discuss.elastic.co/t/fleet-requires-insecure-flag-to-enroll/277395/3 "2021-08-03T17:53:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
