All checks were successful
nixos / nixos (push) Successful in 34s
Between the two conversions, services runs NixOS while ops still pushes the XMPP certificates with the key Ansible generated there. Authorize that key too, with the same forced command and source restriction, so renewals keep reaching ejabberd. Remove it after the ops conversion. Assisted-by: Claude:opus-5-5
41 lines
1.3 KiB
Nix
41 lines
1.3 KiB
Nix
# 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.";
|
|
};
|
|
|
|
options.asxpio.xmppCertSyncKeysExtra = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [
|
|
# Debian asxpio-ops's key (Ansible role xmpp_cert_sync), until ops
|
|
# runs NixOS too. Remove after the ops conversion.
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGLSz8AvKF/cHmMBGxn7+BqNHa/g79xmRrnb7779lXLo"
|
|
];
|
|
};
|
|
|
|
config.users.users.root.openssh.authorizedKeys.keys = map (
|
|
key: ''restrict,from="10.10.0.10",command="${lib.getExe install}" ${key} xmpp-cert-sync''
|
|
) ([ config.asxpio.xmppCertSyncKey ] ++ config.asxpio.xmppCertSyncKeysExtra);
|
|
}
|