mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 01:27:27 -04:00
Begin of restructuring ...
- tweaking before re-work tpotinit
This commit is contained in:
30
docker/tpotinit/dist/bin/rules.sh
vendored
30
docker/tpotinit/dist/bin/rules.sh
vendored
@ -33,7 +33,7 @@ fi
|
||||
function fuGETPORTS {
|
||||
### Get ports from docker-compose.yml
|
||||
|
||||
myDOCKERCOMPOSEPORTS=$(cat $myDOCKERCOMPOSEYML | yq -r '.services[].ports' | grep ':' | sed -e s/127.0.0.1// | tr -d '", ' | sed -e s/^:// | cut -f1 -d ':' )
|
||||
myDOCKERCOMPOSEPORTS=$(cat $myDOCKERCOMPOSEYML | yq -r '.services[].ports' | grep ':' | sed -e s/127.0.0.1// | tr -d '", ,#,-' | sed -e s/^:// | cut -f1 -d ':' )
|
||||
myDOCKERCOMPOSEPORTS+=" $myHOSTPORTS"
|
||||
myRULESPORTS=$(for i in $myDOCKERCOMPOSEPORTS; do echo $i; done | sort -gu)
|
||||
echo "Setting up / removing these ports:"
|
||||
@ -44,24 +44,24 @@ function fuSETRULES {
|
||||
### Setting up iptables-legacy rules for honeytrap
|
||||
if [ "$myNFQCHECK" == "honeytrap" ];
|
||||
then
|
||||
/usr/sbin/iptables-legacy -w -A INPUT -s 127.0.0.1 -j ACCEPT
|
||||
/usr/sbin/iptables-legacy -w -A INPUT -d 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -A INPUT -s 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -A INPUT -d 127.0.0.1 -j ACCEPT
|
||||
|
||||
for myPORT in $myRULESPORTS; do
|
||||
/usr/sbin/iptables-legacy -w -A INPUT -p tcp --dport $myPORT -j ACCEPT
|
||||
iptables-legacy -w -A INPUT -p tcp --dport $myPORT -j ACCEPT
|
||||
done
|
||||
|
||||
/usr/sbin/iptables-legacy -w -A INPUT -p tcp --syn -m state --state NEW -j NFQUEUE
|
||||
iptables-legacy -w -A INPUT -p tcp --syn -m state --state NEW -j NFQUEUE
|
||||
fi
|
||||
|
||||
### Setting up iptables-legacy rules for glutton
|
||||
if [ "$myNFQCHECK" == "glutton" ];
|
||||
then
|
||||
/usr/sbin/iptables-legacy -w -t raw -A PREROUTING -s 127.0.0.1 -j ACCEPT
|
||||
/usr/sbin/iptables-legacy -w -t raw -A PREROUTING -d 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -t raw -A PREROUTING -s 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -t raw -A PREROUTING -d 127.0.0.1 -j ACCEPT
|
||||
|
||||
for myPORT in $myRULESPORTS; do
|
||||
/usr/sbin/iptables-legacy -w -t raw -A PREROUTING -p tcp --dport $myPORT -j ACCEPT
|
||||
iptables-legacy -w -t raw -A PREROUTING -p tcp --dport $myPORT -j ACCEPT
|
||||
done
|
||||
# No need for NFQ forwarding, such rules are set up by glutton
|
||||
fi
|
||||
@ -71,24 +71,24 @@ function fuUNSETRULES {
|
||||
### Removing iptables-legacy rules for honeytrap
|
||||
if [ "$myNFQCHECK" == "honeytrap" ];
|
||||
then
|
||||
/usr/sbin/iptables-legacy -w -D INPUT -s 127.0.0.1 -j ACCEPT
|
||||
/usr/sbin/iptables-legacy -w -D INPUT -d 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -D INPUT -s 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -D INPUT -d 127.0.0.1 -j ACCEPT
|
||||
|
||||
for myPORT in $myRULESPORTS; do
|
||||
/usr/sbin/iptables-legacy -w -D INPUT -p tcp --dport $myPORT -j ACCEPT
|
||||
iptables-legacy -w -D INPUT -p tcp --dport $myPORT -j ACCEPT
|
||||
done
|
||||
|
||||
/usr/sbin/iptables-legacy -w -D INPUT -p tcp --syn -m state --state NEW -j NFQUEUE
|
||||
iptables-legacy -w -D INPUT -p tcp --syn -m state --state NEW -j NFQUEUE
|
||||
fi
|
||||
|
||||
### Removing iptables-legacy rules for glutton
|
||||
if [ "$myNFQCHECK" == "glutton" ];
|
||||
then
|
||||
/usr/sbin/iptables-legacy -w -t raw -D PREROUTING -s 127.0.0.1 -j ACCEPT
|
||||
/usr/sbin/iptables-legacy -w -t raw -D PREROUTING -d 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -t raw -D PREROUTING -s 127.0.0.1 -j ACCEPT
|
||||
iptables-legacy -w -t raw -D PREROUTING -d 127.0.0.1 -j ACCEPT
|
||||
|
||||
for myPORT in $myRULESPORTS; do
|
||||
/usr/sbin/iptables-legacy -w -t raw -D PREROUTING -p tcp --dport $myPORT -j ACCEPT
|
||||
iptables-legacy -w -t raw -D PREROUTING -p tcp --dport $myPORT -j ACCEPT
|
||||
done
|
||||
# No need for removing NFQ forwarding, such rules are removed by glutton
|
||||
fi
|
||||
|
Reference in New Issue
Block a user