diff --git a/iptables/iptables.go b/iptables/iptables.go index 399d10b..b3f0fb1 100644 --- a/iptables/iptables.go +++ b/iptables/iptables.go @@ -24,6 +24,7 @@ import ( "strconv" "strings" "syscall" + "os" ) // Adds the output of stderr to exec.ExitError @@ -432,6 +433,12 @@ func (ipt *IPTables) runWithOutput(args []string, stdout io.Writer) error { } var stderr bytes.Buffer + + //expand environment variables + for index, element := range args { + args[index] = os.ExpandEnv(element) + } + cmd := exec.Cmd{ Path: ipt.path, Args: args,