bifrost: setup NAT for git-over-ssh to forgejo
This commit is contained in:
parent
beb635d6db
commit
65c76aea2a
3 changed files with 22 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
{ lib, ... }: {
|
{ lib, ... }: {
|
||||||
imports = [ ./wireguard.nix ];
|
imports = [ ./firewall.nix ./wireguard.nix ];
|
||||||
|
|
||||||
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
|
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@
|
||||||
];
|
];
|
||||||
useDHCP = lib.mkDefault false;
|
useDHCP = lib.mkDefault false;
|
||||||
useNetworkd = true;
|
useNetworkd = true;
|
||||||
nftables.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
20
hosts/bifrost/network/firewall.nix
Normal file
20
hosts/bifrost/network/firewall.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
_: {
|
||||||
|
networking = {
|
||||||
|
firewall.allowedTCPPorts = [ 42069 ];
|
||||||
|
nftables = {
|
||||||
|
enable = true;
|
||||||
|
ruleset = ''
|
||||||
|
table ip nat {
|
||||||
|
chain PREROUTING {
|
||||||
|
type nat hook prerouting priority -100 ;
|
||||||
|
iifname ens3 tcp dport 42069 dnat to 10.10.10.13
|
||||||
|
}
|
||||||
|
chain POSTROUTING {
|
||||||
|
type nat hook postrouting priority 100 ;
|
||||||
|
ip daddr 10.10.10.13 masquerade
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,8 +1,5 @@
|
||||||
_:
|
_:
|
||||||
let
|
let domainName = "forge.acomputer.lol"; in {
|
||||||
domainName = "forge.acomputer.lol";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
services = {
|
services = {
|
||||||
caddy.virtualHosts."${domainName}" = {
|
caddy.virtualHosts."${domainName}" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
|
Loading…
Reference in a new issue