consul: allow non-root Nomad to rewrite token (#24410)

When a task restarts, the Nomad client may need to rewrite the Consul token, but
it's created with permissions that prevent a non-root agent from writing to
it. While Nomad clients should be run as root (currently), it's harmless to
allow whatever user the Nomad agent is running as to be able to write to it, and
that's one less barrier to rootless Nomad.

Ref: https://github.com/hashicorp/nomad/issues/23859#issuecomment-2465757392
This commit is contained in:
Tim Gross
2024-11-19 10:21:14 -05:00
committed by GitHub
parent dc501339da
commit a420732424
2 changed files with 4 additions and 1 deletions

3
.changelog/24410.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
consul: Fixed a bug where non-root Nomad agents could not recreate a task's Consul token on task restart
```

View File

@@ -25,7 +25,7 @@ const (
// consulTokenFilePerms is the level of file permissions granted on the file in
// the secrets directory for the task
consulTokenFilePerms = 0440
consulTokenFilePerms = 0640
)
type consulHook struct {