This repository has no description
1.4 kB
49 lines
1{config, pkgs, ... }:
2## unlock command:
3# (pass admin/$host/root;echo) | torify ssh root@$(pass hosts/$host/initrd/hostname) 'cat > /crypt-ramfs/passphrase'
4{
5 boot.initrd.network.enable = true;
6 boot.initrd.network.ssh = {
7 enable = true;
8 port = 22;
9 authorizedKeys = [
10 config.krebs.users.lass.pubkey
11 config.krebs.users.lass-mors.pubkey
12 config.krebs.users.lass-green.pubkey
13 ];
14 hostKeys = [ "${config.krebs.secret.directory}/ssh.ed25519_key" ];
15 };
16 boot.initrd.availableKernelModules = [ "e1000e" ];
17
18 boot.initrd.secrets = {
19 "/etc/tor/onion/bootup" = "${config.krebs.secret.directory}/initrd";
20 };
21
22 boot.initrd.extraUtilsCommands = ''
23 copy_bin_and_libs ${pkgs.tor}/bin/tor
24 '';
25
26 # start tor during boot process
27 boot.initrd.network.postCommands = let
28 torRc = (pkgs.writeText "tor.rc" ''
29 DataDirectory /etc/tor
30 SOCKSPort 127.0.0.1:9050 IsolateDestAddr
31 SOCKSPort 127.0.0.1:9063
32 HiddenServiceDir /etc/tor/onion/bootup
33 HiddenServicePort 22 127.0.0.1:22
34 '');
35 in ''
36 echo "tor: preparing onion folder"
37 # have to do this otherwise tor does not want to start
38 chmod -R 700 /etc/tor
39
40 echo "make sure localhost is up"
41 ip a a 127.0.0.1/8 dev lo
42 ip link set lo up
43
44 echo "tor: starting tor"
45 tor -f ${torRc} --verify-config
46 tor -f ${torRc} &
47 '';
48}
49