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

[Elastic Agent] Embbed the PGP key in the binary. #19222

Closed
ph opened this issue Jun 16, 2020 · 16 comments
Closed

[Elastic Agent] Embbed the PGP key in the binary. #19222

ph opened this issue Jun 16, 2020 · 16 comments
Assignees
Labels
Ingest Management:beta1 Group issues for ingest management beta1

Comments

@ph
Copy link
Contributor

ph commented Jun 16, 2020

When the Elastic Agent download a binary we also download the PGP key and verify the downloaded artifact with it. Instead of downloading the artifact we should bake the PGP in the elastic agent binary and use it to verify the artifact.

Things that I think we need to do:

  • Allow the Elastic Agent to use that PGP key instead of file.
  • Disable downloading of the PGP key.
  • Maybe special case for testing?
@elasticmachine
Copy link
Collaborator

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

@ph
Copy link
Contributor Author

ph commented Jun 16, 2020

@mgreau Do you know if we can access to that PGP key in the release manager so we could bake it in the executable?

@ph ph added the Ingest Management:beta1 Group issues for ingest management beta1 label Jun 16, 2020
@ph
Copy link
Contributor Author

ph commented Jun 16, 2020

@scunningham For linking.

@ph
Copy link
Contributor Author

ph commented Jun 16, 2020

As @scunningham told me we could just embed it directly in the code.

@ph
Copy link
Contributor Author

ph commented Jun 16, 2020

@michalpristas Looking at the code this looks like a low effort?

@mgreau How often the PGP change?

@michalpristas
Copy link
Contributor

should not be complicated, not sure what packaging changes are required.
what in case you build locally without a key, should we skip PGP verification?

@ph
Copy link
Contributor Author

ph commented Jun 17, 2020

@michalpristas I think it need investigation this might not be trivial because we package filebeat and metricbeat in the elastic-agent distribution. Maybe sync with @blakerouse here.

@mgreau
Copy link
Member

mgreau commented Jun 17, 2020

As explained on the website, the key is available at https://artifacts.elastic.co/GPG-KEY-elasticsearch, so you can download it at build time if you want it to be embedded. There is no reason to change it, but, if this key is embedded, I would recommend having an option for using another key in case we have to make a change for security reasons.

@scunningham
Copy link

I would be careful with adding an option to using another key on the endpoint. We would have to defend against an escalation attack where an attacker drops a fake key in the right place and fools the agent into pulling down malicious payloads and executing with privileges. It is frankly safer to hard code the the key in the binary itself, which is signed. There are ways to secure an optional key, but we would have to work to extend trust cleanly.

@michalpristas
Copy link
Contributor

i like the idea of baking it in from official site at the build time.
my idea here is that if PGP is not there signatures will not be required and everything passes a check (we have one more check for sha512 but this is a simple one more like a sane check)

so if you want to test something locally without checking signature you just build the agent without a key and you're good to go.
@scunningham any security concern about this strategy?

@scunningham
Copy link

Pulling it down from a trusted website at build time seems very reasonable.  Lack of a key is fine for debug as long as we have some safeguards against that accidentally getting into production.  I would worry that a build mistake would leave the shields down on the Death Star.

@michalpristas
Copy link
Contributor

combination of is pgp present and is it missing on purpose makes sense to me and seems reasonable.

@ph
Copy link
Contributor Author

ph commented Jun 26, 2020

I have also some concerns about having it empty, I think it should be an Opt in choice, We should be verbose that this an "debug" build at run time and we could add an assert for the packaging that this should not be a debug build?

@scunningham
Copy link

I'd prefer as PH described. It should be hard to accidentally build and release an agent that does not have proper key material in place.

@michalpristas
Copy link
Contributor

Does strategy i took here look ok? #19480
By default i packs in PGP but when you specify DEV=true (we can change to DEBUG or whatever else) it is omited and let's you test agent without requiring packages to be signed.

@michalpristas
Copy link
Contributor

Closing PGP included as in #19480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ingest Management:beta1 Group issues for ingest management beta1
Projects
None yet
Development

No branches or pull requests

5 participants