diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2026-08-27 23:07:02 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2026-08-27 23:07:02 -0500 |
| commit | 89f2c328fc1b113a9e9b862841e0c7d0391b3d09 (patch) | |
| tree | 447bb5894afc1b7908ffac7cadb03796cc01a5e1 /rules/smartctl.yml | |
| parent | ca193ad52b2ee2985af079be0159cc679c914f02 (diff) | |
| download | telemetry-flake-89f2c328fc1b113a9e9b862841e0c7d0391b3d09.tar.xz telemetry-flake-89f2c328fc1b113a9e9b862841e0c7d0391b3d09.zip | |
generate Grafana's secret key by default
Grafana's upstream default for security.secret_key is a constant compiled into
every release, which is why nixpkgs 26.05 stopped passing it through and started
asserting. Requiring secretKeyFile made that assertion the first thing anyone
hit, and forced a secret manager plus a container bindMount on a deployment
whose Grafana database holds no credentials at all -- both datasources are
provisioned without any.
generateSecretKey defaults to true (and to false as soon as secretKeyFile is
set), writing 32 random bytes to Grafana's data directory on first start. The
unit runs as the grafana user into a directory users.users.grafana.createHome
already owns, so there is no chown and nothing fights Grafana for the directory.
UMask=0077 makes the file 0600 on creation and an unconditional chmod repairs
one left readable by a previous version or a manual copy.
The tradeoff is stated in the option description rather than hidden: the key
lives beside the database it encrypts, so it defends against a stolen
grafana.db, not against filesystem access. secretKeyFile remains for when the
database holds a datasource password or a contact-point token.
Verified both paths build: with no secret wiring the generator unit is present
and LoadCredential points into the data directory; with secretKeyFile set the
generator is absent and LoadCredential points at the supplied path. Both emit
secret_key=$__file{...} into config.ini. The script is idempotent, leaves an
existing key untouched, and restores 0600 on a file chmodded to 0644.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JKczN1f66kmLxNBLX37voQ
Diffstat (limited to 'rules/smartctl.yml')
0 files changed, 0 insertions, 0 deletions
