summaryrefslogtreecommitdiff
path: root/data/backups/firewall.2022_05_30_03_46_PM_1653918417.local
blob: 273dab3cd5e50ed47c30133c70259af46d422d7c (plain) (blame)
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
46
47
48
49
50
#!/bin/sh
# 
# IPFire Custom Firewall (icf)
# 
# Github: https://github.com/Mnkey
#
# Loops over the local "rules.d/" subfolder files
# Forwarding the (start/stop) command to every file
# which extension is ".on". To enabled multiple
# custom firewall rulesets!
#
# the configuration of the ipfire custom rules (ipfcr)
# in the local "rules.d/*" sunfolder, is inside the
# files themself! 
#
# Use this at your OWN RISK.  Not fully supported!
#
# License: GPL2 
#
# icf v0.1 (c) 30 May 2022 code.monkeycat.com
#
# Nuff text...

pwd=$PWD
base=${PWD%/*/*}

case "$1" in
  start)
        find $base/rules.d/ -maxdepth 1 -type f \( ! -name . \) -exec bash -c "{} $1" \;

        ;;
  stop)
        find $base/rules.d/ -maxdepth 1 -type f \( ! -name . \) -exec bash -c "{} $1" \;

        ;;
  reload)
        $0 stop
        $0 start

        ;;
   flush)
        iptables -t nat -F CUSTOMPREROUTING
        iptables -t nat -F CUSTOMPOSTROUTING
        iptables -F CUSTOMFORWARD

        ;;
  *)
        echo "Usage: $0 {start|stop|reload|flush}"
        ;;
esac