public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
@ 2024-02-10 16:57 Daniel Simionato
  2024-02-10 23:52 ` John Helmert III
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Daniel Simionato @ 2024-02-10 16:57 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1493 bytes --]

Hello,
 I'd like to start a discussion regarding setting HOME_MODE by default in
the /etc/login.defs file (owned by sys-apps/shadow package).

Upstream keeps HOME_MODE commented:
https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207

HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
they will use the specified permission when creating a user home directory,
otherwise the default UMASK will be used.
Since the default umask is 022, keeping HOME_MODE unset will result in home
readable home directories created by useradd, which goes against security
best practices.

The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH
based distros, OpenSuse, ArchLinux all set it to 0700, Ubuntu has it at
0750. Debian and Gentoo are two exceptions, keeping the upstream value of
HOME_MODE (although login.defs is changed in other ways).

I previously made a PR on github where you can find more details (
https://github.com/gentoo/gentoo/pull/35231), but as pointed in the
comments this probably warrants some discussion beforehand.

I can understand the argument against the change, which is keeping in sync
with upstream and don't risk changing the historic default behaviour of
tools some users might rely upon.

I do believe though there's merit in providing safer and secure defaults,
so I would like HOME_MODE to have a safe default value for Gentoo and
Gentoo based distros.

Have a nice day,
 Daniel

[-- Attachment #2: Type: text/html, Size: 2095 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-10 16:57 [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs Daniel Simionato
@ 2024-02-10 23:52 ` John Helmert III
  2024-02-11  1:08   ` Alex Boag-Munroe
  2024-02-11  2:01 ` Michael Orlitzky
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: John Helmert III @ 2024-02-10 23:52 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2022 bytes --]

