nix-dotfiles/machines/galadriel/openvpn.nix

45 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2023-12-28 21:54:09 +01:00
{ config, pkgs, lib, ... }:
{
2024-01-14 19:10:42 +01:00
imports = [
../../profiles/sops.nix
];
2023-12-28 21:54:09 +01:00
2024-01-14 19:10:42 +01:00
sops.secrets."openvpn/galadriel/ca" = {};
sops.secrets."openvpn/galadriel/cert" = {};
sops.secrets."openvpn/galadriel/userkey" = {};
sops.secrets."openvpn/galadriel/tlscrypt" = {};
2023-12-28 21:54:09 +01:00
2024-01-14 19:10:42 +01:00
services.openvpn.servers = {
client = {
config = ''
client
dev tun
remote 134.19.179.141 443
resolv-retry infinite
nobind
persist-key
persist-tun
auth-nocache
verb 3
explicit-exit-notify 5
push-peer-info
setenv UV_IPV6 yes
ca "${config.sops.secrets."openvpn/galadriel/ca".path}"
cert "${config.sops.secrets."openvpn/galadriel/cert".path}"
key "${config.sops.secrets."openvpn/galadriel/userkey".path}"
remote-cert-tls server
comp-lzo no
data-ciphers AES-256-GCM:AES-256-CBC:AES-192-GCM:AES-192-CBC:AES-128-GCM:AES-128-CBC
data-ciphers-fallback AES-256-CBC
proto udp
tls-crypt "${config.sops.secrets."openvpn/galadriel/tlscrypt".path}"
auth SHA512
'';
up = "echo nameserver $nameserver | ${pkgs.openresolv}/sbin/resolvconf -m 0 -a $dev";
down = "${pkgs.openresolv}/sbin/resolvconf -d $dev";
};
};
2023-12-28 21:54:09 +01:00
}