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

Allow logging in to rescue/emergency shell as root #526

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SYSTEM_DROPINS += systemd-random-seed.service
SYSTEM_DROPINS += tor.service tor@default.service
SYSTEM_DROPINS += systemd-timesyncd.service
SYSTEM_DROPINS += systemd-logind.service
SYSTEM_DROPINS += sysinit.target
SYSTEM_DROPINS += sysinit.target emergency.service rescue.service
ifeq ($(ENABLE_SELINUX),1)
SYSTEM_DROPINS += selinux-autorelabel.target selinux-autorelabel.service
endif
Expand Down
5 changes: 4 additions & 1 deletion boot/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
LIBDIR ?= /usr/lib
SYSCONFDIR ?= /etc
GRUBCONFDIR ?= $(SYSCONFDIR)/grub.d
DRACUTCONFDIR ?= $(LIBDIR)/dracut/dracut.conf.d
DRACUTDIR ?= $(LIBDIR)/dracut
DRACUTCONFDIR ?= $(DRACUTDIR)/dracut.conf.d
DRACUTMODDIR ?= $(DRACUTDIR)/modules.d

.PHONY: install

install:
install -D -m 0644 grub.qubes $(DESTDIR)$(GRUBCONFDIR)/30_qubes
install -D -m 0644 dracut-qubes.conf $(DESTDIR)$(DRACUTCONFDIR)/30-qubes.conf
install -D -m 0755 modules-setup.sh $(DESTDIR)$(DRACUTMODDIR)/99qubes/module-setup.sh
10 changes: 10 additions & 0 deletions boot/module-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
depends () {
}

install () {
if [ -h /lib ]; then
inst_multiple /usr/lib/systemd/system/rescue.service.d/30_qubes.conf /usr/lib/systemd/system/emergency.service.d/30_qubes.conf
else
inst_multiple /lib/systemd/system/rescue.service.d/30_qubes.conf /lib/systemd/system/emergency.service.d/30_qubes.conf
fi
}
2 changes: 2 additions & 0 deletions debian/qubes-core-agent.install
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ lib/systemd/system/sysinit.target.d/30_qubes.conf
lib/systemd/system/systemd-timesyncd.service.d/30_qubes.conf
lib/systemd/system/systemd-logind.service.d/30_qubes.conf
lib/systemd/resolved.conf.d/30_resolved-no-mdns-or-llmnr.conf
lib/systemd/system/rescue.service.d/30_qubes.conf
lib/systemd/system/emergency.service.d/30_qubes.conf
usr/lib/sysctl.d/20-qubes-core.conf
usr/lib/systemd/user/tracker-extract-3.service.d/30_qubes.conf
usr/lib/systemd/user/tracker-miner-fs-3.service.d/30_qubes.conf
Expand Down
26 changes: 25 additions & 1 deletion rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Requires: sed
Requires: util-linux
Requires: e2fsprogs
Requires: hostname
Requires: (%{name}-dracut if dracut)
# for Qubes Manager VM updater
Requires: xterm
# for qubes-desktop-run
Expand Down Expand Up @@ -373,6 +374,19 @@ switching from user to root. Since all the user data in a VM is accessible
already from normal user account, there is not much more to guard there. Qubes
VMs are single user systems.

%package dracut
Summary: Dracut configuration needed in Qubes OS
License: GPL
Group: Qubes
Requires: dracut
Requires: qubes-core-agent = %{version}

%description dracut
Dracut configuration needed in Qubes OS. This enables
passwordless login in rescue and emergency modes, as well
as configuring dracut to only install certain drivers and
omit others.

%package thunar
Summary: Thunar support for Qubes VM tools
Requires: Thunar
Expand Down Expand Up @@ -521,6 +535,7 @@ sed -i \
%endif

install -D -m 0644 boot/dracut-qubes.conf $RPM_BUILD_ROOT/usr/lib/dracut/dracut.conf.d/30-qubes.conf
install -D -m 0755 boot/module-setup.sh $RPM_BUILD_ROOT/usr/lib/dracut/modules.d/99qubes/module-setup.sh
install -D -m 0644 boot/grub.qubes $RPM_BUILD_ROOT/etc/default/grub.qubes

%if ! %with_sysvinit
Expand Down Expand Up @@ -1020,7 +1035,7 @@ rm -f %{name}-%{version}
/usr/lib/qubes/resize-rootfs
/usr/lib/qubes/set-default-text-editor
/usr/lib/qubes/tinyproxy-wrapper
/usr/lib/dracut/dracut.conf.d/30-qubes.conf

/usr/lib/environment.d/60-gnome-software-fix.conf
%dir /usr/lib/qubes/init
/usr/lib/qubes/init/bind-dirs.sh
Expand Down Expand Up @@ -1090,6 +1105,11 @@ rm -f %{name}-%{version}
/usr/share/caja-python/extensions/qvm_dvm_caja.py*
%endif

%files dracut
/usr/lib/dracut/dracut.conf.d/30-qubes.conf
%dir /usr/lib/dracut/modules.d/99qubes
/usr/lib/dracut/modules.d/99qubes/module-setup.sh

%files nautilus
/usr/share/nautilus-python/extensions/qvm_copy_nautilus.py*
/usr/share/nautilus-python/extensions/qvm_move_nautilus.py*
Expand Down Expand Up @@ -1298,6 +1318,10 @@ The Qubes core startup configuration for SystemD init.
%dir %_unitdir/sysinit.target.d
%_unitdir/sysinit.target.d/30_qubes.conf
%dir %_userunitdir/*.service.d
%dir %_unitdir/rescue.service.d
%dir %_unitdir/emergency.service.d
%_unitdir/emergency.service.d/30_qubes.conf
%_unitdir/rescue.service.d/30_qubes.conf
%_userunitdir/tracker-extract-3.service.d/30_qubes.conf
%_userunitdir/tracker-miner-fs-3.service.d/30_qubes.conf
%_userunitdir/tracker-miner-fs-control-3.service.d/30_qubes.conf
Expand Down
2 changes: 2 additions & 0 deletions vm-systemd/emergency.service.d/30_qubes.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
Environment=SYSTEMD_SULOGIN_FORCE=1
2 changes: 2 additions & 0 deletions vm-systemd/rescue.service.d/30_qubes.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
Environment=SYSTEMD_SULOGIN_FORCE=1