Client packer does not use config filters, prevents passing keys as environment variables
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 796
- PR merge metrics
- No merged PRs in 30d
Description
I am running GRR containerized and passing in crypto keys via environment variables:
/etc/grr/server.local.yaml:
```
CA.certificate: "%(CA_CERTIFICATE|env)"
Client.executable_signing_public_key: "%(EXECUTABLE_SIGNING_PUB_KEY|env)"
```
When trying to repack clients with `grr_config_updater repack_clients`, I get errors complaining about missing keys:
```
Build Config Error: Invalid Client.executable_signing_public_key: %(EXECUTABLE_SIGNING_PUB_KEY|env)
Build Config Error: CA certificate missing from config.
```
This occurs because for these two values, `GrrConfigManager.GetRaw` instead of `GrrConfigManager.Get` is being used, which prevents my environment variable interpolation from taking place and leading to the above errors:
https://github.com/google/grr/blob/633b1bc5c86c49468b19cd5f78a82fd2b5dfa099/grr/core/grr_response_core/lib/build.py#L373-L376
https://github.com/google/grr/blob/633b1bc5c86c49468b19cd5f78a82fd2b5dfa099/grr/core/grr_response_core/lib/build.py#L390-L391
This issue does not occur if you use `grr_config_updater generate_keys` first before repacking clients, because that command saves the key values directly, which is compatible with the assumption made above.
To get around this current issue while still allowing keys passed in via environment variables, I have had to resort to passing these keys with the `-p` flag as part of my repacking script:
```
grr_config_updater -p CA.certificate="$CA_CERTIFICATE" -p Client.executable_signing_public_key="$EXECUTABLE_SIGNING_PUB_KEY" repack_clients
```
Which is less than ideal.
Contributor guide
Assessment
This issue has not been assessed yet.