forked from gsauthof/dracut-sshd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dracut-sshd-networkmanager subpackage
99sshd-auto-networkmanager adjusts nm-initrd.service to run for dracut-sshd. - If config is lacking auto DHCP ethernet in the same manner as rootfs NetworkManager. - Clean network teardown prior to switchroot avoids conflicts and gives OS full control. - Settings could be overriden by copying ifcfg or nmconnection settings into the initrd. Fixes: Issues gsauthof#63 gsauthof#68 Signed-off-by: Warren Togami <[email protected]>
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# 2023, Warren Togami <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
# called by dracut | ||
check() { | ||
require_binaries sshd || return 1 | ||
# 0 enables by default, 255 only on request | ||
return 0 | ||
} | ||
|
||
# called by dracut | ||
depends() { | ||
return 0 | ||
} | ||
|
||
# called by dracut | ||
install() { | ||
# allow NetworkManager to auto configure "Wired connection #" DHCP connections for Ethernet interfaces | ||
rm -f "$initdir/usr/lib/NetworkManager/conf.d/initrd-no-auto-default.conf" | ||
|
||
# tell Networkmanager to run | ||
echo "rd.neednet" >> "${initdir}/etc/cmdline.d/50neednet.conf" | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,21 @@ initramfs. It allows for remote unlocking of a fully encrypted | |
root filesystem and remote access to the Dracut emergency shell | ||
(i.e. early userspace). | ||
|
||
%package networkmanager | ||
Summary: Enables NetworkManager for sshd during initramfs | ||
Requires: dracut-sshd | ||
Requires: NetworkManager | ||
|
||
%description networkmanager | ||
This module enables dracut network-manager settings for dracut-sshd. | ||
|
||
- If no configuration is provided it uses DHCP to bring up ethernet | ||
in the same manner as rootfs NetworkManager. | ||
- Cleanly tears down networking prior to switchroot to avoid conflicts | ||
thereby allowing the OS full control of networking config. | ||
- Network settings could be overriden by copying ifcfg or nmconnection | ||
settings into the initrd. e.g. static IP's | ||
|
||
%prep | ||
{{{ git_dir_setup_macro }}} | ||
|
||
|
@@ -30,6 +45,7 @@ root filesystem and remote access to the Dracut emergency shell | |
mkdir -p %{buildroot}/usr/lib/dracut/modules.d | ||
cp -r 46sshd %{buildroot}/usr/lib/dracut/modules.d/ | ||
cp -r 99sshd-shadow-fixup %{buildroot}/usr/lib/dracut/modules.d/ | ||
cp -r 99sshd-networkmanager %{buildroot}/usr/lib/dracut/modules.d/ | ||
|
||
%files | ||
%dir /usr/lib/dracut/modules.d/46sshd/ | ||
|
@@ -43,6 +59,9 @@ cp -r 99sshd-shadow-fixup %{buildroot}/usr/lib/dracut/modules.d/ | |
%doc example/20-wired.network | ||
%doc example/90-networkd.conf | ||
|
||
%files networkmanager | ||
/usr/lib/dracut/modules.d/99sshd-networkmanager/module-setup.sh | ||
|
||
%changelog | ||
* Sat May 27 2023 Georg Sauthoff <[email protected]> - 0.6.5-1 | ||
- eliminate tmpfiles and fix Debian/Ubuntu support | ||
|