Clean up dropbear role
This commit is contained in:
parent
aa01d38f03
commit
dadc992c62
1 changed files with 18 additions and 8 deletions
|
@ -1,15 +1,24 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
|
||||||
# Note: This implementation currently only allows eno1 (first interface) with dhcp.
|
# Note: This implementation currently only allows eno1 (first interface) with dhcp.
|
||||||
|
let
|
||||||
|
ip = "10.1.2.2";
|
||||||
|
gateway = "10.1.2.1";
|
||||||
|
netmask = "255.255.255.0";
|
||||||
|
hostname = config.networking.hostName;
|
||||||
|
primaryInterface = "eno1";
|
||||||
|
in {
|
||||||
boot.initrd.network = {
|
boot.initrd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ssh = {
|
ssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
port = 2222;
|
port = 2222;
|
||||||
# this includes the ssh keys of all users in the wheel group,
|
authorizedKeys = with lib;
|
||||||
# but you can just specify some keys manually
|
concatLists (mapAttrsToList (name: user:
|
||||||
#authorizedKeys = with lib; concatLists (mapAttrsToList (name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else []) config.users.users);
|
if elem "wheel" user.extraGroups then
|
||||||
|
user.openssh.authorizedKeys.keys
|
||||||
|
else
|
||||||
|
[ ]) config.users.users);
|
||||||
hostRSAKey = /boot/dropbear_rsa_host_key;
|
hostRSAKey = /boot/dropbear_rsa_host_key;
|
||||||
hostECDSAKey = /boot/dropbear_ecdsa_host_key;
|
hostECDSAKey = /boot/dropbear_ecdsa_host_key;
|
||||||
# Key generation with dropbearkey -t <type> -f <output-keyfile>
|
# Key generation with dropbearkey -t <type> -f <output-keyfile>
|
||||||
|
@ -18,11 +27,12 @@
|
||||||
echo 'cryptsetup-askpass' >> /root/.profile
|
echo 'cryptsetup-askpass' >> /root/.profile
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"ip=10.1.2.2::10.1.2.1:255.255.255.0:montalin:eno1:none"
|
"ip=${ip}::${gateway}:${netmask}:${hostname}:${primaryInterface}:none"
|
||||||
]; # see https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
|
]; # see https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
|
||||||
|
|
||||||
boot.initrd.postMountCommands = ''
|
boot.initrd.postMountCommands = ''
|
||||||
ip link set eno1 down
|
ip link set ${primaryInterface} down
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue