-
Notifications
You must be signed in to change notification settings - Fork 0
/
bam_linux.go
45 lines (28 loc) · 1 KB
/
bam_linux.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
44
45
package main
func init() {
configTemplates["config"] = defaultConfig
configTemplates["iptables"] = `# Generated by BAM!
*nat
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports {{.ProxyPort}}
-A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports {{.ProxyPort}}
COMMIT
`
configTemplates["help"] = `
Available generate options are 'bam' and 'iptables'.
# bam
Generate configuration file with default values for bam.
Example:
bam -generate config
# iptables
Generate iptables rules for forwarding incoming connections to bam's proxy.
Example:
bam -generate iptables > iptables.rules
IMPORTANT: If you are using a custom config file you also must use -config option.
Apply these rules to iptables using the following command:
sudo iptables-restore < iptables.rules
Check the rules applied to iptables by executing:
sudo iptables -t nat -L -n
In order to get BAM! working properly you also will need to install localtld:
https://github.com/jweslley/localtld
`
}