2022-12-04 13:45:43 +00:00
|
|
|
{pkgs, ...}: {
|
2022-11-15 13:42:28 +00:00
|
|
|
services.secrets = {
|
|
|
|
enable = true;
|
2022-11-02 12:24:55 +00:00
|
|
|
|
2022-12-04 13:45:43 +00:00
|
|
|
extraPackages = with pkgs; [
|
|
|
|
# for music & mail passwd files
|
|
|
|
apacheHttpd
|
|
|
|
];
|
2022-11-02 12:24:55 +00:00
|
|
|
|
2022-11-15 13:42:28 +00:00
|
|
|
secrets = {
|
|
|
|
mpd_control_password = {
|
|
|
|
user = "mpd";
|
|
|
|
group = "mpd";
|
|
|
|
fetchScript = ''
|
|
|
|
simple_get "/api-keys/mpd" .password > $secretFile
|
|
|
|
'';
|
|
|
|
};
|
2022-12-04 13:45:43 +00:00
|
|
|
private_mail_aliases = {
|
|
|
|
user = "root";
|
|
|
|
group = "root";
|
|
|
|
fetchScript = ''
|
|
|
|
kv_get "/infra/private-mail-aliases" | jq .data.data | jq -r 'to_entries|map("\(.key) \(.value.to)")[]' > $secretFile
|
|
|
|
'';
|
|
|
|
};
|
2022-11-15 13:42:28 +00:00
|
|
|
music_stream_passwd = {
|
|
|
|
user = "nginx";
|
|
|
|
group = "nginx";
|
|
|
|
fetchScript = ''
|
|
|
|
username=$(simple_get "/api-keys/music-stream" .username)
|
|
|
|
password=$(simple_get "/api-keys/music-stream" .password)
|
|
|
|
htpasswd -bc $secretFile "$username" "$password" 2>/dev/null
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
chaos_mail_passwd = {
|
|
|
|
user = "dovecot2";
|
|
|
|
group = "dovecot2";
|
|
|
|
fetchScript = ''
|
|
|
|
password=$(simple_get "/passwords/mail" .password)
|
|
|
|
htpasswd -nbB "" "$password" 2>/dev/null | cut -d: -f2 > $secretFile
|
2022-11-23 15:58:12 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
misskey_mail_passwd = {
|
|
|
|
user = "dovecot2";
|
|
|
|
group = "dovecot2";
|
|
|
|
fetchScript = ''
|
|
|
|
password=$(simple_get "/api-keys/chaos_mail/misskey" .password)
|
|
|
|
htpasswd -nbB "" "$password" 2>/dev/null | cut -d: -f2 > $secretFile
|
2022-11-24 13:29:48 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
system_mail_passwd = {
|
|
|
|
user = "dovecot2";
|
|
|
|
group = "dovecot2";
|
|
|
|
fetchScript = ''
|
|
|
|
password=$(simple_get "/api-keys/chaos_mail/system" .password)
|
|
|
|
htpasswd -nbB "" "$password" 2>/dev/null | cut -d: -f2 > $secretFile
|
2022-11-15 13:42:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
gitlab_env = {
|
|
|
|
user = "gitlab_artifacts_sync";
|
|
|
|
group = "gitlab_artifacts_sync";
|
|
|
|
fetchScript = ''
|
|
|
|
token=$(simple_get "/api-keys/gitlab/gitlab_pages_serve" .token)
|
|
|
|
echo "GITLAB_TOKEN=$token" > $secretFile
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
restic_password = {
|
|
|
|
fetchScript = ''
|
|
|
|
simple_get "/private-public-keys/restic/HetznerVM" .password > $secretFile
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
restic_env = {
|
|
|
|
fetchScript = ''
|
|
|
|
RESTIC_USERNAME=$(simple_get "/api-keys/storage/restic/HetznerVM" .username)
|
|
|
|
RESTIC_PASSWORD=$(simple_get "/api-keys/storage/restic/HetznerVM" .password)
|
|
|
|
echo "RESTIC_REPOSITORY=rest:https://$RESTIC_USERNAME:$RESTIC_PASSWORD@storage-restic.owo.monster/HetznerVM" > $secretFile
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
wg_privkey = {
|
|
|
|
fetchScript = ''
|
2022-12-04 13:45:43 +00:00
|
|
|
simple_get "/private-public-keys/wireguard/chaos-internal/hetzner-vm" .private > $secretFile
|
2022-11-15 13:42:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
wg_preshared_tablet = {
|
|
|
|
path = "/secrets/wg_preshared_tablet";
|
|
|
|
fetchScript = ''
|
2022-12-04 13:45:43 +00:00
|
|
|
simple_get "/private-public-keys/wireguard/chaos-internal/hetzner-vm" .preshared_keys.tablet > $secretFile
|
2022-11-15 13:42:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
wg_preshared_vault = {
|
|
|
|
path = "/secrets/wg_preshared_vault";
|
|
|
|
fetchScript = ''
|
2022-12-04 13:45:43 +00:00
|
|
|
simple_get "/private-public-keys/wireguard/chaos-internal/hetzner-vm" .preshared_keys.vault > $secretFile
|
2022-11-15 13:42:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
wg_preshared_storage = {
|
|
|
|
path = "/secrets/wg_preshared_storage";
|
|
|
|
fetchScript = ''
|
2022-12-04 13:45:43 +00:00
|
|
|
simple_get "/private-public-keys/wireguard/chaos-internal/hetzner-vm" .preshared_keys.storage > $secretFile
|
2022-11-15 13:42:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
wg_preshared_iphone8 = {
|
|
|
|
path = "/secrets/wg_preshared_iphone8";
|
|
|
|
fetchScript = ''
|
2022-12-04 13:45:43 +00:00
|
|
|
simple_get "/private-public-keys/wireguard/chaos-internal/hetzner-vm" .preshared_keys.iphone8 > $secretFile
|
2022-11-15 13:42:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-11-02 12:24:55 +00:00
|
|
|
}
|