nixos: bucket replica and XMPP certificate sync
s3-replicate is the same rclone sync with the same delete limit, run by the rclone package instead of its image. The certificate push keeps its shape: ops reads Traefik's acme.json and sends each certificate over SSH with a key that may run one command on services, from ops only. The key is now a sops secret with its public half in the config, instead of being generated on the host, so a rebuilt pair works without a manual step. Tried on the rehearsal pair with a throwaway certificate; any other command is refused. Assisted-by: Claude:fable-5-2
This commit is contained in:
parent
e95d97869f
commit
422eb3bc6e
1 changed files with 359 additions and 79 deletions
32
nixos/hosts/asxpio-services/xmpp-cert-install.nix
Normal file
32
nixos/hosts/asxpio-services/xmpp-cert-install.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Receiving end of xmpp-cert-sync on asxpio-ops (see its file there): the
|
||||
# key below may run exactly one command, from ops only.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
install = pkgs.writeShellApplication {
|
||||
name = "xmpp-cert-install";
|
||||
runtimeInputs = [
|
||||
pkgs.coreutils
|
||||
pkgs.openssl
|
||||
pkgs.gnugrep
|
||||
pkgs.util-linux
|
||||
config.virtualisation.podman.package
|
||||
];
|
||||
text = builtins.readFile ./xmpp-cert-install.sh;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.asxpio.xmppCertSyncKey = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAKd1FvOgmxeNCHUJzRQxNA3IBRz59A1VDdsnOwxhybl";
|
||||
description = "Public half of xmpp_cert_sync/ssh_key in the ops secrets.";
|
||||
};
|
||||
|
||||
config.users.users.root.openssh.authorizedKeys.keys = [
|
||||
''restrict,from="10.10.0.10",command="${lib.getExe install}" ${config.asxpio.xmppCertSyncKey} xmpp-cert-sync''
|
||||
];
|
||||
}
|
||||
Loading…
Reference in a new issue