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

fix, forbid non-root users using 'su' #171

Closed
wants to merge 3 commits into from

Conversation

adrelanos
Copy link
Member

fix, forbid non-root users using 'su'

(this changes nothing related to Qubes default passwordless sudo)

port to /usr/share/pam-configs

QubesOS/qubes-issues#1128 (comment)

Untested.

Patrick Schleizer added 3 commits July 14, 2019 10:27
(this changes nothing related to Qubes default passwordless sudo)

port to /usr/share/pam-configs

QubesOS/qubes-issues#1128
@codecov-io
Copy link

Codecov Report

Merging #171 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #171   +/-   ##
=======================================
  Coverage   65.48%   65.48%           
=======================================
  Files           2        2           
  Lines         394      394           
=======================================
  Hits          258      258           
  Misses        136      136

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da3c22b...2856396. Read the comment docs.

@adrelanos
Copy link
Member Author

@adrelanos
Copy link
Member Author

Can you make file misc/passwordless end up in package qubes-core-agent-passwordless-root as /usr/share/pam-configs/passwordless?

It belongs into package qubes-core-agent-passwordless-root rather than qubes-core-agent-linux.

Copy link
Member

@marmarek marmarek left a comment

Choose a reason for hiding this comment

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

Can you make file misc/passwordless end up in package qubes-core-agent-passwordless-root as /usr/share/pam-configs/passwordless?

It's enough to add it to debian/qubes-core-agent-passwordless-root.install. Note that right now, the package build fails, because this file isn't mentioned by any debian/*.install.

But even with the above handled, this behaves strangely:

  • su - from user logged in xl console works - switches to root without password prompt
  • su - from user on xterm/gnome-terminal prompts for the password

I don't see why it's happening.

@adrelanos
Copy link
Member Author

adrelanos commented Aug 6, 2019 via email

@marmarek
Copy link
Member

marmarek commented Aug 8, 2019

Without security-misc. I think I know what is going on here:
According to logs, pam_wheel deny any of those attempts, because user is not a member of sudo group. What works, is qubes-core-agent-passwordless-root package setting root's password to empty. Then pam_unix.so line has nullok_secure option, which accepts empty password only on terminal listed in /etc/securetty (which happen to include hvc0, but not pts/*).

@marmarek
Copy link
Member

marmarek commented Aug 8, 2019

What about using auth sufficient pam_listfile.so item=tty sense=allow file=/etc/security/passwordless-tty.conf and /etc/security/passwordless-tty.conf containing just hvc0 (and maybe tty1?)?

This would allow passwordless login on xl console to any user (including root and user), without setting empty password. Should also not interfere with qubes-core-agent-linux-passwordless-root package (or lack of it).

@marmarek
Copy link
Member

marmarek commented Aug 8, 2019

On the other hand, it will allow anything running on hvc0 to use this passwordless auth. For example if you login as user there, then you can su - to root without being asked for the password. But not on other consoles. Also, I think you can't easily delegate it elsewhere - for example if you use screen or tmux, a session inside won't have this property.

@adrelanos
Copy link
Member Author

On the other hand, it will allow anything running on hvc0 to use this passwordless auth. For example if you login as user there, then you can su - to root without being asked for the password.

That would make package qubes-core-agent-passwordless-root (somewhat) superfluous and going against QubesOS/qubes-issues#2695.

Not great but may be better then the very bad implementation right now that any non-root user is allowed to use su as a temporary solution if we cannot think of a proper solution and/or move towards QubesOS/qubes-issues#2695.

My end goal is purging qubes-core-agent-passwordless-root + QubesOS/qubes-issues#2695 + DispVM and/or Qubes-VM-Hardening for strong linux user account based isolation.

pwmarcz added a commit to pwmarcz/qubes-core-agent-linux that referenced this pull request May 7, 2020
Instead of the old workaround that replaces the whole PAM config,
use Debian's framework (pam-configs) to add a rule for su. Enable it
for users in qubes group only.

PAM Config framework documentation:
  https://wiki.ubuntu.com/PAMConfigFrameworkSpec

Issue:
  QubesOS/qubes-issues#5799

Original PR this change is based on:
  QubesOS#171
@marmarek
Copy link
Member

This is handled in #228

@marmarek marmarek closed this May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants