-
Notifications
You must be signed in to change notification settings - Fork 537
Open
Labels
kind/featureneeds/triagevalue/highDoing this significantly improves some areasDoing this significantly improves some areas
Milestone
Description
What would you like to be added?
In this #3202 PR possibility to automatically register machines in LAPI was introduced. As far as I can see, there are no such automatical fuctionality for agents: as pointed in the docs, after LAPI configuration one should manually register agent machine. We wanna use containerized solution with autoscaling, so agents autoregistration is crucial for us.
I've tried several ways to implement such a solution locally:
- Start agent container with LAPI disabled (and try to configure remote LAPI server in runtime) - agent container didn't start because of the next errors:
level=debug msg="running agent after 625.768181ms ms"
level=debug msg="[URL] POST http://0.0.0.0:8080/v1/watchers/login"
level=debug msg="resetting jwt token"
level=fatal msg="unable to start crowdsec routines: authenticate watcher (): Post \"http://0.0.0.0:8080/v1/watchers/login\": performing jwt auth: dial tcp 0.0.0.0:8080: connect: connection refused"
- Start agent container with LAPI enabled, register it to the remote LAPI and restart agent (as described in the blog post) - there were 2 cases:
- after agent registration in remote LAPI, local LAPI was disabled in config (as mentioned in article). After container restart it didn't start becase of the next errors
Error: no matches found
Generate local agent credentials
level=warning msg="crowdsec local API is disabled because 'enable' is set to false"
level=fatal msg="local API is disabled -- this command must be run on the local API machine"
- after agent registration in remote LAPI, local LAPI was not disabled. After container restart LAPI URL was reverted to http://0.0.0.0:8080 according to the entrypoint script
Even if container started without any errors, this solution is not suitable for us - we use AWS Fargate as container runtime, so container restart would lead to its re-creation.
- Start agent container with remote LAPI configured initially:
- token can't be passed in local_api_credentials.yaml
level=fatal msg="loading api client: failed unmarshaling api client credential configuration file '/etc/crowdsec/local_api_credentials.yaml': yaml: unmarshal errors:\n line 1: field token not found in type csconfig.ApiCredentialsCfg"
- passing token via
password
parameter doesn't work (expected π)
Why is this needed?
It would be great to have possibility to pass autoregistration token to agent machines (either via local_api_credentials.yaml or via env vars)
nhlushak
Metadata
Metadata
Assignees
Labels
kind/featureneeds/triagevalue/highDoing this significantly improves some areasDoing this significantly improves some areas