Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Add support for custom Certificate Authorities, Certificate and Private keys. #73483

Open
4 of 8 tasks
ph opened this issue Jul 28, 2020 · 19 comments
Open
4 of 8 tasks
Labels
Meta Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@ph
Copy link
Contributor

ph commented Jul 28, 2020

Design

Ingest Manager

Integration Package

Beats

Endpoint security

  • Add support for embedded CA, Certificate and private key. @ferullo

Referenced issues

@ph ph added the Meta label Jul 28, 2020
@ph ph added the Team:Fleet Team label for Observability Data Collection Fleet team label Jul 28, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@ph
Copy link
Contributor Author

ph commented Jul 28, 2020

@nchaulet Added you as the owner of this feature.

@ph
Copy link
Contributor Author

ph commented Jul 28, 2020

@nchaulet We might not have complete design ready that feature in this iteration, lets collaborate with @hbharding to see how we can implements it before having the complete design.

@jamiesmith
Copy link

I ran into this when trying to set up against the APM Integration Test env which uses self-signed certs and runs a fully-generated/simulated environment in Docker containers.

To get it to enroll I had to add the --insecure flag, and to get it to run I had to add a line to the generated action_store.yml file:

  outputs:
    default:
      api_key: 7_uoA.....
      hosts:
      - https://elasticsearch:9200
      type: elasticsearch
      ssl.certificate_authorities: ["/home/jamie/Projects/GitRepo/apm-integration-testing/scripts/tls/ca/ca.crt"]

I also had to add an entry to my /etc/hosts to alias elasticsearch because I was running agent outside the docker network-- so a way to do something like --insecure when running would be helpful.

@nicpenning
Copy link

Updating the action_store.yml did not seem to allow the elastic-agent to connect to ElasticSearch. I seem to see errors now at least:

image

I have this for the output:

    default:
      api_key: Iu...
      hosts:
      - https://192.168.4.79:9200
      - https://192.168.5.67:9200
      - https://192.168.6.114:9200
      type: elasticsearch
      ssl.certificate_authorities: ["C:\\Program Files\\elastic-agent-7.9.0-windows-x86_64\\ca.crt"]
  revision: 2

@nicpenning
Copy link

Ha, I stand corrected! I put the wrong CA in, after putting the right CA in, we are good!

image

@francescouk
Copy link

Ha, I stand corrected! I put the wrong CA in, after putting the right CA in, we are good!

image

Let me ask you something, what about the elastic endpoint? Is sending correctly? Coz following your instructions I could not make to work as we get the same certificate problem. Looks like the elastic endpoint is trying to send directly to elasticsearch without the certificate.

@nicpenning
Copy link

That is correct @francescouk , the elastic endpoint doesn't appear to connect to ElasticSearch.

@LANopop
Copy link

LANopop commented Aug 26, 2020

as mentioned in https://discuss.elastic.co/t/ingest-management-use-insecure-elasticsearch-output-managed-in-fleet-mode-for-elastic-agent/246022/10?u=lanopop please dont forget to build in some kind of fail-safe for whenever a certificate expires (this can be ca certificate or client certificate). We had this already happen to us that the ca certificate expired and therefor all the endpoints didnt connect to the manager anymore and had to manually reconfigure all of them to connect again.

@cakeben
Copy link

cakeben commented Sep 2, 2020

I am also having this or a very similar issue. I install and enroll elastic-agent using the --insecure mode but no data appears in datasets(presumably because there's a certificate error connecting to ES I can't see) is there a way to change the fleet config to not verify the ssl?

@numbfx
Copy link

numbfx commented Sep 4, 2020

I think I'm having a similar issue, I've set up Elasticsearch, Kibana, and now Elastic Agent using a self signed certificate, While getting Elastic Agent working I was getting the error that the certificate was signed by an unknown authority when I tried to add the agent to ingest manager. I modified the Elastic Agent fleet.yml to change protocol: http to protocol: https and include the line certificate_authorities: ["/etc/elastic-agent/ca.pem"] under the section ssl which allowed Elastic Agent to connect to Kibana and enroll (wasn't successfully enrolling previously). Now that it's connected, the logs are not being sent. Not sure how also encrypt/send the log data.

@sej7278
Copy link

sej7278 commented Sep 4, 2020

don't set the insecure flag or edit the yaml, just put your ca.pem into your client's truststore by copying it to /etc/ssl/certs/ then run update-ca-trust or update-ca-certificates (distro-dependant).

@numbfx
Copy link

numbfx commented Sep 5, 2020

I did what you said. works, thank you. have Elasticsearch, Kibana, and Agent running encrypted all using same cert on one ubuntu machine, will try networking with windows next

@CyberAbwehr
Copy link

CyberAbwehr commented Sep 22, 2020

I have test it now on windows, it works.
You need also import the certificate as root trusted certificate.

@pkward
Copy link

pkward commented Mar 11, 2021

I have test it now on windows, it works.
You need also import the certificate as root trusted certificate.

Could you provide the steps you took to get it working on Windows?

@CyberAbwehr
Copy link

Hi,

Here I found a good description for you.
https://www.thewindowsclub.com/manage-trusted-root-certificates-windows

If you have any questions please let me know.
Best regards

@jen-huang jen-huang changed the title [Ingest manager] Add support for custom Certificate Authorities, Certificate and Private keys. [Fleet] Add support for custom Certificate Authorities, Certificate and Private keys. Apr 27, 2021
@endorama
Copy link
Member

The same fix applied in comment above is proposed in a Discuss thread related to this same issue.

@joshdover
Copy link
Contributor

This issue is significantly out of date and needs to be re-evaluated since the re-architecture of adding the Fleet Server component. It's possible the only remaining work here is #73487 to provide a UI for specifying custom CAs and including those CAs in the enroll command given to Elastic Agent. This feature also has some overlap with the support for self-signed CA fingerprints we added in 8.0, which we may be able to reuse/extend.

@jasonslater2000
Copy link

@joshdover following up on this issue, as it pertains to putting a reverse proxy in front of an Elastic Cloud cluster so that elastic-agent deployments would need to authenticate with proxy and elastic-agents would never know the true IP of the Elastic Cloud cluster behind the proxy. Is this something we resolved in 8.0? Are there instructions on our website?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Meta Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

No branches or pull requests