-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn and fix umask values that are too permissive #686
Conversation
cmd/spire-agent/cli/run/run.go
Outdated
@@ -30,6 +30,8 @@ const ( | |||
defaultDataDir = "." | |||
defaultLogLevel = "INFO" | |||
defaultUmask = 0077 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I would have expected this to go away? What role does it play now that we have a minimum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default provides our default umask which filters out group and everyone perms. You can change the umask to be slightly more permissive, but not beyond the minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umask can be changed by the operator too right? Does it make sense to do away with the configurable altogether and take whatever we get so long as it's minimum or better? Just feels a little simpler (and more traditional) than what we have now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a commit that moves in this direction. If the configurable is set, a warning is issued. If the configurable is does not include the minimum bits required, a warning is issued, and it is upgraded before being set. Otherwise, the current umask is checked, and if it does not have the minimum required bits, a warning is issued and the umask is upgraded.
Signed-off-by: Andrew Harding <azdagron@gmail.com>
- moved umask setting out of agent/server packages into CLI - umask setting via config is deprecated (warning logged) - umask must meet minimum requirements whether set via config or not. In either case, a warning is logged and the umask is upgraded. Signed-off-by: Andrew Harding <azdagron@gmail.com>
Signed-off-by: Andrew Harding <azdagron@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes @azdagron!
pkg/common/cli/umask.go
Outdated
desiredUmask |= minimumUmask | ||
log.Warnf("Desired umask %#04o is too permissive; setting umask %#04o.", badUmask, desiredUmask) | ||
} else { | ||
log.Warnf("Setting umask %#04o.", desiredUmask) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can get away without this one? Or perhaps it could be a debug message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be fine making it debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, i just consolidated it into the warning message for deprecation. I think it turned out pretty clean.
Signed-off-by: Andrew Harding <azdagron@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect!
If a umask value is provided that does not meet minimum requirements, log a warning and upgrade the umask to the minimum requirement.
The minimum requirement is defined as 0027 (masks out group write and everyone read/write/execute bits).
Fixes #664