Combine Dependencies; Other Improvements
-Removed CPU intensive python based telnet server option -Removed Micropython -Renamed AT Telnet Daemon socat-at bridge -Moved TTL related files not part of the www/cgi-bin directory to /simplefirewall -Improved Simplefirewall menu, added ability to change TTL -Combined uninstall and install functions for simpleadmin and dependencies into single functions
This commit is contained in:
12
simplefirewall/systemd/ttl-override.service
Normal file
12
simplefirewall/systemd/ttl-override.service
Normal file
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=TTL Override
|
||||
After=ql-netd.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usrdata/simplefirewall/ttl-override start
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
53
simplefirewall/ttl-override
Normal file
53
simplefirewall/ttl-override
Normal file
@@ -0,0 +1,53 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Adapted from https://github.com/natecarlson/quectel-rgmii-configuration-notes/blob/main/files/ttl-override
|
||||
# Uses ttlvalue file to read what ttl should be set to
|
||||
|
||||
|
||||
if [ -f /usrdata/simplefirewall/ttlvalue ];
|
||||
then
|
||||
ttlfile=$(</usrdata/simpleadmin/ttl/ttlvalue)
|
||||
TTLVALUE=$(echo $ttlfile | grep -o "[0-9]\{1,3\}")
|
||||
|
||||
if [ -z "${TTLVALUE}" ]; then
|
||||
echo "Couldnt get proper ttl value from file" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Couldnt find ttlvalue file, lets generate one with 0 ttlvalue (0 = disabled)
|
||||
touch /usrdata/simpleadmin/ttl/ttlvalue && echo '0' > /usrdata/simpleadmin/ttl/ttlvalue
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if (( $TTLVALUE > 0 )); then
|
||||
echo "Adding TTL override rules: "
|
||||
iptables -t mangle -I POSTROUTING -o rmnet+ -j TTL --ttl-set ${TTLVALUE}
|
||||
ip6tables -t mangle -I POSTROUTING -o rmnet+ -j HL --hl-set ${TTLVALUE}
|
||||
else
|
||||
echo "TTLVALUE set to 0, nothing to do..."
|
||||
fi
|
||||
echo "done"
|
||||
;;
|
||||
stop)
|
||||
if (( $TTLVALUE > 0 )); then
|
||||
echo "Removing TTL override rules: "
|
||||
iptables -t mangle -D POSTROUTING -o rmnet+ -j TTL --ttl-set ${TTLVALUE} &>/dev/null || true
|
||||
ip6tables -t mangle -D POSTROUTING -o rmnet+ -j HL --hl-set ${TTLVALUE} &>/dev/null || true
|
||||
else
|
||||
echo "TTLVALUE set to 0, nothing to do..."
|
||||
fi
|
||||
echo "done"
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage ttl-override { start | stop | restart }" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
1
simplefirewall/ttlvalue
Normal file
1
simplefirewall/ttlvalue
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
Reference in New Issue
Block a user