Backup des Fachschaftsaccounts

This commit is contained in:
Gonne 2024-02-07 15:21:15 +01:00
parent 7b4c51bffd
commit 6b1038c102

View file

@ -56,6 +56,13 @@ in {
path = "/var/lib/backups/eihort"; path = "/var/lib/backups/eihort";
allowSubRepos = true; allowSubRepos = true;
}; };
fsaccount = {
authorizedKeysAppendOnly = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG+Y7fQTYdIWHehrKdk92CaJ0AisEux4OrS4nIyMstU4 FS Account Backup"
];
path = "/var/lib/backups/fsaccount";
allowSubRepos = true;
};
hastur = { hastur = {
authorizedKeysAppendOnly = [ authorizedKeysAppendOnly = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILeDvTyOUdIPARatX0PPhHgrV1gjERWLt2Twa8E2GETb Hastur Backupsystem" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILeDvTyOUdIPARatX0PPhHgrV1gjERWLt2Twa8E2GETb Hastur Backupsystem"
@ -99,6 +106,36 @@ in {
allowSubRepos = true; allowSubRepos = true;
}; };
}; };
# Configure backup of files on the department's fs account
jobs.fsaccount = {
preHook = ''
rm -rf /home/fsaccount/sicherung
mkdir /home/fsaccount/sicherung
scp -i /home/fsaccount/.ssh/fsaccount -r fachschaft@gw1.mathematik.tu-darmstadt.de:/home/fachschaft/* sicherung/
'';
paths = "/home/fachschaft/sicherung";
encryption.mode = "none";
environment.BORG_RSH = "ssh -i /home/fachschaft/.ssh/fsaccount";
repo = "ssh://borg@localhost:fsaccount";
startAt = "hourly";
user = "fsaccount";
group = "fsaccount";
readWritePaths = ["/home/fsaccount"];
};
}; };
environment.persistence.${config.impermanence.name} = {
directories = [
"/home/fachschaft/.ssh" # SSH Key with access to FS Account and Borg repo and known_hosts
];
};
# Extra user for FS account backup
users.users = {
fsaccount = {
description = "FS Account backup";
group = "fsaccount";
isNormalUser = true;
};
};
users.groups.fsaccount = {};
}; };
} }