1 { pkgs, lib, config, ... }:
4 inherit (config.services) openvpn;
5 apiUrl = "https://api.calyx.net:4430/3/cert";
8 url = "https://calyx.net/ca.crt";
9 hash = "sha256-NKLkpjjeGMN07htuWydBMQ03ytxF9CLm8SLNl3IPPGc=";
10 curlOptsList = [ "-k" ];
12 key-cert = "/run/openvpn-${netns}/key+cert.pem";
15 services.openvpn.servers.${netns} = {
20 [ "162.247.73.193" ] ++
30 cipher = "AES-128-CBC";
38 remote-cert-tls = "server";
41 tls-cipher = "TLS-DHE-RSA-WITH-AES-128-CBC-SHA";
48 systemd.services."openvpn-${netns}" = {
49 after = [ "network-online.target" ];
53 ${pkgs.curl}/bin/curl -X POST --cacert ${ca} -o ${key-cert} -Ls ${apiUrl}
58 RuntimeDirectory = [ "openvpn-${netns}" ];
59 RuntimeDirectoryMode = "0700";
62 networking.nftables.ruleset = ''
65 skuid root tcp dport https counter accept comment "OpenVPN Calyx"
66 skuid root tcp dport 4430 counter accept comment "OpenVPN Calyx (API)"
70 services.netns.namespaces.${netns} = {
71 nftables = lib.mkBefore ''
72 include "${../networking/nftables.txt}"