Page MenuHomePhabricator

Default umask should be set to 0002
Closed, DeclinedPublic

Description

Given the default sharing of tools by group members, 0002 would make more sense as a default umask.


Version: unspecified
Severity: trivial

Details

Reference
bz46468

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:41 AM
bzimport added a project: Toolforge.
bzimport set Reference to bz46468.

This should be the default, now.

Re-opening this for further consideration. I think the default umask should be 0022, not 0002. The Toolserver defaults to 0022.

If I create a .bash_profile and forget to change its permissions, by default any user in the wikidev group can modify it. Ouch.

(In reply to comment #2)

Re-opening this for further consideration. I think the default umask should
be
0022, not 0002. The Toolserver defaults to 0022.

If I create a .bash_profile and forget to change its permissions, by default
any user in the wikidev group can modify it. Ouch.

We need to differentiate between users and tools anyhow. For users, it should be 0022, for tools 0002.

login.defs(5) suggests that we need to enable USERGROUPS_ENAB to achieve exactly that, but /etc/login.defs says it's enabled, yet "ssh tools-login.wmflabs.org umask" gives me 0022 (hooray!), but "ssh tools-login.wmflabs.org" and then "umask" 0002. Very confusing.

Memo to self: sudo has "umask" and "umask_override" to play with.

(In reply to Tim Landscheidt from comment #3)

[...]
login.defs(5) suggests that we need to enable USERGROUPS_ENAB to achieve
exactly that, but /etc/login.defs says it's enabled, yet "ssh
tools-login.wmflabs.org umask" gives me 0022 (hooray!), but "ssh
tools-login.wmflabs.org" and then "umask" 0002. Very confusing.

In eqiad, "ssh tools-login.eqiad" and then "umask" gives now 0022 which is the same as "ssh tools-login.wmflabs.org umask".

What is the nature of the issue that remains, if any?

No remaining issues, and users are better off setting umask explicitly if they need something other than the default.

Sorry for ignoring your previous question. Our setup is designed that users are members of the tool's group so that they have write access to the tool's files and directories. Setting umask to 0022 for tools, while essential for users (or administrators :-)) to not have their files tampered with by anyone in the wikidev group, disallows users from editing files & Co. without sudoing as the tool. So these two defaults clash.

But if a user creates a file in a tool's directory, the user's umask is used anyway, so my ramblings above about sudo are immaterial as sudo isn't in every code path.

It may be possible to solve this with ACL's setfacl, but enabling that could have many side-effects with not so much to gain.