From 54d4e1bc49fe45547103f2d8eb7d0f6b9b886a81 Mon Sep 17 00:00:00 2001 From: None None Date: Sat, 27 Jul 2019 15:37:38 +0200 Subject: [PATCH] Enable environment variable expansion --- iptables/iptables.go | 7 +++++++ 1 file changed, 7 insertions(+) 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,