forked from step-security/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firewall_test.go
43 lines (31 loc) · 859 Bytes
/
firewall_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//go:build linux
// +build linux
package main
import (
"testing"
"github.com/coreos/go-iptables/iptables"
)
func Test_addAuditRules(t *testing.T) {
err := AddAuditRules(nil)
if err != nil {
t.Errorf("Error not expected %v", err)
}
ipt, err := iptables.New()
if err != nil {
t.Errorf("Error not expected creating iptables %v", err)
}
ipt.ClearChain("filter", "OUTPUT")
ipt.ClearChain("filter", "DOCKER-USER")
endpoints := []ipAddressEndpoint{}
endpoints = append(endpoints, ipAddressEndpoint{ipAddress: "1.1.1.1", port: "443"})
err = addBlockRulesForGitHubHostedRunner(nil, endpoints)
if err != nil {
t.Errorf("Error not expected %v", err)
}
ipt, err = iptables.New()
if err != nil {
t.Errorf("Error not expected creating iptables %v", err)
}
ipt.ClearChain("filter", "OUTPUT")
ipt.ClearChain("filter", "DOCKER-USER")
}