Skip to content
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

Merged
merged 5 commits into from
Jan 25, 2019

Conversation

azdagron
Copy link
Member

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

@@ -30,6 +30,8 @@ const (
defaultDataDir = "."
defaultLogLevel = "INFO"
defaultUmask = 0077
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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>
evan2645
evan2645 previously approved these changes Jan 25, 2019
Copy link
Member

@evan2645 evan2645 left a 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!

desiredUmask |= minimumUmask
log.Warnf("Desired umask %#04o is too permissive; setting umask %#04o.", badUmask, desiredUmask)
} else {
log.Warnf("Setting umask %#04o.", desiredUmask)
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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>
Copy link
Member

@evan2645 evan2645 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect!

@azdagron azdagron merged commit 0f569e2 into spiffe:master Jan 25, 2019
@azdagron azdagron deleted the umask-fix branch January 25, 2019 22:24
@evan2645 evan2645 mentioned this pull request Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants