Added
Link Here
|
1 |
--- pf.go.orig 2022-01-18 11:38:14 UTC |
2 |
+++ pf.go |
3 |
@@ -66,7 +66,7 @@ func newPF(config *bouncerConfig) (interface{}, error) |
4 |
func (ctx *pfContext) checkTable() error { |
5 |
log.Infof("Checking pf table: %s", ctx.table) |
6 |
|
7 |
- cmd := exec.Command(pfctlCmd, "-s", "Tables") |
8 |
+ cmd := exec.Command(pfctlCmd, "-a", "crowdsec", "-s", "Tables") |
9 |
out, err := cmd.CombinedOutput() |
10 |
|
11 |
if err != nil { |
12 |
@@ -79,7 +79,7 @@ func (ctx *pfContext) checkTable() error { |
13 |
} |
14 |
|
15 |
func (ctx *pfContext) shutDown() error { |
16 |
- cmd := exec.Command(pfctlCmd, "-t", ctx.table, "-T", "flush") |
17 |
+ cmd := exec.Command(pfctlCmd, "-a", "crowdsec", "-t", ctx.table, "-T", "flush") |
18 |
log.Infof("pf table clean-up : %s", cmd.String()) |
19 |
if out, err := cmd.CombinedOutput(); err != nil { |
20 |
log.Errorf("Error while flushing table (%s): %v --> %s", cmd.String(), err, string(out)) |
21 |
@@ -94,7 +94,7 @@ func (ctx *pfContext) Add(decision *models.Decision) e |
22 |
return err |
23 |
} |
24 |
log.Debugf(addBanFormat, backendName, *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario) |
25 |
- cmd := exec.Command(pfctlCmd, "-t", ctx.table, "-T", "add", *decision.Value) |
26 |
+ cmd := exec.Command(pfctlCmd, "-a", "crowdsec", "-t", ctx.table, "-T", "add", *decision.Value) |
27 |
log.Debugf("pfctl add : %s", cmd.String()) |
28 |
if out, err := cmd.CombinedOutput(); err != nil { |
29 |
log.Infof("Error while adding to table (%s): %v --> %s", cmd.String(), err, string(out)) |
30 |
@@ -109,7 +109,7 @@ func (ctx *pfContext) Delete(decision *models.Decision |
31 |
return err |
32 |
} |
33 |
log.Debugf(delBanFormat, backendName, *decision.Value, strconv.Itoa(int(banDuration.Seconds())), *decision.Scenario) |
34 |
- cmd := exec.Command(pfctlCmd, "-t", ctx.table, "-T", "delete", *decision.Value) |
35 |
+ cmd := exec.Command(pfctlCmd, "-a", "crowdsec", "-t", ctx.table, "-T", "delete", *decision.Value) |
36 |
log.Debugf("pfctl del : %s", cmd.String()) |
37 |
if out, err := cmd.CombinedOutput(); err != nil { |
38 |
log.Infof("Error while deleting from table (%s): %v --> %s", cmd.String(), err, string(out)) |