1 { 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} = {
28 cipher = "AES-128-CBC";
36 remote-cert-tls = "server";
39 tls-cipher = "DHE-RSA-AES128-SHA";
46 systemd.services."openvpn-${netns}" = {
49 ${pkgs.curl}/bin/curl -X POST --cacert ${ca} -o ${key-cert} -Ls ${apiUrl}
53 RuntimeDirectory = [ "openvpn-${netns}" ];
54 RuntimeDirectoryMode = "0700";
57 networking.nftables.ruleset = ''
58 add rule inet filter fw2net meta skuid root tcp dport 443 counter accept comment "OpenVPN Calyx"
59 add rule inet filter fw2net meta skuid root tcp dport 4430 counter accept comment "OpenVPN Calyx (API)"
61 services.netns.namespaces.${netns} = {
62 nftables = lib.mkBefore ''
64 include "${../../../../networking/nftables/filter.txt}"
66 type filter hook input priority filter
70 ct state { established, related } accept
71 jump accept-connectivity-input
76 type filter hook forward priority filter
78 jump accept-connectivity-forward
81 type filter hook output priority filter
84 ct state { related, established } accept
85 jump accept-connectivity-output