nixos/vaultwarden: Add backup

This commit is contained in:
Jack O'Sullivan 2023-08-06 16:24:36 +01:00
parent 690dd6e70e
commit 6439a32c6e
6 changed files with 129 additions and 2 deletions

View File

@ -0,0 +1,3 @@
zh2855.rsync.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJtclizeBy1Uo3D86HpgD3LONGVH0CJ0NT+YfZlldAJd
zh2855.rsync.net ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLR2uz+YLn2KiQK0Luu8rhfWS6LHgUfGAWB1j8rM2MKn4KZ2/LhIX1CYkPKMTPxHr6mzayeL1T1hyJIylxXv0BY=
zh2855.rsync.net ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPgHxQyaDaVxUefoUJZO/lITh0Gp0sqbP7HejQcCfZi7gAcuM6/IAuUXLHFImefCHh52x6T/cHxgL1qz26GKgdxykl06WRXlRIuE45QFSy/cd9JKr6l58fKq30ApmXRsCNwFrMlFPoEpCTqxzddZ9cLXs1Yt9dRxvFlQVEuAzw7ayvt8DE6RP9/CHYVp54wbbvUToECGwu70sxY1vFg51K+vNpvJ3J0t5j3s4c1Wls4BrIwqi2U8kqCq9Nj2CUIQqjM+93CSqEacR3qOGvG/6QMzd733wzpJ/iZee+lcyTYzA0YNMosnaF01hrv7NMwtZ6xRFLlJZtMZ7JpfySrOBr

View File

@ -260,5 +260,6 @@ rec {
sshKeyFiles = { sshKeyFiles = {
me = ../.keys/me.pub; me = ../.keys/me.pub;
deploy = ../.keys/deploy.pub; deploy = ../.keys/deploy.pub;
rsyncNet = ../.keys/zh2855.rsync.net.pub;
}; };
} }

View File

@ -36,7 +36,11 @@ in
secrets = { secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFP2mF50ENpnJnr+VTnG9P+JFPjgwvoIxCLyJPzXRpVy"; key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFP2mF50ENpnJnr+VTnG9P+JFPjgwvoIxCLyJPzXRpVy";
files."vaultwarden.env" = {}; files = {
"vaultwarden/config.env" = {};
"vaultwarden/backup-pass.txt" = {};
"vaultwarden/backup-ssh.key" = {};
};
}; };
firewall = { firewall = {
@ -57,6 +61,10 @@ in
network.networks."80-container-host0" = networkdAssignment "host0" assignments.internal; network.networks."80-container-host0" = networkdAssignment "host0" assignments.internal;
}; };
programs.ssh.knownHostsFiles = [
lib.my.sshKeyFiles.rsyncNet
];
services = { services = {
vaultwarden = { vaultwarden = {
enable = true; enable = true;
@ -86,7 +94,28 @@ in
PUSH_ENABLED = true; PUSH_ENABLED = true;
}; };
environmentFile = config.age.secrets."vaultwarden.env".path; environmentFile = config.age.secrets."vaultwarden/config.env".path;
};
borgbackup.jobs.vaultwarden = {
paths = [ vwData ];
repo = "zh2855@zh2855.rsync.net:borg/vaultwarden2";
doInit = true;
environment = {
BORG_REMOTE_PATH = "borg1";
BORG_RSH = ''ssh -i ${config.age.secrets."vaultwarden/backup-ssh.key".path}'';
};
compression = "zstd,10";
encryption = {
mode = "repokey";
passCommand = ''cat ${config.age.secrets."vaultwarden/backup-pass.txt".path}'';
};
prune.keep = {
within = "1d";
daily = 7;
weekly = 4;
monthly = -1;
};
}; };
}; };
} }

View File

@ -0,0 +1,13 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IEhKL0o3QSBsZVF5
cXR6L0ptT2tYTHgreHN3TDVpWjlMQ0twR2RwWGg2TU13SGcwZzFzCkRxazBtNW9X
clNMNVRkd0NFa29OOHlSa0F6YWpldnZacHNEblo0a2VGSFEKLT4gWDI1NTE5IDd5
RG1WNEF4bXVsT1loRnVIMW9kZHJRSkQ3MGtlL1pXTk9GeXlDYzBVSFUKY3pBNmJn
Z3BwaWt5bC9IbUtJY3dvU2dnOEs5YlFWbkg1U0JZQVBNdHQ5TQotPiBwWE1DJl0+
LWdyZWFz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