|
@@ -56,6 +56,7 @@ func CreateEgressGateway(gateway models.EgressGatewayRequest) (models.Node, erro
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if node.OS == "freebsd" {
|
|
if node.OS == "freebsd" {
|
|
|
|
+ // spacing around ; is important for later parsing of postup/postdown in wireguard/common.go
|
|
postUpCmd = "kldload ipfw ipfw_nat ; "
|
|
postUpCmd = "kldload ipfw ipfw_nat ; "
|
|
postUpCmd += "ipfw disable one_pass ; "
|
|
postUpCmd += "ipfw disable one_pass ; "
|
|
postUpCmd += "ipfw nat 1 config if " + gateway.Interface + " same_ports unreg_only reset ; "
|
|
postUpCmd += "ipfw nat 1 config if " + gateway.Interface + " same_ports unreg_only reset ; "
|
|
@@ -285,6 +286,7 @@ func DeleteGatewayExtClients(gatewayID string, networkName string) error {
|
|
|
|
|
|
// firewallNFTCommandsCreateIngress - used to centralize firewall command maintenance for creating an ingress gateway using the nftables firewall.
|
|
// firewallNFTCommandsCreateIngress - used to centralize firewall command maintenance for creating an ingress gateway using the nftables firewall.
|
|
func firewallNFTCommandsCreateIngress(networkInterface string) (string, string) {
|
|
func firewallNFTCommandsCreateIngress(networkInterface string) (string, string) {
|
|
|
|
+ // spacing around ; is important for later parsing of postup/postdown in wireguard/common.go
|
|
postUp := "nft add table ip filter ; "
|
|
postUp := "nft add table ip filter ; "
|
|
postUp += "nft add chain ip filter FORWARD ; "
|
|
postUp += "nft add chain ip filter FORWARD ; "
|
|
postUp += "nft add rule ip filter FORWARD iifname " + networkInterface + " counter accept ; "
|
|
postUp += "nft add rule ip filter FORWARD iifname " + networkInterface + " counter accept ; "
|
|
@@ -302,6 +304,7 @@ func firewallNFTCommandsCreateIngress(networkInterface string) (string, string)
|
|
|
|
|
|
// firewallNFTCommandsCreateEgress - used to centralize firewall command maintenance for creating an egress gateway using the nftables firewall.
|
|
// firewallNFTCommandsCreateEgress - used to centralize firewall command maintenance for creating an egress gateway using the nftables firewall.
|
|
func firewallNFTCommandsCreateEgress(networkInterface string, gatewayInterface string, egressNatEnabled string) (string, string) {
|
|
func firewallNFTCommandsCreateEgress(networkInterface string, gatewayInterface string, egressNatEnabled string) (string, string) {
|
|
|
|
+ // spacing around ; is important for later parsing of postup/postdown in wireguard/common.go
|
|
postUp := "nft add table ip filter ; "
|
|
postUp := "nft add table ip filter ; "
|
|
postUp += "nft add chain ip filter FORWARD ; "
|
|
postUp += "nft add chain ip filter FORWARD ; "
|
|
postUp += "nft add rule ip filter FORWARD iifname " + networkInterface + " counter accept ; "
|
|
postUp += "nft add rule ip filter FORWARD iifname " + networkInterface + " counter accept ; "
|
|
@@ -322,6 +325,7 @@ func firewallNFTCommandsCreateEgress(networkInterface string, gatewayInterface s
|
|
|
|
|
|
// firewallIPTablesCommandsCreateIngress - used to centralize firewall command maintenance for creating an ingress gateway using the iptables firewall.
|
|
// firewallIPTablesCommandsCreateIngress - used to centralize firewall command maintenance for creating an ingress gateway using the iptables firewall.
|
|
func firewallIPTablesCommandsCreateIngress(networkInterface string) (string, string) {
|
|
func firewallIPTablesCommandsCreateIngress(networkInterface string) (string, string) {
|
|
|
|
+ // spacing around ; is important for later parsing of postup/postdown in wireguard/common.go
|
|
postUp := "iptables -A FORWARD -i " + networkInterface + " -j ACCEPT ; "
|
|
postUp := "iptables -A FORWARD -i " + networkInterface + " -j ACCEPT ; "
|
|
postUp += "iptables -A FORWARD -o " + networkInterface + " -j ACCEPT ; "
|
|
postUp += "iptables -A FORWARD -o " + networkInterface + " -j ACCEPT ; "
|
|
postUp += "iptables -t nat -A POSTROUTING -o " + networkInterface + " -j MASQUERADE"
|
|
postUp += "iptables -t nat -A POSTROUTING -o " + networkInterface + " -j MASQUERADE"
|
|
@@ -336,7 +340,7 @@ func firewallIPTablesCommandsCreateIngress(networkInterface string) (string, str
|
|
|
|
|
|
// firewallIPTablesCommandsCreateEgress - used to centralize firewall command maintenance for creating an egress gateway using the iptables firewall.
|
|
// firewallIPTablesCommandsCreateEgress - used to centralize firewall command maintenance for creating an egress gateway using the iptables firewall.
|
|
func firewallIPTablesCommandsCreateEgress(networkInterface string, gatewayInterface string, egressNatEnabled string) (string, string) {
|
|
func firewallIPTablesCommandsCreateEgress(networkInterface string, gatewayInterface string, egressNatEnabled string) (string, string) {
|
|
-
|
|
|
|
|
|
+ // spacing around ; is important for later parsing of postup/postdown in wireguard/common.go
|
|
postUp := "iptables -A FORWARD -i " + networkInterface + " -j ACCEPT; "
|
|
postUp := "iptables -A FORWARD -i " + networkInterface + " -j ACCEPT; "
|
|
postUp += "iptables -A FORWARD -o " + networkInterface + " -j ACCEPT"
|
|
postUp += "iptables -A FORWARD -o " + networkInterface + " -j ACCEPT"
|
|
postDown := "iptables -D FORWARD -i " + networkInterface + " -j ACCEPT; "
|
|
postDown := "iptables -D FORWARD -i " + networkInterface + " -j ACCEPT; "
|