Populate missing config files when only part of /etc/crowdsec is mounted#4574
Populate missing config files when only part of /etc/crowdsec is mounted#4574saruprim wants to merge 1 commit into
Conversation
|
@saruprim: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI 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 BirthdayResearch/oss-governance-bot repository. |
|
@saruprim: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI 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 BirthdayResearch/oss-governance-bot repository. |
|
/kind fix |
|
/area configuration |
Problem
The container only populates
/etc/crowdsecfrom/staging/etc/crowdsecwhen bothconfig.yamlandlocal_api_credentials.yamlare missing:This means that if a user mounts only one of these files, the staging configuration is never copied and the missing file is not created.
Example
A valid use case is running an agent-only container with:
DISABLE_LOCAL_API=truelocal_api_credentials.yamlpointing to an external LAPIFor example:
In this scenario, only
local_api_credentials.yamlis provided by the user.Because the file already exists, the condition above evaluates to false,
config.yamlis never copied from/staging, and the container later fails because/etc/crowdsec/config.yamlis missing.Expected behavior
If either
config.yamlorlocal_api_credentials.yamlis missing, the container should populate any missing default configuration files from/stagingwithout overwriting existing ones.Since
rsyncis already called with--ignore-existing, it is safe to run even when some configuration files are already present.One possible fix would be to remove the condition entirely and always execute: