fix(firewall): query iptables version for iptables found
This commit is contained in:
@@ -279,9 +279,7 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
|
|||||||
{name: "OpenVPN 2.5", getVersion: ovpnConf.Version25},
|
{name: "OpenVPN 2.5", getVersion: ovpnConf.Version25},
|
||||||
{name: "OpenVPN 2.6", getVersion: ovpnConf.Version26},
|
{name: "OpenVPN 2.6", getVersion: ovpnConf.Version26},
|
||||||
{name: "Unbound", getVersion: dnsConf.Version},
|
{name: "Unbound", getVersion: dnsConf.Version},
|
||||||
{name: "IPtables", getVersion: func(ctx context.Context) (version string, err error) {
|
{name: "IPtables", getVersion: firewallConf.Version},
|
||||||
return firewall.Version(ctx, cmder)
|
|
||||||
}},
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/qdm12/gluetun/internal/models"
|
"github.com/qdm12/gluetun/internal/models"
|
||||||
"github.com/qdm12/golibs/command"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -44,9 +43,9 @@ func flipRule(rule string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Version obtains the version of the installed iptables.
|
// Version obtains the version of the installed iptables.
|
||||||
func Version(ctx context.Context, runner command.Runner) (string, error) {
|
func (c *Config) Version(ctx context.Context) (string, error) {
|
||||||
cmd := exec.CommandContext(ctx, "iptables", "--version")
|
cmd := exec.CommandContext(ctx, c.ipTables, "--version") //nolint:gosec
|
||||||
output, err := runner.Run(cmd)
|
output, err := c.runner.Run(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user