Catch all the stuff I missed in the server services to get them to build
This commit is contained in:
parent
25a3a7e237
commit
a5f06865de
44 changed files with 212 additions and 197 deletions
|
@ -1,4 +1,4 @@
|
|||
{ outputs, ... }:
|
||||
{ config, ... }:
|
||||
{
|
||||
# Allow forwarding
|
||||
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
|
||||
|
@ -10,9 +10,9 @@
|
|||
firewall = {
|
||||
allowPing = false;
|
||||
extraInputRules = ''
|
||||
ip saddr { ${outputs.ips.localSpan}.0/24, ${outputs.ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS"
|
||||
ip saddr { ${outputs.ips.pc}, ${outputs.secrets.lunaIP}, ${outputs.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
|
||||
ip saddr ${outputs.ips.wgSpan}.3 tcp dport ${mailPorts} accept comment "Accept mail"
|
||||
ip saddr { ${config.ips.localSpan}.0/24, ${config.ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS"
|
||||
ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
|
||||
ip saddr ${config.ips.wgSpan}.3 tcp dport ${mailPorts} accept comment "Accept mail"
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -24,28 +24,28 @@
|
|||
content = ''
|
||||
chain PREROUTING {
|
||||
type nat hook prerouting priority dstnat; policy accept;
|
||||
tcp dport 2211 dnat to ${outputs.ips.pc}:22 comment "SSH to PC"
|
||||
tcp dport 2233 dnat to ${outputs.ips.wgSpan}.3:22 comment "SSH to Oracle VM"
|
||||
tcp dport 2211 dnat to ${config.ips.pc}:22 comment "SSH to PC"
|
||||
tcp dport 2233 dnat to ${config.ips.wgSpan}.3:22 comment "SSH to Oracle VM"
|
||||
|
||||
udp dport { 27005, 27015, 7777 } dnat to ${outputs.ips.pc} comment "PC Hosted Games"
|
||||
udp dport { 27005, 27015, 7777 } dnat to ${config.ips.pc} comment "PC Hosted Games"
|
||||
|
||||
tcp dport { 58010, 57989, 57984 } dnat to ${outputs.ips.pc} comment "PC Sunshine TCP"
|
||||
udp dport { 57998, 57999, 58000 } dnat to ${outputs.ips.pc} comment "PC Sunshine UDP"
|
||||
tcp dport { 58010, 57989, 57984 } dnat to ${config.ips.pc} comment "PC Sunshine TCP"
|
||||
udp dport { 57998, 57999, 58000 } dnat to ${config.ips.pc} comment "PC Sunshine UDP"
|
||||
|
||||
tcp dport { 38010, 37989, 37984 } dnat to ${outputs.ips.vm} comment "VM Sunshine TCP"
|
||||
udp dport { 37998, 37999, 38000 } dnat to ${outputs.ips.vm} comment "VM Sunshine UDP"
|
||||
tcp dport { 38010, 37989, 37984 } dnat to ${config.ips.vm} comment "VM Sunshine TCP"
|
||||
udp dport { 37998, 37999, 38000 } dnat to ${config.ips.vm} comment "VM Sunshine UDP"
|
||||
|
||||
udp dport { 7790, 7791, 7792 } dnat to ${outputs.ips.hx} comment "Deus Ex"
|
||||
udp dport { 7790, 7791, 7792 } dnat to ${config.ips.hx} comment "Deus Ex"
|
||||
|
||||
ip saddr ${outputs.secrets.cornIP} tcp dport { 9943, 9944 } dnat to ${outputs.ips.vm} comment "VM ALVR TCP"
|
||||
ip saddr ${outputs.secrets.cornIP} udp dport { 9943, 9944 } dnat to ${outputs.ips.vm} comment "VM ALVR UDP"
|
||||
ip saddr ${config.secrets.cornIP} tcp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR TCP"
|
||||
ip saddr ${config.secrets.cornIP} udp dport { 9943, 9944 } dnat to ${config.ips.vm} comment "VM ALVR UDP"
|
||||
}
|
||||
|
||||
chain POSTROUTING {
|
||||
type nat hook postrouting priority 100; policy accept;
|
||||
oifname "${outputs.ips.netInt}" masquerade
|
||||
iifname "${outputs.ips.netInt}" oifname "${outputs.ips.wgInt}" masquerade comment "Traffic from public to WireGuard"
|
||||
tcp dport ${mailPorts} oifname != "${outputs.ips.wgInt}" drop comment "Send mail"
|
||||
oifname "${config.ips.netInt}" masquerade
|
||||
iifname "${config.ips.netInt}" oifname "${config.ips.wgInt}" masquerade comment "Traffic from public to WireGuard"
|
||||
tcp dport ${mailPorts} oifname != "${config.ips.wgInt}" drop comment "Send mail"
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
{ outputs, ... }:
|
||||
{ config, ... }:
|
||||
{
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [ 51820 ];
|
||||
};
|
||||
|
||||
networking.wireguard.interfaces = {
|
||||
"${outputs.ips.wgInt}" = {
|
||||
"${config.ips.wgInt}" = {
|
||||
# Define IP of client in per device config
|
||||
listenPort = 51820;
|
||||
privateKey = outputs.secrets.wgClientPriv;
|
||||
privateKey = config.secrets.wgClientPriv;
|
||||
peers = [
|
||||
{ # 0.0.0.0 makes wg act like a traditional VPN
|
||||
publicKey = outputs.secrets.wgServerPub;
|
||||
publicKey = config.secrets.wgServerPub;
|
||||
allowedIPs = [ "0.0.0.0/0" ];
|
||||
endpoint = "sv.${outputs.secrets.jimDomain}:51820";
|
||||
endpoint = "sv.${config.secrets.jimDomain}:51820";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ outputs, ... }:
|
||||
{ config, ... }:
|
||||
{
|
||||
networking = {
|
||||
nat = {
|
||||
enable = true;
|
||||
externalInterface = "${outputs.ips.netInt}";
|
||||
internalInterfaces = [ "${outputs.ips.wgInt}" ];
|
||||
externalInterface = "${config.ips.netInt}";
|
||||
internalInterfaces = [ "${config.ips.wgInt}" ];
|
||||
};
|
||||
firewall.allowedUDPPorts = [ 51820 ];
|
||||
};
|
||||
|
@ -12,22 +12,22 @@
|
|||
networking.wireguard = {
|
||||
enable = true;
|
||||
interfaces = {
|
||||
"${outputs.ips.wgInt}" = {
|
||||
ips = [ "${outputs.ips.wgSpan}.1/24" ];
|
||||
"${config.ips.wgInt}" = {
|
||||
ips = [ "${config.ips.wgSpan}.1/24" ];
|
||||
listenPort = 51820;
|
||||
privateKey = outputs.secrets.wgServerPriv;
|
||||
privateKey = config.secrets.wgServerPriv;
|
||||
peers = [
|
||||
{ # Jimbo Pixel 9
|
||||
publicKey = outputs.secrets.wgPixel9Pub;
|
||||
allowedIPs = [ "${outputs.ips.wgSpan}.2/32" ];
|
||||
publicKey = config.secrets.wgPixel9Pub;
|
||||
allowedIPs = [ "${config.ips.wgSpan}.2/32" ];
|
||||
}
|
||||
{ # Oracle VM
|
||||
publicKey = outputs.secrets.wgOraclePub;
|
||||
allowedIPs = [ "${outputs.ips.wgSpan}.3/32" ];
|
||||
publicKey = config.secrets.wgOraclePub;
|
||||
allowedIPs = [ "${config.ips.wgSpan}.3/32" ];
|
||||
}
|
||||
{ # General Nix
|
||||
publicKey = outputs.secrets.wgClientPub;
|
||||
allowedIPs = [ "${outputs.ips.wgSpan}.16/28" ];
|
||||
publicKey = config.secrets.wgClientPub;
|
||||
allowedIPs = [ "${config.ips.wgSpan}.16/28" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, ... }:
|
||||
{ ... }:
|
||||
{
|
||||
networking = {
|
||||
wireless.iwd.enable = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue