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

sysusers: properly mark generated accounts as locked #13277

Merged
merged 1 commit into from
Aug 14, 2019

Conversation

poettering
Copy link
Member

Previously, we'd only set the shell to /usr/bin/nologin and lock the
password for system users. Let's go one step further and also lock the
whole account.

This is a paranoid safety precaution, since neither disabling the shell
like this nor disabling the password is sufficient to lock an account,
since remote shell tools generally allow passing different shells, and
logins into ftp or similar protocols don't know the shell concept anyway.
Moreover, in times of ssh authentication by password is just one
option of authentication among many.

Takes inspiration from the recommendations in usermod(8)'s -L switch:

"Note: if you wish to lock the account (not only access with a
password), you should also set the EXPIRE_DATE to 1."

Previously, we'd only set the shell to /usr/bin/nologin and lock the
password for system users. Let's go one step further and also lock the
whole account.

This is a paranoid safety precaution, since neither disabling the shell
like this nor disabling the password is sufficient to lock an account,
since remote shell tools generally allow passing different shells, and
logins into ftp or similar protocols don't know the shell concept anyway.
Moreover, in times of ssh authentication by password is just one
option of authentication among many.

Takes inspiration from the recommendations in usermod(8)'s -L switch:

    "Note: if you wish to lock the account (not only access with a
    password), you should also set the EXPIRE_DATE to 1."
@keszybz
Copy link
Member

keszybz commented Aug 14, 2019

Ack, seems reasonable to do this.

@keszybz keszybz merged commit 636e72b into systemd:master Aug 14, 2019
@eli-schwartz
Copy link
Contributor

Note that this seems to break at least gdm: https://bugs.archlinux.org/task/63706

Arch Linux uses a sysusers file to create the gdm user account as part of the package installation process...

@eli-schwartz
Copy link
Contributor

cf. #13522

@ahkok
Copy link
Contributor

ahkok commented Oct 10, 2019

metoo

I'm about as conflicted as to what is the right solution here. For now I'm throwing this into Clear Linux OS:

https://gist.github.com/ahkok/98d0a32383a5e7f121f223053575cdfd

@amishmm
Copy link

amishmm commented Oct 21, 2019

This change broke all my scripts using "su postgres -c command" because postgres account is now created as "expired" account in new installation of Arch linux.

And su now does not run the script stating that user account has expired. Am I doing anything wrong by using su?

@keszybz
Copy link
Member

keszybz commented Oct 21, 2019

Yeah, I don't think we should lock the account. Let's revert this. (In particular, this is a clear compatibility break.)

keszybz added a commit to keszybz/systemd that referenced this pull request Oct 21, 2019
This reverts the gist of commit 636e72b.
The comment and the tiny cleanup are left alone.

We shouldn't lock the accounts because people actually need to use them, and
if they are locked, various tools will refuse.
See systemd#13277 (comment)
and follow-up comments.
@keszybz
Copy link
Member

keszybz commented Oct 21, 2019

See #13813.

@ahkok
Copy link
Contributor

ahkok commented Oct 21, 2019

Honestly I'm still a fan of being able to lock down many accounts. Note that we've locked down even postgres in Clear Linux (and provided workarounds for su postgres workflows). We are still allowing login manager accounts not to be locked.

Long term I think we want sysusers.d to support locking accounts?

@keszybz
Copy link
Member

keszybz commented Oct 21, 2019

Yeah, but it should be opt-in, for backwards compatiblity.

yuwata pushed a commit that referenced this pull request Oct 22, 2019
This reverts the gist of commit 636e72b.
The comment and the tiny cleanup are left alone.

We shouldn't lock the accounts because people actually need to use them, and
if they are locked, various tools will refuse.
See #13277 (comment)
and follow-up comments.
keszybz added a commit to systemd/systemd-stable that referenced this pull request Nov 19, 2019
This reverts the gist of commit 636e72b.
The comment and the tiny cleanup are left alone.

We shouldn't lock the accounts because people actually need to use them, and
if they are locked, various tools will refuse.
See systemd/systemd#13277 (comment)
and follow-up comments.

(cherry picked from commit 12c8293)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

5 participants