diff options
Diffstat (limited to 'data/run')
-rwxr-xr-x | data/run/firewall.local | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/data/run/firewall.local b/data/run/firewall.local new file mode 100755 index 0000000..4b9d78e --- /dev/null +++ b/data/run/firewall.local | |||
@@ -0,0 +1,50 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # IPFire Custom Rules (icr) | ||
4 | # | ||
5 | # Github: https://github.com/MonkeyCat/IPFireCustomRules | ||
6 | # | ||
7 | # Loops over the local "rules.d/" subfolder files | ||
8 | # Forwarding the (start/stop) command to every file | ||
9 | # which extension is ".on". To enabled multiple | ||
10 | # custom firewall rulesets! | ||
11 | # | ||
12 | # the configuration of the ipfire custom rules (ipfcr) | ||
13 | # in the local "rules.d/*" sunfolder, is inside the | ||
14 | # files themself! | ||
15 | # | ||
16 | # Use this at your OWN RISK. Not fully supported! | ||
17 | # | ||
18 | # License: GPL2 | ||
19 | # | ||
20 | # icr v0.1 (c) 30 May 2022 code.monkeycat.com | ||
21 | # | ||
22 | # Nuff text... | ||
23 | |||
24 | pwd=$PWD | ||
25 | base=${PWD%/*/*} | ||
26 | |||
27 | case "$1" in | ||
28 | start) | ||
29 | find $base/rules.d/ -maxdepth 1 -type f \( ! -name . \) -exec bash -c "{} $1" \; | ||
30 | |||
31 | ;; | ||
32 | stop) | ||
33 | find $base/rules.d/ -maxdepth 1 -type f \( ! -name . \) -exec bash -c "{} $1" \; | ||
34 | |||
35 | ;; | ||
36 | reload) | ||
37 | $0 stop | ||
38 | $0 start | ||
39 | |||
40 | ;; | ||
41 | flush) | ||
42 | iptables -t nat -F CUSTOMPREROUTING | ||
43 | iptables -t nat -F CUSTOMPOSTROUTING | ||
44 | iptables -F CUSTOMFORWARD | ||
45 | |||
46 | ;; | ||
47 | *) | ||
48 | echo "Usage: $0 {start|stop|reload|flush}" | ||
49 | ;; | ||
50 | esac | ||