chaosvpn: add new package

Signed-off-by: Norbert Summer <git@o-g.at>
This commit is contained in:
Norbert Summer
2015-09-22 16:14:53 +02:00
parent 27242cadfd
commit f6acde7187
3 changed files with 90 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
[ "$INTERFACE" == "wan" ] || return
[ "$ACTION" == "ifup" ] && /etc/init.d/chaosvpn restart
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
start_service()
{
#check if chaosvpn is configured
if [ ! -f "/etc/tinc/chaos/rsa_key.pub" -o ! -f "/etc/tinc/chaos/rsa_key.priv" ]; then
logger -t chaosvpn "please generate rsa key pair"
logger -t chaosvpn "tincd -n chaos --generate-keys=2048"
exit 1
fi
if [ "`grep unique_name /etc/tinc/chaosvpn.conf | wc -l`" != "0" ]; then
logger -t chaosvpn "/etc/tinc/chaosvpn.conf is not configured yet or contains 'unique_name'"
exit 1
fi
procd_open_instance
procd_set_param command /usr/sbin/chaosvpn -r -c /etc/tinc/chaosvpn.conf
procd_close_instance
}
stop_service()
{
#force remove tinc pid
if [ -f "/var/run/tinc.chaos.pid" ]; then
rm "/var/run/tinc.chaos.pid"
fi
}