chaosvpn.init 761 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh /etc/rc.common
  2. START=99
  3. USE_PROCD=1
  4. start_service()
  5. {
  6. #check if chaosvpn is configured
  7. if [ ! -f "/etc/tinc/chaos/rsa_key.pub" -o ! -f "/etc/tinc/chaos/rsa_key.priv" ]; then
  8. logger -t chaosvpn "please generate rsa key pair"
  9. logger -t chaosvpn "tincd -n chaos --generate-keys=2048"
  10. exit 1
  11. fi
  12. if [ "`grep unique_name /etc/tinc/chaosvpn.conf | wc -l`" != "0" ]; then
  13. logger -t chaosvpn "/etc/tinc/chaosvpn.conf is not configured yet or contains 'unique_name'"
  14. exit 1
  15. fi
  16. procd_open_instance
  17. procd_set_param command /usr/sbin/chaosvpn -r -c /etc/tinc/chaosvpn.conf
  18. procd_close_instance
  19. }
  20. stop_service()
  21. {
  22. #force remove tinc pid
  23. if [ -f "/var/run/tinc.chaos.pid" ]; then
  24. rm "/var/run/tinc.chaos.pid"
  25. fi
  26. }