All checks were successful
nixos / nixos (push) Successful in 1m3s
Every account now logs in with zsh, including ones added later, except deploy and git: the app CI and Forgejo run commands through their login shells. root gets the same zsh with a red prompt ending in #. Interactive SSH logins show, under fastfetch, the host's security state as the Grafana alerts see it, read from the local metrics files: anything unexpected (peers, devices, accounts, ports, containers), who is logged in, the last good backup per repository, the bucket replica, failed units and fail2ban bans. XMPP gets a Podman network of its own with IPv6. xmpp.asxp.io has an AAAA record, and Podman's default network forwards published ports over IPv4 only, where Docker on Debian did both: since the conversion, XMPP over IPv6 was refused. Tried on the rehearsal host with a published port on the new network, reached over IPv6 and IPv4. Assisted-by: Claude:opus-5-5
136 lines
4.5 KiB
Nix
136 lines
4.5 KiB
Nix
# XMPP for asxp.io: another.im's ejabberd build, its push server and the
|
|
# Telegram gateway. A custom image, so containers; the two helpers share
|
|
# ejabberd's network namespace and reach its component port on 127.0.0.1.
|
|
#
|
|
# /opt/xmpp/state (secrets.env, certs/, apushd/, tackygram/) is host data:
|
|
# generated once, backed up, not in this repo. Certificates arrive there
|
|
# from asxpio-ops (xmpp-cert-sync).
|
|
{ config, lib, ... }:
|
|
let
|
|
# renovate: datasource=docker depName=dev.another.im/another-im/anotherim-server
|
|
ejabberd = "dev.another.im/another-im/anotherim-server:2026.11.07";
|
|
# renovate: datasource=docker depName=dev.another.im/another-im/apushd
|
|
apushd = "dev.another.im/another-im/apushd:0.2";
|
|
# renovate: datasource=docker depName=dev.another.im/another-im/tackygram
|
|
tackygram = "dev.another.im/another-im/tackygram:0.4.3";
|
|
|
|
callPorts = "50000-50099";
|
|
state = "/opt/xmpp/state";
|
|
helper = {
|
|
dependsOn = [ "xmpp-ejabberd" ];
|
|
extraOptions = [ "--network=container:xmpp-ejabberd" ];
|
|
};
|
|
in
|
|
{
|
|
options.asxpio.publicIPv4 = lib.mkOption { type = lib.types.str; };
|
|
|
|
config = {
|
|
# A network of its own with IPv6: xmpp.asxp.io has an AAAA record,
|
|
# and Podman's default network forwards published ports over IPv4
|
|
# only (Docker on Debian did both).
|
|
systemd.services.podman-network-xmpp = {
|
|
description = "Podman network xmpp (IPv4 and IPv6)";
|
|
wantedBy = [ "multi-user.target" ];
|
|
before = [ "podman-xmpp-ejabberd.service" ];
|
|
path = [ config.virtualisation.podman.package ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
};
|
|
script = ''
|
|
podman network exists xmpp \
|
|
|| podman network create --ipv6 --subnet 10.90.0.0/24 --subnet fd69:90::/64 xmpp
|
|
'';
|
|
};
|
|
systemd.services.podman-xmpp-ejabberd = {
|
|
requires = [ "podman-network-xmpp.service" ];
|
|
after = [ "podman-network-xmpp.service" ];
|
|
};
|
|
|
|
virtualisation.oci-containers.containers = {
|
|
xmpp-ejabberd = {
|
|
image = ejabberd;
|
|
environment = {
|
|
EJABBERD_MACRO_XMPP_DOMAIN = "asxp.io";
|
|
EJABBERD_MACRO_TURN_IP = config.asxpio.publicIPv4;
|
|
EJABBERD_MACRO_POW_DIFFICULTY = "6";
|
|
EJABBERD_MACRO_REGISTRATION_TIMEOUT = "600";
|
|
EJABBERD_MACRO_UPLOAD_URL = "https://hel1.your-objectstorage.com/asxpio-xmpp-public/";
|
|
EJABBERD_MACRO_ACME_URL = "https://acme-v02.api.letsencrypt.org/directory";
|
|
};
|
|
environmentFiles = [ "${state}/secrets.env" ];
|
|
extraOptions = [ "--network=xmpp" ];
|
|
ports = [
|
|
"5222:5222" # clients, STARTTLS
|
|
"5223:5223" # clients, direct TLS
|
|
"5269:5269" # other servers
|
|
"5443:5443" # WebSocket, host-meta
|
|
"8448:8448" # Matrix federation
|
|
"3478:3478/udp" # STUN and TURN
|
|
"3478:3478/tcp"
|
|
"49160-49199:49160-49199/udp" # TURN relay
|
|
"7777:7777" # SOCKS5 bytestreams proxy
|
|
"${callPorts}:${callPorts}/udp" # gateway calls
|
|
];
|
|
volumes = [
|
|
"xmpp_database:/opt/ejabberd/database"
|
|
"xmpp_logs:/opt/ejabberd/logs"
|
|
"${state}/certs:/opt/ejabberd/conf/certs:ro"
|
|
];
|
|
};
|
|
|
|
xmpp-apushd = helper // {
|
|
image = apushd;
|
|
volumes = [ "${state}/apushd:/etc/apushd:ro" ];
|
|
};
|
|
|
|
xmpp-tackygram = helper // {
|
|
image = tackygram;
|
|
environment = {
|
|
CREDENTIALS_DIRECTORY = "/run/credentials";
|
|
TACKYGRAM_CALL_IP = config.asxpio.publicIPv4;
|
|
TACKYGRAM_CALL_PORTS = callPorts;
|
|
};
|
|
environmentFiles = [ "${state}/tackygram/env" ];
|
|
volumes = [
|
|
"xmpp_tackygram:/var/lib/tackygram"
|
|
"${state}/tackygram/key:/run/credentials/gateway-key:ro"
|
|
];
|
|
};
|
|
};
|
|
|
|
asxpio.waitForData = [
|
|
"podman-xmpp-ejabberd"
|
|
"podman-xmpp-apushd"
|
|
"podman-xmpp-tackygram"
|
|
];
|
|
|
|
# Published ports belong to rootful Podman's port forwarder
|
|
asxpio.security.ports = map (p: "${p}/conmon") [
|
|
"tcp/5222-5223"
|
|
"tcp/5269"
|
|
"tcp/5443"
|
|
"tcp/8448"
|
|
"tcp/3478"
|
|
"udp/3478"
|
|
"tcp/7777"
|
|
"udp/49160-49199"
|
|
"udp/50000-50099"
|
|
];
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
5222
|
|
5223
|
|
5269
|
|
5443
|
|
8448
|
|
3478
|
|
7777
|
|
];
|
|
networking.firewall.allowedUDPPorts = [ 3478 ];
|
|
networking.firewall.allowedUDPPortRanges = [
|
|
{ from = 49160; to = 49199; }
|
|
{ from = 50000; to = 50099; }
|
|
];
|
|
};
|
|
}
|