Deleted.

user-sysmaint-split
user-sysmaint-split - Role-Based Boot Modes - Persistent User / Live user / Persistent sysmaint (system maintenance)
Deleted.
OK, so to begin with, I was wrong about doas only allowing environment variables to be preserved on a per-command basis. (I.e., I thought you could only say "preserve vars X, Y, and Z for each command, and that you couldn’t say “preserve these environment variables regardless of what command I run”. This was due to me misreading OpenBSD’s doas.conf manpage (doas.conf(5) - OpenBSD manual pages). The Arch Wiki page for doas at doas - ArchWiki corrected my understanding here, the syntax to use for enabling an environment variable to be passed through on a per-user or per-group (rather than per-command) basis is apparently:
permit setenv { VAR1 VAR2 } :group
I’ll amend my original post to reflect this.
To follow up on my previous review of doas porting feasibility, I’ve taken a look at both Kicksecure and Whonix running under Qubes OS. Here are the results. Just like before, a checkmark means “looks like it can be ported” or “isn’t necessary”, while no checkmark means it’s likely to be problematic.
/etc/sudoers.d/qt_x11_no_mitshm
Defaults env_keep += "QT_X11_NO_MITSHM"
permit setenv { QT_X11_NO_MITSHM } :sudo
/etc/sudoers.d/qubes
qubes
group. There’s some SELinux stuff going on with it that can’t be ported, but since Kicksecure is based on Debian I don’t expect this to be a problem (I don’t believe SELinux is even used in Whonix or other Debian-based Qubes). /etc/sudoers.d/qubes-input-trigger
user ALL=(root) NOPASSWD:/bin/systemctl --no-block start qubes-input-sender-keyboard@event[0-9].service
permit nopass user as root cmd /bin/systemctl args --no-block start qubes-input-sender-keyboard@event0.service
, plus eight more lines with event1.service
, event2.service
, etc. /etc/sudoers.d/umask
edit: somehow the O in “OK” got replaced by a smiling emoji, fixed it
One question that does come to mind is, the Qubes-specific config is coming from Qubes OS, not from Whonix or Kicksecure. Porting things to doas means that some of Qubes OS’s software will need to be ported to be doas-compatible also, which may or may not be something they’re interested in. In the worst case, we’d end up having to maintain sudoers support for Qubes, and only providing doas support for non-Qubes. Maintaining both sounds like it could be difficult. Might be worth filing a feature request in Qubes OS?
dpkg -S /etc/sudoers.d/umask
qubes-core-agent: /etc/sudoers.d/umask
Will need to open a ticket at Qubes.
Related:
Will also need a ticket.
Yes.
Yes, please.
I just did a quick test, and it appears that processes launched via doas simply inherit the umask of the caller.
[user ~]% umask
022
[user ~]% doas bash
root@localhost:/home/user# umask
0022
root@localhost:/home/user# exit
exit
[user ~]% umask 077
[user ~]% doas bash
root@localhost:/home/user# umask
0077
root@localhost:/home/user# exit
exit
[user ~]% umask 000
[user ~]% doas bash
root@localhost:/home/user# umask
0000
root@localhost:/home/user# exit
exit
Similar behavior is observed when using doas zsh
rather than doas bash
. This may be sufficient to work around the inability to configure umask in doas.
upstream feature discussion: 'Investigating adding functionality to doas' thread - MARC
Late, but better late then never… How about run0?
Advantages:
Disadvantages:
I don’t really think we should go with run0:
There’s a few other issues or at least concerns (for instance you can pass through arbitrary environment variables using the --setenv
argment, the only reason this isn’t a security vulnerability that I can see is that you can’t configure run0 to run a command without a password), but I don’t think it’s practical or advisable for Kicksecure or Whonix to use run0. I think we’ll be in much better shape if we stick with doas. Thanks to doas’s isolation, we can probably audit it easier too if we choose to do that.
Excellent points on run0
, thank you! So if anything, let’s stick with doas
.
Actually, I was just considering, a “sudoless” design. It might be possible. Development notes are here:
In that case, neither a port to doas
would be required (nor a run0
port would be required).
Hmm, sudoless comes with its own unique set of challenges as well, though it looks hopeful. Some notable hurdles from an initial quick skim:
(I have a more detailed list of stuff here, but it’s not polished enough for me to publish yet, some of the more complicated packages I didn’t audit fully.)
How so? It has no sudoers exception.
This one we can say “boot into admin mode”.
Needs re-design.
We’ll just break the functionality as long as doas
isn’t installed. As long as Tor Browser is unavailable as a Debian package [1] and thereby properly installed into the system and keeping out executable of the /home
folder, Whonix probably should not enable noexec
[1] for /home
by default.
Qubes has a separate ticket. → Qubes sudo / su / root Hardening - Development Discussion
Qubes default is to install qubes-core-agent-passwordless-root
. The plan for Kicksecure, Whonix is to no longer install qubes-core-agent-passwordless-root
by default. Users will then be advised to open a Qubes Root Console instead.
[1] Would stable Tor Browser deb package help or burden whonix devs?
[2] Enhanced Security via Mount Options and Compiler Restrictions
True (I believe, working off memory and didn’t double-check), however there’s a GUI script for it that doesn’t seem like something that can be used in admin mode (it only applies to each specific boot). I guess it is a privileged operation though, so it probably is something we’ll just live without.
We’ll just break the functionality as long as
doas
isn’t installed
hmm, I guess it won’t be that much of a problem based on the research I’ve done so far. We will lose the ability to restart, stop, or even view the logs of sdwdate though, is that acceptable?
We will lose the ability to restart, stop, or even view the logs of sdwdate though, is that acceptable?
If worse comes to worse, yes. sdwdate-gui could show restart/stop actions only if started as admin.
As for logs, a sdwdate-logs.service systemd unit, doing something like the following would likely work (simplified):
journalctl --boot --output=cat -u sdwdate > /run/sdwdate/sdwdate-log.txt
In practice, sdwdate-log-viewer would need to be adjusted to do that. (Or something similar to sdwdate-log-viewer.)
We ended up not using doas
. Instead, GitHub - Kicksecure/privleap: Limited Privilege Escalation Framework has been invented thanks to @arraybolt3. privleap
has been written in memory-safe language Python. privleap
does not have SUID attack surface because it has been implemented without SUID.
All uses of sudo
by account user
in Kicksecure, Whonix source code have been ported to to privleap
. past notes: sudo / doas / sudoless / privleap
No Access to Privilege Escalation Tools (such as sudo
or pkexec
) for Limited Accounts (such as for account user
) has been implemented as part of:
user-sysmaint-split - Role-Based Boot Modes - Persistent User / Live user / Persistent sysmaint (system maintenance)
With user-sysmaint-split
installed, there is no sudo
SUID attack surface even if account user
gets compromised. This is because account user
can no longer use sudo
by default. [1]
Example sudo
command.
sudo nano
Example error message.
zsh: permission denied: sudo
zsh: exit 126 sudo nano
User documentation:
sysmaint
This has been available at least since 17.3.5.3
and above. (Unreleased at time of writing.)
Written about this also here:
Why passwordless sudo by default? - #5 by Patrick - Support - Kicksecure Forums
[1] opt-out: Unrestricted Admin Mode