Skip to content

Commit dfa54c0

Browse files
committed
secrets: use a multi-key setup with strong auth for multi device conf
1 parent eaae53e commit dfa54c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+32
-26
lines changed

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
secrets/** filter=git-crypt diff=git-crypt
1+
secrets/headfull/** filter=git-crypt diff=git-crypt
2+
secrets/emet-selch/** filter=git-crypt-emet-selch diff=git-crypt-emet-selch
3+
secrets/common/** filter=git-crypt-common diff=git-crypt-common

bootstrap/bootstrap.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/bin/sh
2+
# THIS IS A HEADFULL ONLY BOOTSTRAPPER! I NEED TO MAKE ONE FOR OTHER DEVICES TOO
3+
# AAAAAAA
4+
25
echo "Welcome to navi's bootstrapper!"
36
cat icon.motd
47

5-
echo "4d16330208714286d397e2cf7d8a977ac2771ac9fa0311226afc0df06e00b4d6 ../secrets/assets/canary" \
8+
echo "4d16330208714286d397e2cf7d8a977ac2771ac9fa0311226afc0df06e00b4d6 ../secrets/common/assets/canary" \
69
| sha256sum --check --status &> /dev/null
710

811
if [ "$?" -ne 0 ]; then
@@ -52,8 +55,8 @@ old_gpg_home=$GNUPGHOME
5255
export GNUPGHOME="$3/home/$2/.config/gnupg"
5356
find $3/home/$2/.config/gnupg -type f -exec chmod 600 {} \;
5457
find $3/home/$2/.config/gnupg -type d -exec chmod 700 {} \;
55-
gpg --import ../secrets/assets/gpg/key.gpg
56-
gpg --import-ownertrust ../secrets/assets/gpg/gpg-trust.txt
58+
gpg --import ../secrets/headfull/assets/gpg/key.gpg
59+
gpg --import-ownertrust ../secrets/headfull/assets/gpg/gpg-trust.txt
5760
mkdir -p $3/home/$2/.local/share/mail/ &> /dev/null
5861
mkdir -p $3/home/$2/.cache/mutt/ &> /dev/null
5962
mkdir -p $3/home/$2/.local/share/wineprefixes/ &> /dev/null

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let
22
canary =
3-
if (builtins.hashFile "sha256" ./secrets/assets/canary) != "4d16330208714286d397e2cf7d8a977ac2771ac9fa0311226afc0df06e00b4d6"
3+
if (builtins.hashFile "sha256" ./secrets/common/assets/canary) != "4d16330208714286d397e2cf7d8a977ac2771ac9fa0311226afc0df06e00b4d6"
44
then
55
abort
66
"Incorrect secrets. Please be sure to run ./bootstrap.sh if this

profiles/default.nix

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,10 @@ with lib;
6363
};
6464

6565
# define our main users
66-
# TODO, XXX, TOFIX: the shadows are probably written in the nix store, do we
67-
# care about that?
6866
users.users.${config.navi.username} = {
6967
isNormalUser = true;
70-
hashedPassword = fileContents ./../secrets/assets/shadow/main;
71-
openssh.authorizedKeys.keyFiles = [ ./../secrets/assets/ssh/navi.pub ];
68+
openssh.authorizedKeys.keyFiles = [ ./../secrets/common/assets/ssh/navi.pub ];
7269
};
73-
users.users.root.hashedPassword = fileContents ./../secrets/assets/shadow/root;
74-
75-
# setup the distbuild account; while this might look like a backdoor for
76-
# lesser privilege devices the distbuild access key is only given to at
77-
# least headfull devices, thus headless devices cannot ssh into headfull.
78-
# same goes for the main account.
79-
users.users.distbuild = {
80-
isSystemUser = true;
81-
shell = pkgs.bash;
82-
openssh.authorizedKeys.keyFiles = [ ./../secrets/assets/ssh/distbuild.pub ];
83-
};
84-
nix.trustedUsers = [ "distbuild" ];
8570

8671
# automatic updates & cleanup
8772
system.autoUpgrade.enable = true;

profiles/headfull.nix

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ with lib;
4545

4646
# we setup the personal ssh and gpg key of our headfull user
4747
home-manager.users.${config.navi.username} = {
48-
home.file.".config/gnupg/key.gpg".source = ./../secrets/assets/gpg/key.gpg;
49-
home.file.".config/gnupg/trust.txt".source = ./../secrets/assets/gpg/gpg-trust.txt;
50-
home.file.".config/ssh/id_ed25519".source = ./../secrets/assets/ssh/navi;
51-
home.file.".config/ssh/id_ed25519.pub".source = ./../secrets/assets/ssh/navi.pub;
48+
home.file.".config/gnupg/key.gpg".source = ./../secrets/headfull/assets/gpg/key.gpg;
49+
home.file.".config/gnupg/trust.txt".source = ./../secrets/headfull/assets/gpg/gpg-trust.txt;
50+
home.file.".config/ssh/id_ed25519".source = ./../secrets/headfull/assets/ssh/navi;
51+
home.file.".config/ssh/id_ed25519.pub".source = ./../secrets/headfull/assets/ssh/navi.pub;
5252

5353
# try to auto retrieve gpg keys when using emails, using hkp on port 80 to
5454
# bypass tor restrictions -- PROBABLY A VERY BAD IDEA SECURITY WISE, TOFIX,
@@ -61,12 +61,28 @@ with lib;
6161

6262
# store our distbuild key so we can login to our infra
6363
environment.etc."distbuild_ssh" = {
64-
text = builtins.readFile ./../secrets/assets/ssh/distbuild;
64+
text = builtins.readFile ./../secrets/headfull/assets/ssh/distbuild;
6565
mode = "0400";
6666
uid = 0;
6767
gid = 0;
6868
};
6969

70+
# setup the distbuild account; while this might look like a backdoor for
71+
# lesser privilege devices the distbuild access key is only given to at
72+
# least headfull devices, thus headless devices cannot ssh into headfull.
73+
# same goes for the main account.
74+
users.users.distbuild = {
75+
isSystemUser = true;
76+
shell = pkgs.bash;
77+
openssh.authorizedKeys.keyFiles = [ ./../secrets/headfull/assets/ssh/distbuild.pub ];
78+
};
79+
nix.trustedUsers = [ "distbuild" ];
80+
81+
# TODO, XXX, TOFIX: the shadows are probably written in the nix store, do we
82+
# care about that?
83+
users.users.${config.navi.username}.hashedPassword = fileContents ./../secrets/headfull/assets/shadow/main;
84+
users.users.root.hashedPassword = fileContents ./../secrets/headfull/assets/shadow/root;
85+
7086
# locking kernel modules has a horrendous UX for headfull devices and is
7187
# mostly useless for those, as they're deemed to restart frequently. A restart
7288
# allows you to replace the currently running kernel by your own and thus

secrets/assets/canary

-969 Bytes
Binary file not shown.

secrets/assets/emet-selch.md

-1004 Bytes
Binary file not shown.

secrets/assets/gpg/gpg-trust.txt

-188 Bytes
Binary file not shown.

secrets/assets/ssh/navi.pub

-117 Bytes
Binary file not shown.

secrets/common/assets/canary

969 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)