Dieses Wiki ist ein Archiv bis 2023. Das aktuelle Wiki findet sich unter https://wiki.hamburg.ccc.de/

Difference between revisions of "ChaosVPN:Tims NetBSD chaosvpn rc.d"

From CCCHHWiki
Jump to: navigation, search
m (chmod)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
Dont forget to run  '''''# chmod + /etc/rc.d/chaosvpn'''''
+
should probably change this to send signals instead of kill -9 hehe
  
<pre>
 
  
 +
<nowiki>
 
#!/bin/sh
 
#!/bin/sh
 
#
 
#
Line 15: Line 15:
 
name="chaosvpn"
 
name="chaosvpn"
 
start_cmd="chaosvpn_start"
 
start_cmd="chaosvpn_start"
stop_cmd=":"
+
stop_cmd="chaosvpn_stop"
  
chaosvpn_start()
+
chaosvpn_start(){
{
 
  
   /usr/pkg/sbin/chaosvpn -d
+
   /usr/local/sbin/chaosvpn -d
 +
  sleep 10
 +
  /usr/local/etc/tinc/chaos/tinc-up
  
   sleep 10 #give things time to get set up
+
   #add logic in here later to check if its actually up
 +
  #for now just assume it worked, lol
 +
  echo "chaosvpn up..."
 +
}
  
  /usr/pkg/etc/tinc/chaos/tinc-up
+
chaosvpn_stop(){
  
   route add 10.100.0.0/16 10.100.44.1 #because the route for 10.100 wasnt being automagically configured
+
   echo "Killing ChaosVPN..."
   route add 172.31.0.0/16 10.100.44.1 #same as above
+
  ps -aux | awk '/chaosvpn -d/ && !/awk/ {print $2}' | xargs -r kill -9
 +
  sleep 2 # once again, let things die...
 +
   echo "Killing tincd..."
 +
  ps -aux | awk '/tincd/ && !/awk/ {print $2}' | xargs -r kill -9
  
 +
  #add logic in here later to check if its actually down
 +
  echo "chaosvpn down..."
 
}
 
}
  
load_rc_config $name
 
 
run_rc_command "$1"
 
run_rc_command "$1"
 
+
# eof
</pre>
+
</nowiki>
 
 
[[Category:ChaosVPN]]
 

Latest revision as of 20:50, 30 November 2013

should probably change this to send signals instead of kill -9 hehe


#!/bin/sh
#
# $NetBSD: chaosvpn
# 

# PROVIDE: chaosvpn
# REQUIRE: inetd network LOGIN

$_rc_subr_loaded . /etc/rc.subr

name="chaosvpn"
start_cmd="chaosvpn_start"
stop_cmd="chaosvpn_stop"

chaosvpn_start(){

  /usr/local/sbin/chaosvpn -d
  sleep 10
  /usr/local/etc/tinc/chaos/tinc-up

  #add logic in here later to check if its actually up
  #for now just assume it worked, lol
  echo "chaosvpn up..."
}

chaosvpn_stop(){

  echo "Killing ChaosVPN..."
  ps -aux | awk '/chaosvpn -d/ && !/awk/ {print $2}' | xargs -r kill -9
  sleep 2 # once again, let things die...
  echo "Killing tincd..."
  ps -aux | awk '/tincd/ && !/awk/ {print $2}' | xargs -r kill -9

  #add logic in here later to check if its actually down
  echo "chaosvpn down..."
}

run_rc_command "$1"
# eof