On Sat, Feb 10, 2024 at 05:57:08PM +0100, Daniel Simionato wrote:
> Hello,
>  I'd like to start a discussion regarding setting HOME_MODE by default in
> the /etc/login.defs file (owned by sys-apps/shadow package).
> 
> Upstream keeps HOME_MODE commented:
> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
> 
> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> they will use the specified permission when creating a user home directory,
> otherwise the default UMASK will be used.
> Since the default umask is 022, keeping HOME_MODE unset will result in home
> readable home directories created by useradd, which goes against security
> best practices.
> 
> The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH
> based distros, OpenSuse, ArchLinux all set it to 0700, Ubuntu has it at
> 0750. Debian and Gentoo are two exceptions, keeping the upstream value of
> HOME_MODE (although login.defs is changed in other ways).
> 
> I previously made a PR on github where you can find more details (
> https://github.com/gentoo/gentoo/pull/35231), but as pointed in the
> comments this probably warrants some discussion beforehand.
> 
> I can understand the argument against the change, which is keeping in sync
> with upstream and don't risk changing the historic default behaviour of
> tools some users might rely upon.
> 
> I do believe though there's merit in providing safer and secure defaults,
> so I would like HOME_MODE to have a safe default value for Gentoo and
> Gentoo based distros.

Setting it to 0700 makes good sense to me, unless someone has some
good example of this breaking anything. Deviating from upstream
defaults in following other distributions isn't exactly treading new
ground for us. And it's easy for the administrator to change to suit
their liking anyway (hopefully covering the "keep the status quo"
class of objections).

> Have a nice day,
>  Daniel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-10 23:52 ` John Helmert III
@ 2024-02-11  1:08   ` Alex Boag-Munroe
  0 siblings, 0 replies; 15+ messages in thread
From: Alex Boag-Munroe @ 2024-02-11  1:08 UTC (permalink / raw)
  To: gentoo-dev

On Sat, 10 Feb 2024 at 23:52, John Helmert III <ajak@gentoo.org> wrote:
>
> On Sat, Feb 10, 2024 at 05:57:08PM +0100, Daniel Simionato wrote:
> > Hello,
> >  I'd like to start a discussion regarding setting HOME_MODE by default in
> > the /etc/login.defs file (owned by sys-apps/shadow package).
> >
> > Upstream keeps HOME_MODE commented:
> > https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
> >
> > HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> > they will use the specified permission when creating a user home directory,
> > otherwise the default UMASK will be used.
> > Since the default umask is 022, keeping HOME_MODE unset will result in home
> > readable home directories created by useradd, which goes against security
> > best practices.
> >
> > The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH
> > based distros, OpenSuse, ArchLinux all set it to 0700, Ubuntu has it at
> > 0750. Debian and Gentoo are two exceptions, keeping the upstream value of
> > HOME_MODE (although login.defs is changed in other ways).
> >
> > I previously made a PR on github where you can find more details (
> > https://github.com/gentoo/gentoo/pull/35231), but as pointed in the
> > comments this probably warrants some discussion beforehand.
> >
> > I can understand the argument against the change, which is keeping in sync
> > with upstream and don't risk changing the historic default behaviour of
> > tools some users might rely upon.
> >
> > I do believe though there's merit in providing safer and secure defaults,
> > so I would like HOME_MODE to have a safe default value for Gentoo and
> > Gentoo based distros.
>
> Setting it to 0700 makes good sense to me, unless someone has some
> good example of this breaking anything. Deviating from upstream
> defaults in following other distributions isn't exactly treading new
> ground for us. And it's easy for the administrator to change to suit
> their liking anyway (hopefully covering the "keep the status quo"
> class of objections).
>
> > Have a nice day,
> >  Daniel

0700 should be the default as far as I'm concerned. 750 makes sense in
some environments, but in those environments a sysadmin should know
well enough to make the changes when it is useful. I never understood
why world readable was default on Gentoo.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-10 16:57 [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs Daniel Simionato
  2024-02-10 23:52 ` John Helmert III
@ 2024-02-11  2:01 ` Michael Orlitzky
  2024-02-11 10:06   ` Sam James
  2024-02-11  2:12 ` Eli Schwartz
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Michael Orlitzky @ 2024-02-11  2:01 UTC (permalink / raw)
  To: gentoo-dev

On Sat, 2024-02-10 at 17:57 +0100, Daniel Simionato wrote:
> Hello,
>  I'd like to start a discussion regarding setting HOME_MODE by default in
> the /etc/login.defs file (owned by sys-apps/shadow package).
> 
> Upstream keeps HOME_MODE commented:
> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
> 
> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> they will use the specified permission when creating a user home directory,
> otherwise the default UMASK will be used.
> Since the default umask is 022, keeping HOME_MODE unset will result in home
> readable home direct

umask 022 is also egregious, changing it to 027 would kill two birds.
But in lieu of that, yes.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-10 16:57 [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs Daniel Simionato
  2024-02-10 23:52 ` John Helmert III
  2024-02-11  2:01 ` Michael Orlitzky
@ 2024-02-11  2:12 ` Eli Schwartz
  2024-02-11  2:20   ` Alex Boag-Munroe
  2024-02-11  8:00 ` Ulrich Mueller
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Eli Schwartz @ 2024-02-11  2:12 UTC (permalink / raw)
  To: gentoo-dev


[-- Attachment #1.1.1: Type: text/plain, Size: 3186 bytes --]

On 2/10/24 11:57 AM, Daniel Simionato wrote:
> Hello,
>  I'd like to start a discussion regarding setting HOME_MODE by default in
> the /etc/login.defs file (owned by sys-apps/shadow package).
> 
> Upstream keeps HOME_MODE commented:
> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
> 
> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> they will use the specified permission when creating a user home directory,
> otherwise the default UMASK will be used.
> Since the default umask is 022, keeping HOME_MODE unset will result in home
> readable home directories created by useradd, which goes against security
> best practices.
> 
> The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH
> based distros, OpenSuse, ArchLinux all set it to 0700, Ubuntu has it at
> 0750. Debian and Gentoo are two exceptions, keeping the upstream value of
> HOME_MODE (although login.defs is changed in other ways).
> 
> I previously made a PR on github where you can find more details (
> https://github.com/gentoo/gentoo/pull/35231), but as pointed in the
> comments this probably warrants some discussion beforehand.
> 
> I can understand the argument against the change, which is keeping in sync
> with upstream and don't risk changing the historic default behaviour of
> tools some users might rely upon.


As a config file, I think we can feel fine changing the defaults without
worrying about diverging from upstream, and sticking to worrying "is
this a good config value for us".

As far as the actual change goes...

Arguments in favor of keeping the existing default:

- "someone might be relying on it"
- security-sensitive software often sets a heavily restricted value for
  this purpose already, e.g. ssh / gnupg
- sometimes it is necessary for other users to see your files, classic
  example being ~/public_html


Arguments in favor of changing the default:

- managing files that should be private by changing their permissions is
  tiresome, and not all private files are managed by "security-sensitive
  software". If you're writing the next Great American Novel in
  libreoffice on a shared user system, did you *know* you'd need to
  protect it from your arch-enemy who hopes to read your homedir and
  sell your novel instead of you?
- You can manage ~/public_html by using setfacl to give apache read
  access to your entire home directory without granting it to everyone.
  You're still vulnerable to complete information leakage of your home
  directory to the apache user, but not also to the aforementioned
  arch-enemy


Regarding which default to change to:

- someone who added another account to their user group probably did so
  with the expectation that they'd be sharing files with that other
  account, and 700 mode in particular feels like going against that


> I do believe though there's merit in providing safer and secure defaults,
> so I would like HOME_MODE to have a safe default value for Gentoo and
> Gentoo based distros.
> 
> Have a nice day,
>  Daniel
> 

-- 
Eli Schwartz

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 18399 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-11  2:12 ` Eli Schwartz
@ 2024-02-11  2:20   ` Alex Boag-Munroe
  0 siblings, 0 replies; 15+ messages in thread
From: Alex Boag-Munroe @ 2024-02-11  2:20 UTC (permalink / raw)
  To: gentoo-dev

On Sun, 11 Feb 2024 at 02:12, Eli Schwartz <eschwartz93@gmail.com> wrote:
<snip>
> - someone who added another account to their user group probably did so
>   with the expectation that they'd be sharing files with that other
>   account, and 700 mode in particular feels like going against that

This change of default would only affect creation of new
accounts/setup on new installs so anyone that already has another user
in their group would be unaffected. A notification on change of
default/updated documentation should be sufficient for people looking
to create accounts and give groups access to things in the future.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-10 16:57 [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs Daniel Simionato
                   ` (2 preceding siblings ...)
  2024-02-11  2:12 ` Eli Schwartz
@ 2024-02-11  8:00 ` Ulrich Mueller
  2024-02-11  9:33   ` James Le Cuirot
  2024-02-11 10:10 ` Sam James
  2024-02-11 13:37 ` Arsen Arsenović
  5 siblings, 1 reply; 15+ messages in thread
From: Ulrich Mueller @ 2024-02-11  8:00 UTC (permalink / raw)
  To: Daniel Simionato; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1908 bytes --]

>>>>> On Sat, 10 Feb 2024, Daniel Simionato wrote:

>  I'd like to start a discussion regarding setting HOME_MODE by default in
> the /etc/login.defs file (owned by sys-apps/shadow package).

> Upstream keeps HOME_MODE commented:
> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207

> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> they will use the specified permission when creating a user home directory,
> otherwise the default UMASK will be used.
> Since the default umask is 022, keeping HOME_MODE unset will result in home
> readable home directories created by useradd, which goes against security
> best practices.

> The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH
> based distros, OpenSuse, ArchLinux all set it to 0700, Ubuntu has it at
> 0750. Debian and Gentoo are two exceptions, keeping the upstream value of
> HOME_MODE (although login.defs is changed in other ways).

> I previously made a PR on github where you can find more details (
> https://github.com/gentoo/gentoo/pull/35231), but as pointed in the
> comments this probably warrants some discussion beforehand.

> I can understand the argument against the change, which is keeping in sync
> with upstream and don't risk changing the historic default behaviour of
> tools some users might rely upon.

> I do believe though there's merit in providing safer and secure defaults,
> so I would like HOME_MODE to have a safe default value for Gentoo and
> Gentoo based distros.

I see no strong argument either way. However, changing the default is
somewhat intrusive, so I'd prefer staying with upstream. Also, are we
aware of any breakage caused by this?

As you've pointed out yourself, distros are inconsistent about it,
i.e. not much guidance from there. Maybe upstream would be a better
place for this discussion?

Ulrich

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-11  8:00 ` Ulrich Mueller
@ 2024-02-11  9:33   ` James Le Cuirot
  0 siblings, 0 replies; 15+ messages in thread
From: James Le Cuirot @ 2024-02-11  9:33 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2291 bytes --]

On Sun, 2024-02-11 at 09:00 +0100, Ulrich Mueller wrote:
> > > > > > On Sat, 10 Feb 2024, Daniel Simionato wrote:
> 
> >  I'd like to start a discussion regarding setting HOME_MODE by default in
> > the /etc/login.defs file (owned by sys-apps/shadow package).
> 
> > Upstream keeps HOME_MODE commented:
> > https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
> 
> > HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> > they will use the specified permission when creating a user home directory,
> > otherwise the default UMASK will be used.
> > Since the default umask is 022, keeping HOME_MODE unset will result in home
> > readable home directories created by useradd, which goes against security
> > best practices.
> 
> > The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH
> > based distros, OpenSuse, ArchLinux all set it to 0700, Ubuntu has it at
> > 0750. Debian and Gentoo are two exceptions, keeping the upstream value of
> > HOME_MODE (although login.defs is changed in other ways).
> 
> > I previously made a PR on github where you can find more details (
> > https://github.com/gentoo/gentoo/pull/35231), but as pointed in the
> > comments this probably warrants some discussion beforehand.
> 
> > I can understand the argument against the change, which is keeping in sync
> > with upstream and don't risk changing the historic default behaviour of
> > tools some users might rely upon.
> 
> > I do believe though there's merit in providing safer and secure defaults,
> > so I would like HOME_MODE to have a safe default value for Gentoo and
> > Gentoo based distros.
> 
> I see no strong argument either way. However, changing the default is
> somewhat intrusive, so I'd prefer staying with upstream. Also, are we
> aware of any breakage caused by this?
> 
> As you've pointed out yourself, distros are inconsistent about it,
> i.e. not much guidance from there. Maybe upstream would be a better
> place for this discussion?
> 
> Ulrich

You may need 0701 if you have a web server reading from ~/public_html, but
that's uncommon. I've been using this for years without issue, but I think
0700 makes the most sense as the default.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 858 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-11  2:01 ` Michael Orlitzky
@ 2024-02-11 10:06   ` Sam James
  2024-02-11 13:08     ` Michał Górny
  0 siblings, 1 reply; 15+ messages in thread
From: Sam James @ 2024-02-11 10:06 UTC (permalink / raw)
  To: gentoo-dev; +Cc: mgorny, chewi

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]


Michael Orlitzky <mjo@gentoo.org> writes:

> On Sat, 2024-02-10 at 17:57 +0100, Daniel Simionato wrote:
>> Hello,
>>  I'd like to start a discussion regarding setting HOME_MODE by default in
>> the /etc/login.defs file (owned by sys-apps/shadow package).
>> 
>> Upstream keeps HOME_MODE commented:
>> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
>> 
>> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
>> they will use the specified permission when creating a user home directory,
>> otherwise the default UMASK will be used.
>> Since the default umask is 022, keeping HOME_MODE unset will result in home
>> readable home direct
>
> umask 022 is also egregious, changing it to 027 would kill two birds.
> But in lieu of that, yes.

mgorny wrote in favour of this 13 years ago too:
https://blogs.gentoo.org/mgorny/2011/10/18/027-umask-a-compromise-between-security-and-simplicity/.

It would be a bigger change and require us to do a lot of daily-driver
testing first though.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-10 16:57 [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs Daniel Simionato
                   ` (3 preceding siblings ...)
  2024-02-11  8:00 ` Ulrich Mueller
@ 2024-02-11 10:10 ` Sam James
  2024-02-11 10:53   ` Eray Aslan
       [not found]   ` <0ca8c68f-11e3-4a68-a857-bfd040e6b084@iodoru.org>
  2024-02-11 13:37 ` Arsen Arsenović
  5 siblings, 2 replies; 15+ messages in thread
From: Sam James @ 2024-02-11 10:10 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michael Vetter

[-- Attachment #1: Type: text/plain, Size: 2014 bytes --]


Daniel Simionato <daniel.simionato@gmail.com> writes:

> Hello,
>  I'd like to start a discussion regarding setting HOME_MODE by default in the /etc/login.defs file (owned by
> sys-apps/shadow package).
>
> Upstream keeps HOME_MODE commented:
> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
>
> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set, they will use the specified permission when
> creating a user home directory, otherwise the default UMASK will be used.
> Since the default umask is 022, keeping HOME_MODE unset will result in home readable home directories created by useradd,
> which goes against security best practices.
>
> The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH based distros, OpenSuse, ArchLinux all set it
> to 0700, Ubuntu has it at 0750. Debian and Gentoo are two exceptions, keeping the upstream value of HOME_MODE (although
> login.defs is changed in other ways).
>
> I previously made a PR on github where you can find more details (https://github.com/gentoo/gentoo/pull/35231), but as
> pointed in the comments this probably warrants some discussion beforehand.
>
> I can understand the argument against the change, which is keeping in sync with upstream and don't risk changing the
> historic default behaviour of tools some users might rely upon.
>
> I do believe though there's merit in providing safer and secure defaults, so I would like HOME_MODE to have a safe
> default value for Gentoo and Gentoo based distros.

I'm in favour, although I'd be curious as to why upstream shadow don't
just set it. It would be interesting to see if the discussion already
happened there at some point (surely it has?) and find out their
reasoning. (But that's not a blocker for proceeding.)

I want to hear more opinions first though. Thanks for raising this,
it's been in the back of my head.

>
> Have a nice day,
>  Daniel 

best,
sam

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-11 10:10 ` Sam James
@ 2024-02-11 10:53   ` Eray Aslan
  2024-02-11 11:16     ` Daniel Simionato
       [not found]   ` <0ca8c68f-11e3-4a68-a857-bfd040e6b084@iodoru.org>
  1 sibling, 1 reply; 15+ messages in thread
From: Eray Aslan @ 2024-02-11 10:53 UTC (permalink / raw)
  To: gentoo-dev

On Sun, Feb 11, 2024 at 10:10:13AM +0000, Sam James wrote:
> I'm in favour, although I'd be curious as to why upstream shadow don't
> just set it. It would be interesting to see if the discussion already
> happened there at some point (surely it has?) and find out their
> reasoning. (But that's not a blocker for proceeding.)

I believe it is for historical reasons. Computer networks and terminals
used to be much friendlier places.

> I want to hear more opinions first though. Thanks for raising this,
> it's been in the back of my head.

Even though I do not really care either way, what problem exactly are we
trying to solve? Better security is just too vague an argument. I can
see the argument if we were selling to business (*cough*red hat*cough*)
but on the other hand, an argument can also be made for keeping to the
roots of computer networks and their naivete (keep information free and
all that stuff). In this regard, it is telling that only debian and
gentoo keep 022.

Consider taking it upstream as someone else (ulm?) already mentioned in
the discussion.

Thanks
-- 
Eray


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-11 10:53   ` Eray Aslan
@ 2024-02-11 11:16     ` Daniel Simionato
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Simionato @ 2024-02-11 11:16 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]

The only previous upstream discussion I was able to find was this on the
pkg-shadow-devel:
https://marc.info/?l=pkg-shadow-devel&m=167120074926229&w=2(
(I don't think the unprivileged container limitation still applies, or at
least it doesn't on my user with a 700 /home)

I can see the argument for keeping the status quo, but I still think it's
better to err on the side of caution with default settings.
But I understand that my point of view might be skewed by personal
preference or by professional experience, so I appreciate the everyone
contributing their opinion.

I have opened a PR upstream to start discussion there
https://github.com/shadow-maint/shadow/pull/946 .

For reference, the concrete use case that put me onto this (
https://github.com/flatcar/Flatcar/issues/1353): provisioning users in
Flatcar through ignition (cloud-init like) at first boot time, even if in
the same config /etc/login.defs is changed, results in 755 home
directories. Some more comments in this PR
https://github.com/kubernetes-sigs/image-builder/pull/1400

The original PR that added HOME_MODE also refers generically to user bug
reports due to the many ways umask can be overriden:
https://github.com/shadow-maint/shadow/pull/208#issue-546914572

Thanks,
 Daniel


Il giorno dom 11 feb 2024 alle ore 11:53 Eray Aslan <eras@gentoo.org> ha
scritto:

> On Sun, Feb 11, 2024 at 10:10:13AM +0000, Sam James wrote:
> > I'm in favour, although I'd be curious as to why upstream shadow don't
> > just set it. It would be interesting to see if the discussion already
> > happened there at some point (surely it has?) and find out their
> > reasoning. (But that's not a blocker for proceeding.)
>
> I believe it is for historical reasons. Computer networks and terminals
> used to be much friendlier places.
>
> > I want to hear more opinions first though. Thanks for raising this,
> > it's been in the back of my head.
>
> Even though I do not really care either way, what problem exactly are we
> trying to solve? Better security is just too vague an argument. I can
> see the argument if we were selling to business (*cough*red hat*cough*)
> but on the other hand, an argument can also be made for keeping to the
> roots of computer networks and their naivete (keep information free and
> all that stuff). In this regard, it is telling that only debian and
> gentoo keep 022.
>
> Consider taking it upstream as someone else (ulm?) already mentioned in
> the discussion.
>
> Thanks
> --
> Eray
>
>

[-- Attachment #2: Type: text/html, Size: 3568 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-11 10:06   ` Sam James
@ 2024-02-11 13:08     ` Michał Górny
  0 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2024-02-11 13:08 UTC (permalink / raw)
  To: gentoo-dev; +Cc: chewi

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

On Sun, 2024-02-11 at 10:06 +0000, Sam James wrote:
> Michael Orlitzky <mjo@gentoo.org> writes:
> 
> > On Sat, 2024-02-10 at 17:57 +0100, Daniel Simionato wrote:
> > > Hello,
> > >  I'd like to start a discussion regarding setting HOME_MODE by default in
> > > the /etc/login.defs file (owned by sys-apps/shadow package).
> > > 
> > > Upstream keeps HOME_MODE commented:
> > > https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
> > > 
> > > HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> > > they will use the specified permission when creating a user home directory,
> > > otherwise the default UMASK will be used.
> > > Since the default umask is 022, keeping HOME_MODE unset will result in home
> > > readable home direct
> > 
> > umask 022 is also egregious, changing it to 027 would kill two birds.
> > But in lieu of that, yes.
> 
> mgorny wrote in favour of this 13 years ago too:
> https://blogs.gentoo.org/mgorny/2011/10/18/027-umask-a-compromise-between-security-and-simplicity/.
> 
> It would be a bigger change and require us to do a lot of daily-driver
> testing first though.

...and I've stopped using that a long time ago too because I kept
messing permissions up.  These days I just explicitly switch umask if I
need something to be secure.

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
  2024-02-10 16:57 [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs Daniel Simionato
                   ` (4 preceding siblings ...)
  2024-02-11 10:10 ` Sam James
@ 2024-02-11 13:37 ` Arsen Arsenović
  5 siblings, 0 replies; 15+ messages in thread
From: Arsen Arsenović @ 2024-02-11 13:37 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]


Daniel Simionato <daniel.simionato@gmail.com> writes:

> Hello,
>  I'd like to start a discussion regarding setting HOME_MODE by default in
> the /etc/login.defs file (owned by sys-apps/shadow package).
>
> Upstream keeps HOME_MODE commented:
> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
>
> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set,
> they will use the specified permission when creating a user home directory,
> otherwise the default UMASK will be used.
> Since the default umask is 022, keeping HOME_MODE unset will result in home
> readable home directories created by useradd, which goes against security
> best practices.
>
> The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH
> based distros, OpenSuse, ArchLinux all set it to 0700, Ubuntu has it at
> 0750. Debian and Gentoo are two exceptions, keeping the upstream value of
> HOME_MODE (although login.defs is changed in other ways).
>
> I previously made a PR on github where you can find more details (
> https://github.com/gentoo/gentoo/pull/35231), but as pointed in the
> comments this probably warrants some discussion beforehand.
>
> I can understand the argument against the change, which is keeping in sync
> with upstream and don't risk changing the historic default behaviour of
> tools some users might rely upon.
>
> I do believe though there's merit in providing safer and secure defaults,
> so I would like HOME_MODE to have a safe default value for Gentoo and
> Gentoo based distros.
>
> Have a nice day,
>  Daniel

+1 for 0700.  I also like the umask suggestions.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs
       [not found]   ` <0ca8c68f-11e3-4a68-a857-bfd040e6b084@iodoru.org>
@ 2024-02-13 20:01     ` Daniel Simionato
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Simionato @ 2024-02-13 20:01 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michael Vetter

Hi,
 the upstream PR was closed, this was the answer:

> No - distros like debian may get caught off guard. There's nothing wrong with downstreams patching their values in their deltas. We do not lightly make changes which change defaults.

https://github.com/shadow-maint/shadow/pull/946#issuecomment-1939667729

Have a nice day,
 Daniel

Il giorno lun 12 feb 2024 alle ore 21:16 Michael Vetter
<jubalh@iodoru.org> ha scritto:
>
> Hello,
>
> In case this mail is weirdly formatted please let me know. And if yes,
> please excuse me in advance..
>
> On 2/11/24 11:10, Sam James wrote:
> > Daniel Simionato <daniel.simionato@gmail.com> writes:
> >
> >> Hello,
> >>   I'd like to start a discussion regarding setting HOME_MODE by default in the /etc/login.defs file (owned by
> >> sys-apps/shadow package).
> >>
> >> Upstream keeps HOME_MODE commented:
> >> https://github.com/shadow-maint/shadow/blob/3e59e9613ec40c51c19c7bb5c28468e33a4529d5/etc/login.defs#L207
> >>
> >> HOME_MODE affects only useradd and newuser commands: if HOME_MODE is set, they will use the specified permission when
> >> creating a user home directory, otherwise the default UMASK will be used.
> >> Since the default umask is 022, keeping HOME_MODE unset will result in home readable home directories created by useradd,
> >> which goes against security best practices.
> >>
> >> The proposal is to set HOME_MODE to 0700, or at least 0750: RedHat and RH based distros, OpenSuse, ArchLinux all set it
> >> to 0700, Ubuntu has it at 0750. Debian and Gentoo are two exceptions, keeping the upstream value of HOME_MODE (although
> >> login.defs is changed in other ways).
> >>
> >> I previously made a PR on github where you can find more details (https://github.com/gentoo/gentoo/pull/35231), but as
> >> pointed in the comments this probably warrants some discussion beforehand.
> >>
> >> I can understand the argument against the change, which is keeping in sync with upstream and don't risk changing the
> >> historic default behaviour of tools some users might rely upon.
> >>
> >> I do believe though there's merit in providing safer and secure defaults, so I would like HOME_MODE to have a safe
> >> default value for Gentoo and Gentoo based distros.
> > I'm in favour, although I'd be curious as to why upstream shadow don't
> > just set it. It would be interesting to see if the discussion already
> > happened there at some point (surely it has?) and find out their
> > reasoning. (But that's not a blocker for proceeding.)
> >
> > I want to hear more opinions first though. Thanks for raising this,
> > it's been in the back of my head.
>
>
> I 'm in favour as well. And in openSUSE we did this as well.
>
> Honestly I don't remember any upstream discussion about this and have no
> idea what it was done this way.
>
> I see Daniel already created
> https://github.com/shadow-maint/shadow/pull/946 for upstream yesterday.
>
>
> Best,
>
> Michael
>
>


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-13 20:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-10 16:57 [gentoo-dev] RFC: Setting default HOME_MODE in /etc/login.defs Daniel Simionato
2024-02-10 23:52 ` John Helmert III
2024-02-11  1:08   ` Alex Boag-Munroe
2024-02-11  2:01 ` Michael Orlitzky
2024-02-11 10:06   ` Sam James
2024-02-11 13:08     ` Michał Górny
2024-02-11  2:12 ` Eli Schwartz
2024-02-11  2:20   ` Alex Boag-Munroe
2024-02-11  8:00 ` Ulrich Mueller
2024-02-11  9:33   ` James Le Cuirot
2024-02-11 10:10 ` Sam James
2024-02-11 10:53   ` Eray Aslan
2024-02-11 11:16     ` Daniel Simionato
     [not found]   ` <0ca8c68f-11e3-4a68-a857-bfd040e6b084@iodoru.org>
2024-02-13 20:01     ` Daniel Simionato
2024-02-11 13:37 ` Arsen Arsenović

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox