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

How is storeCAPICredentialsInSecret expected to work? #205

Open
pfaelzerchen opened this issue Nov 25, 2024 · 8 comments
Open

How is storeCAPICredentialsInSecret expected to work? #205

pfaelzerchen opened this issue Nov 25, 2024 · 8 comments
Assignees
Labels
kind/documentation Improvements or additions to documentation needs/triage Needs triage

Comments

@pfaelzerchen
Copy link

As far as I understood, the newly introduced storeCAPICredentialsInSecret option will store the credentials after enrolment of the security engine. I tried to set that option to true and persistentVolume.config.enable to false.

With this configuration, every restart of the lapi-container will do a new security engine enrolment. With persistentVolume.config.enable=true and storeCAPICredentialsInSecret=false restarting does not cause a new enrolment.

Is this behaviour intended? Or did I misunderstand storeCAPICredentialsInSecret?

@github-actions github-actions bot added the needs/triage Needs triage label Nov 25, 2024
Copy link

@pfaelzerchen: Thanks for opening an issue, it is currently awaiting triage.

If you haven't already, please provide the following information:

  • kind : bug, enhancementor documentation
  • area : agent, appsec, configuration, cscli, local-api

In the meantime, you can:

  1. Check Crowdsec Documentation to see if your issue can be self resolved.
  2. You can also join our Discord.
  3. Check Releases to make sure your agent is on the latest version.
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the forked project rr404/oss-governance-bot repository.

Copy link

@pfaelzerchen: There are no 'kind' label on this issue. You need a 'kind' label to start the triage process.

  • /kind bug
  • /kind documentation
  • /kind enhancement
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the forked project rr404/oss-governance-bot repository.

@github-actions github-actions bot added the needs/kind Kind label required label Nov 25, 2024
@pfaelzerchen
Copy link
Author

/kind documentation

@github-actions github-actions bot added kind/documentation Improvements or additions to documentation and removed needs/kind Kind label required labels Nov 25, 2024
@blotus
Copy link
Member

blotus commented Nov 25, 2024

Hello,

The goal of this settings is store the CAPI credentials in a secret, so that if you don't want (or can't) persist the config of the LAPI pod, you will not lose them between restarts or upgrades.

From our testing, the credentials are stable over time when deleting and recreating the LAPI pod (if you uninstall and reinstall the chart, they will not be kept).

A small precision: the pod will always try to enroll itself in the console, but will get an error from CAPI telling it it's already enrolled (it's the expected behavior, not very clean, but way easier to handle in the docker startup script.)
Do you see multiple enrollment requests in the console ?

@pfaelzerchen
Copy link
Author

I am deploying the chart via ArgoCD. So probably the secret will be recreated that way. But yes, I see multiple enrolment requests in the console that I have to confirm.

@srkoster
Copy link
Contributor

srkoster commented Nov 26, 2024

I use Flux and restarting the container doesn't trigger a new enrollment. Removing the Helmrelease or the Kustomization above it does (which is to be expected unless I would put the following annotation on the secret
kustomize.toolkit.fluxcd.io/prune: disabled. Unfortunately I would have to do that manually, maybe a nice feature for the chart to be able to add annotations to the secret)

@pfaelzerchen
Copy link
Author

Just retested the CAPI secret variant with v0.15.0. After one initial enrolment (as expected) the secret is stable and restarting the lapi container does not cause new enrolments. I will check if this remains stable when redeploying config changes.

@pfaelzerchen
Copy link
Author

pfaelzerchen commented Nov 27, 2024

I believe it has something to do with the way ArgoCD deploys crowdsec. After changing the values (adding a new collection and acquisition) ArgoCD does a resync and seems to rerun the CAPI key generation leading to a new enrolment in the console.

ArgoCD displays waiting for completion of hook batch/Job/crowdsec-capi-register-job which probably causes the re-enrolment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Improvements or additions to documentation needs/triage Needs triage
Projects
None yet
Development

No branches or pull requests

4 participants