initial commit of file from CVS for smeserver-coova-chilli on Sat Sep 7 20:15:38 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:15:38 +10:00
parent ee4df6cdb4
commit 2120fa2210
85 changed files with 1432 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
#!/bin/bash
exec /usr/bin/sudo /etc/chilli/condown.sh $ADDR $FRAMED_IP_ADDRESS

View File

@@ -0,0 +1,4 @@
#!/bin/bash
exec /usr/bin/sudo /etc/chilli/conup.sh $ADDR $FRAMED_IP_ADDRESS

View File

@@ -0,0 +1,13 @@
#!/bin/bash
SQUID_STATUS=$(/sbin/e-smith/db configuration getprop squid status)
WEB_REQ=$(/sbin/e-smith/db configuration getprop chilli WebRequests)
if [[ $SQUID_STATUS == 'enabled' && $WEB_REQ == 'squid' ]]; then
SQUID_PORT=$(/sbin/e-smith/db configuration getprop squid TransparentPort)
/sbin/iptables -D IN_FROM_CHILLI -s $2 \
-p tcp --dport $SQUID_PORT --syn -j ACCEPT
/sbin/iptables -t nat -D PREROUTING_FROM_CHILLI -s $2 \
-p tcp --dport 80 -j DNAT --to $1:$SQUID_PORT
fi

16
root/etc/chilli/conup.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
SQUID_STATUS=$(/sbin/e-smith/db configuration getprop squid status)
WEB_REQ=$(/sbin/e-smith/db configuration getprop chilli WebRequests)
if [[ $SQUID_STATUS == 'enabled' && $WEB_REQ == 'squid' ]]; then
SQUID_PORT=$(/sbin/e-smith/db configuration getprop squid TransparentPort)
# We need to insert rules just before the accept, so we'll have to compute this position
POSITION=$(LANG=C iptables -t nat -L PREROUTING_FROM_CHILLI -n | \
egrep -v '(Chain|target)' | grep -n ACCEPT | cut -d':' -f1)
/sbin/iptables -t nat -I PREROUTING_FROM_CHILLI $POSITION -s $2 \
-p tcp --dport 80 -j DNAT --to $1:$SQUID_PORT
/sbin/iptables -I IN_FROM_CHILLI 7 -s $2 \
-p tcp --dport $SQUID_PORT --syn -j ACCEPT
fi