1 { inputs, pkgs, lib, config, ... }:
4 inherit (config.services) openvpn;
5 apiUrl = "https://api.calyx.net:4430/3/cert";
7 url = "https://calyx.net/ca.crt";
8 hash = "sha256-NKLkpjjeGMN07htuWydBMQ03ytxF9CLm8SLNl3IPPGc=";
11 key-cert = "/run/openvpn-${netns}/key+cert.pem";
14 services.openvpn.servers.${netns} = {
29 cipher = "AES-128-CBC";
37 remote-cert-tls = "server";
40 tls-cipher = "TLS-DHE-RSA-WITH-AES-128-CBC-SHA";
47 systemd.services."openvpn-${netns}" = {
51 ${pkgs.curl}/bin/curl -X POST --cacert ${ca} -o ${key-cert} -Ls ${apiUrl}
56 RuntimeDirectory = [ "openvpn-${netns}" ];
57 RuntimeDirectoryMode = "0700";
60 networking.nftables.ruleset = ''
63 skuid root tcp dport https counter accept comment "OpenVPN Calyx"
64 skuid root tcp dport 4430 counter accept comment "OpenVPN Calyx (API)"
68 services.netns.namespaces.${netns} = {
69 nftables = lib.mkBefore ''
70 include "${inputs.julm-nix + "/nixos/profiles/networking/nftables.txt"}"