blob: 17e802a4ea624bac2ec12e163e8e46bb5b4aaae5 [file] [log] [blame]
#!/bin/sh
. /etc/utils.sh
SNIPROXY_PORT=8443
start_iptables () {
stop_iptables
ip46tables -A sniproxy-input -p tcp --dport "$SNIPROXY_PORT" -j ACCEPT
iptables -t nat -A sniproxy-nat -p tcp --dport https -j REDIRECT --to-ports "$SNIPROXY_PORT"
}
stop_iptables () {
ip46tables -F sniproxy-input
iptables -t nat -F sniproxy-nat
}
case "$1" in
start)
babysit 60 setuid nobody sniproxy -f 2>&1 | logos sniproxy &
start_iptables
;;
stop)
pkillwait -f "\bsniproxy"
stop_iptables
;;
restart)
$0 stop; $0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac