Tool
tool
Reads:
1159
Score:
license:
n/aThe script below can be added to init for adding and removing the necessary iptables entry to route traffic from the SSLVPN subnet to the server's interface.
Create the script as something like /root/sslvpn-nat.sh then permanently link it to the init.d directory with ln -s /root/sslvpn-nat.sh /etc/init.d/sslvpn-nat
Then use yast2 runlevel to enable it during boot.
The only values that need to be changed are SSLVPN_NAT and SSLVPN_INT near the top of the script. These should reflect your environment.
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: sslvpn-nat
# Required-Start: $local_fs $remote_fs $novell-sslvpn
# X-UnitedLinux-Should-Start: $named $syslog $time
# Required-Stop: $local_fs $remote_fs
# X-UnitedLinux-Should-Stop: $named $syslog $time
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: SSL VPN NAT Entry
# Description: Provides routing from SSL VPN subnet to eth0 Interface
### END INIT INFO
# Set the SSLVPN Network (SSLVPN_NET)
# and the SSLVPN Interface (SSLVPN_INT)
SSLVPN_NET=12.8.0.0/16
SSLVPN_INT=192.168.1.1
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed set local and overall rc status to
# rc_reset clear local rc stats (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restart a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Adding SSLVPN NAT entry"
iptables -t nat -A POSTROUTING -s $SSLVPN_NET -j SNAT --to $SSLVPN_INT
rc_failed 0
rc_status -v
/etc/init.d/novell-sslvpn restart
;;
stop)
echo -n "Removing SSLVPN NAT entry"
iptables -t nat -D POSTROUTING -s $SSLVPN_NET -j SNAT --to $SSLVPN_INT
rc_failed 0
rc_status -v
/etc/init.d/novell-sslvpn restart
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
iptables -t nat -L POSTROUTING
sslvpnc --status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
rc_exit





0