-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50c5161
commit 973124a
Showing
3 changed files
with
132 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
./rsnapshot.nix | ||
|
||
./hardware-configuration.nix | ||
|
||
./vpn.nix | ||
]; | ||
|
||
boot.loader = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ pkgs, lib, secrets, ... }: | ||
let vpnInterface = "tun-deluge"; | ||
in { | ||
services = { | ||
# udev.extraRules = '' | ||
# ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="tun-deluge", RUN+="${pkgs.nettools}/bin/route add -net $(ip route | grep ${vpnInterface} | grep -oP "(\d+\.){3}\d+/\d+")" | ||
# ''; | ||
|
||
# udev.extraRules = '' | ||
# ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="tun-deluge", RUN+="${pkgs.iproute2}/bin/ip route add default via 0.0.0.0 dev ${vpnInterface}" | ||
# ''; | ||
|
||
# default_iface=$(ip route | awk '/default/ {print $5}') | ||
# default_gateway=$(ip route show dev $default_iface | awk '/default via/ {print $3}') | ||
# echo "Default gateway IP address: $default_gateway" | ||
|
||
# sudo ip route add default via 192.168.1.1 dev tun-deluge | ||
# sudo ip route add 192.168.1.1 dev tun-deluge | ||
|
||
openvpn.servers.deluge = { | ||
config = let | ||
ips = [ | ||
# Netherlands | ||
"138.199.7.129" | ||
"146.70.86.114" | ||
"185.107.56.224" | ||
"185.107.56.229" | ||
"185.107.57.49" | ||
"185.107.80.190" | ||
"190.2.131.156" | ||
"190.2.132.124" | ||
"190.2.132.139" | ||
"62.112.9.164" | ||
]; | ||
ports = [ 1194 4569 51820 5060 80 ]; | ||
|
||
remotes = lib.flatten (map (ip: map (port: "remote ${ip} ${toString port}") ports) ips); | ||
in '' | ||
auth SHA512 | ||
verb 3 | ||
client | ||
dev ${vpnInterface} | ||
proto udp | ||
persist-tun | ||
route-nopull | ||
${lib.concatStringsSep "\n" remotes} | ||
server-poll-timeout 20 | ||
remote-random | ||
resolv-retry infinite | ||
nobind | ||
fast-io | ||
tun-mtu 1500 | ||
tun-mtu-extra 32 | ||
mssfix 1450 | ||
reneg-sec 0 | ||
persist-key | ||
ca ${../headless/server/sonarr/deluge/ca.pem} | ||
setenv CLIENT_CERT 0 | ||
remote-cert-tls server | ||
tls-auth ${../headless/server/sonarr/deluge/server.key} 1 | ||
''; | ||
|
||
authUserPass = { | ||
username = secrets.protonvpn.username; | ||
password = secrets.protonvpn.password; | ||
}; | ||
}; | ||
}; | ||
} |