feat(firewall): auto-detect which iptables

- On `iptables` error, try to use `iptables-nft`
- On `ip6tables` error, try to use `ip6tables-nft`
This commit is contained in:
Quentin McGaw
2022-02-26 22:55:22 +00:00
parent 2b09b9c290
commit 006b218ade
4 changed files with 79 additions and 27 deletions

View File

@@ -205,8 +205,12 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
if *allSettings.Firewall.Debug { // To remove in v4
firewallLogger.PatchLevel(logging.LevelDebug)
}
firewallConf := firewall.NewConfig(firewallLogger, cmder,
firewallConf, err := firewall.NewConfig(ctx, firewallLogger, cmder,
defaultInterface, defaultGateway, localNetworks, defaultIP)
if err != nil {
return err
}
if *allSettings.Firewall.Enabled {
err = firewallConf.SetEnabled(ctx, true)
if err != nil {