1 { inputs, pkgs, lib, config, ... }:
4 inherit (config.services) openvpn;
5 apiUrl = "https://api.black.riseup.net/3/cert";
6 key-cert = "/run/openvpn-${netns}/key+cert.pem";
9 services.openvpn.servers.${netns} = {
12 # curl -Ls https://api.black.riseup.net/3/config/eip-service.json |
13 # jq .gateways.'[]'.host
15 "vpn01-sea.riseup.net"
16 "vpn02-par.riseup.net"
17 "vpn03-par.riseup.net"
18 "vpn04-ams.riseup.net"
19 "vpn05-par.riseup.net"
20 "vpn06-ams.riseup.net"
21 "vpn07-par.riseup.net"
22 "vpn08-par.riseup.net"
23 "vpn09-mia.riseup.net"
24 "vpn10-mtl.riseup.net"
25 "vpn11-par.riseup.net"
26 "vpn12-nyc.riseup.net"
27 "vpn13-ams.riseup.net"
28 "vpn14-par.riseup.net"
29 "vpn15-sea.riseup.net"
30 "vpn16-sea.riseup.net"
31 "vpn17-mia.riseup.net"
32 "vpn18-mtl.riseup.net"
33 "vpn19-ams.riseup.net"
34 "vpn20-par.riseup.net"
41 url = "https://black.riseup.net/ca.crt";
42 hash = "sha256-+kzojhwMbFwcf9W6CzXcCaLzBtgeOgXp19XPrP3ZhFM=";
55 remote-cert-tls = "server";
58 tls-cipher = "TLS-DHE-RSA-WITH-AES-128-CBC-SHA";
65 systemd.services."openvpn-${netns}" = {
69 ${pkgs.curl}/bin/curl -v -X POST --cacert ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt -o ${key-cert} -Ls ${apiUrl}
74 StartLimitIntervalSec = 0;
77 RuntimeDirectory = [ "openvpn-${netns}" ];
78 RuntimeDirectoryMode = "0700";
81 environment.systemPackages = [
84 networking.nftables.ruleset = ''
87 skuid root ${openvpn.servers.${netns}.settings.proto} dport ${openvpn.servers.${netns}.settings.port} counter accept comment "OpenVPN Riseup"
91 services.netns.namespaces.${netns} = {
92 nftables = lib.mkBefore ''
93 include "${inputs.julm-nix + "/nixos/profiles/networking/nftables.txt"}"