more secrets
This commit is contained in:
parent
fa0974cb63
commit
5fd3d3a40a
8 changed files with 119 additions and 13 deletions
6
flake.lock
generated
6
flake.lock
generated
|
@ -230,11 +230,11 @@
|
|||
"nvim_plugin-declancm/cinnamon.nvim": "nvim_plugin-declancm/cinnamon.nvim"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714780617,
|
||||
"narHash": "sha256-63lH3uFa7Mdq6z8oKQPTDH+hXC57bIr3XG7rRz+2x4U=",
|
||||
"lastModified": 1715021116,
|
||||
"narHash": "sha256-90rB0FN9XodUTSw8fHJSGm8qbqkQOOryQUHt7v53KPQ=",
|
||||
"owner": "RingOfStorms",
|
||||
"repo": "nvim",
|
||||
"rev": "eb7f522795c3a2b597acb576c80b23214ff9eedb",
|
||||
"rev": "d3212044572caeaaf969c06c66f779de96ef37ce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
# TODO check out the by host way this person does: https://github.com/hlissner/dotfiles/blob/089f1a9da9018df9e5fc200c2d7bef70f4546026/modules/agenix.nix
|
||||
{ settings, lib, ragenix, ... }:
|
||||
{
|
||||
settings,
|
||||
lib,
|
||||
ragenix,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# secretsFile = (settings.secretsDir + /secrets.nix);
|
||||
in
|
||||
# TODO auto import secret files here
|
||||
# secretsFile = (settings.secretsDir + /secrets.nix);
|
||||
{
|
||||
imports = [ ragenix.nixosModules.age ];
|
||||
environment.systemPackages = [ ragenix.packages.${settings.system.system}.default ];
|
||||
|
@ -24,6 +30,14 @@ in
|
|||
file = /${settings.secretsDir}/nix2bitbucket.age;
|
||||
owner = settings.user.username;
|
||||
};
|
||||
nix2h001 = {
|
||||
file = /${settings.secretsDir}/nix2h001.age;
|
||||
owner = settings.user.username;
|
||||
};
|
||||
nix2t = {
|
||||
file = /${settings.secretsDir}/nix2t.age;
|
||||
owner = settings.user.username;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||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TG0rT2lWR3F1am1yRFFzaEls
|
||||
NEdFbXhTcmM3a2Q3VWRDZnNXVkkK9jNOfezOTfWyuWm99ZopI+EgwtmShWQXa5Zl
|
||||
dT2vrAihJImzohEzDckxMFnsrspD6eUEjBejY+518ZC6kyGSRbDZB5sX+70lDoNK
|
||||
rZuKxtXvhMkZXTOKIjqIIewaiCVzQH3BFnxdL2Vw6huAYzWdmPSZNttJBNbcVuOO
|
||||
6O/GnNoGoFvY0lIXXtubdacNzHEvvLG01SyyuLV45SCOnku5s5JXPAj2A1hmczJo
|
||||
0TpVaigtzVXRhsYiv3IeCv278JaMLstRtjdNipFLUGmwOzTQGJmajpCUfPTldWUK
|
||||
oZfsswqWbAMyKALDoXuOfGCR4YCL8k2xaRP8bUkwLTj68bZ1Lgyd2iwbgCMcXkxC
|
||||
7sNrY7XTV2+/ONe9fPfPG8xRjvsIvlR7Zl13bACSIyEHgYPlYszMSS+VZnV16V5X
|
||||
KwU2dCQuuETiLr1VvqplqDVOJdM3slAhFPrE3Khcb7qAmmB5pUCohHHmBXODV0cg
|
||||
l82X6PL+IO3LMOJNACi59HMF+Ze2jqh3XR0+rrK1C7TU31YzCL3qMCAglQvTnVMz
|
||||
3nTtpaMs16qpXMmU8KmvtxOn6nE=
|
||||
-----END AGE ENCRYPTED FILE-----
|
26
secrets/nix2t.age
Normal file
26
secrets/nix2t.age
Normal file
|
@ -0,0 +1,26 @@
|
|||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IDd6MzN5USAxOTZK
|
||||
VytkWVFIK2ZxUmxOUmc0dkVFMTFVeGtnMlRxTDRRbjQzWUZIbDJnCjd4Ulp6bElk
|
||||
VVQ5QTNJb2RzUzdwZDdhL1BVcjhDaXUwUXpTRXJiZjlDR2MKLT4gc3NoLWVkMjU1
|
||||
MTkgSmh2TCtRIFpiaFpDMlpFWWloMFhTTUxMYnZUaW1YT0l4NW5zM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nfjeIshl4fyUKCL0k5qQ
|
||||
7DRf7CxpwQSWRLyoBreR3lwmYLNtjr3nVe1Ae9RPA0O8sQc/lNejtb18yRGwMuYP
|
||||
1pN/qGR4fOVy3tzKylZ/PWUTiIzPu3jN67GqkLk/zC6qgemTk8cgWt1bJyB4siiy
|
||||
9fPfMJE9nrVXr2U7w+f/j0ZW3V4pfNDVsj96ZssMg55mOO7f4qrR2nhwnEgtarEL
|
||||
OiEOU1d5nDoxgOy79hlwUGfwH7bAwMFiPoDz508CKBKySHFi0kv5oeHMysmsS+2U
|
||||
zjSEjfmsgI+oiwcbUZGkik2mC+82wwwuFN86ip+H+cWm
|
||||
-----END AGE ENCRYPTED FILE-----
|
|
@ -16,7 +16,19 @@ let
|
|||
];
|
||||
in
|
||||
{
|
||||
# TODO come up with a rotate method/encrypt the device keys bette. This isn't very secure feeling to me the way I am doing this now. If anyone gains access to any one of my devices, then my secrets are no longer secret. This is not a good model.
|
||||
"nix2github.age" = { inherit publicKeys; };
|
||||
"nix2bitbucket.age" = { inherit publicKeys; };
|
||||
## Too make a new secret: `ragenix --editor=vi -v -e FILE.age` add file below and in the ragenix.nix file
|
||||
#
|
||||
# TODO come up with a rotate method/encrypt the device keys better. This isn't very secure feeling to me the way I am doing this now. If anyone gains access to any one of my devices, then my secrets are no longer secret. This is not a good model.
|
||||
"nix2github.age" = {
|
||||
inherit publicKeys;
|
||||
};
|
||||
"nix2bitbucket.age" = {
|
||||
inherit publicKeys;
|
||||
};
|
||||
"nix2h001.age" = {
|
||||
inherit publicKeys;
|
||||
};
|
||||
"nix2t.age" = {
|
||||
inherit publicKeys;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,29 @@
|
|||
"bitbucket.org" = {
|
||||
identityFile = age.secrets.nix2bitbucket.path;
|
||||
};
|
||||
"h001" = {
|
||||
identityFile = age.secrets.nix2h001.path;
|
||||
# TODO come back to these 10.12.14.## addrs and change them to intranet IP's instead of local network.
|
||||
hostname = "10.12.14.2";
|
||||
user = "root";
|
||||
};
|
||||
"t" = {
|
||||
identityFile = age.secrets.nix2t.path;
|
||||
hostname = "10.12.14.103";
|
||||
user = "joshua.bell";
|
||||
localForwards = [
|
||||
{
|
||||
bind.port = 3000;
|
||||
host.port = 3000;
|
||||
host.address = "localhost";
|
||||
}
|
||||
{
|
||||
bind.port = 3002;
|
||||
host.port = 3002;
|
||||
host.address = "localhost";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
};
|
||||
script = ''
|
||||
#!/run/current-system/sw/bin/bash
|
||||
if [ ! -f /home/${settings.user.username}/.ssh/id_ed25519bbb ]; then
|
||||
if [ ! -f /home/${settings.user.username}/.ssh/id_ed25519]; then
|
||||
if [ -v DRY_RUN ]; then
|
||||
echo "DRY_RUN is set. Would generate SSH key for ${settings.user.username}."
|
||||
else
|
||||
echo "Generating SSH key for ${settings.user.username}."
|
||||
mkdir -p /home/${settings.user.username}/.ssh
|
||||
chmod 700 /home/${settings.user.username}/.ssh
|
||||
/run/current-system/sw/bin/ssh-keygen -t ed25519 -f /home/${settings.user.username}/.ssh/id_ed25519bbb -N ""
|
||||
/run/current-system/sw/bin/ssh-keygen -t ed25519 -f /home/${settings.user.username}/.ssh/id_ed25519-N ""
|
||||
fi
|
||||
else
|
||||
echo "SSH key already exists for ${settings.user.username}."
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
{ config, lib, pkgs, settings, ... } @ args:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
settings,
|
||||
...
|
||||
}@args:
|
||||
{
|
||||
users.users.root = {
|
||||
initialPassword = "password1";
|
||||
};
|
||||
|
||||
system.activationScripts.sshConfig = {
|
||||
# TODO revisit this, this is stupid and ugly what am I doing here...
|
||||
text = ''
|
||||
mkdir -p /root/.ssh
|
||||
ln -snf ${config.age.secrets.nix2github.path} /root/.ssh/nix2github
|
||||
|
@ -12,4 +19,3 @@
|
|||
'';
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue