1 { inputs, pkgs, lib, config, ... }:
4 inherit (config.services) openvpn;
5 apiUrl = "https://api.black.riseup.net/3/cert";
7 url = "https://black.riseup.net/ca.crt";
8 hash = "sha256-Zdvnfz2k7iWlbgmmcUJrpJZ1dp7o0qXeJhP0HWJD7ro=";
10 key-cert = "/run/openvpn-${netns}/key+cert.pem";
13 services.openvpn.servers.${netns} = {
18 ["212.83.182.127" "212.83.165.160" "212.129.4.141"] ++
20 #["212.83.146.228" "212.83.143.67" "163.172.126.44"] ++
22 ["37.218.244.249" "37.218.244.251"] ++
24 ["199.58.83.10" "199.58.83.10" "199.58.83.12"] ++
28 ["198.252.153.28" "198.252.153.28"] ++
38 cipher = "AES-128-CBC";
46 remote-cert-tls = "server";
49 tls-cipher = "TLS-DHE-RSA-WITH-AES-128-CBC-SHA";
56 systemd.services."openvpn-${netns}" = {
59 ${pkgs.curl}/bin/curl -v -X POST --cacert ${ca} -o ${key-cert} -Ls ${apiUrl}
63 StartLimitIntervalSec = 0;
66 RuntimeDirectory = [ "openvpn-${netns}" ];
67 RuntimeDirectoryMode = "0700";
70 environment.systemPackages = [
73 networking.nftables.ruleset = ''
76 skuid root tcp dport https counter accept comment "OpenVPN Riseup"
80 services.netns.namespaces.${netns} = {
81 nftables = lib.mkBefore ''
82 include "${inputs.julm-nix + "/nixos/profiles/networking/nftables.txt"}"