a guest Apr 2nd, 2012 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. README file for
  2. ======================
  4. What is it?
  5. -----------
  6. This script connects you to an IPsec RAS service.
  8. Assumptions: The FreeS/WAN or openswan /etc/ipsec.conf and
  9. /etc/ipsec.secrets config files are configured correctly and
  10. contain the descriptions of the connections and the needed secrets.
  11. The connections should be configured to be added, NOT started
  12. on /etc/init.d/ipsec start, i.e. auto=add in ipsec.conf.
  13. The script assumes that we are the left side of the connection.
  14.  Note: It might work for people with auto=start, but I haven't
  15.  tested this. Nor have I tested without private virtual IP.
  17. This script should be executed setuid root.
  18. It is configured by /etc/ras.config (or another cfg file specified)
  19. which has the .ini file syntax as described below.
  21. Configuration /etc/ras.config
  22. -----------------------------
  23. Lines that start with '#' are considered comments and disregarded.
  25. The [global] section has the following keys (all optional!):
  26.  pinginterval: How many seconds to wait between pings (default: 15).
  27.  pingtimeout: How long (s) to wait for our peer to answer (default: 5).
  28.  pingfail: How many subsequent pings need to fail to make the script
  29.         assume that the connectivity is down (default: 6).
  30.  failholdoff: How long to sleep before trying to reconnect (def: 150).
  31.  maxconnect: How many seconds we may be connected in total
  32.         (default: empty => infinite).
  33.  virtip: virtual IP of your end of the IPsec connection
  34.         (default: empty => no virtual IP is used).
  35.  netdev: name of the NIC that's used to send out IPsec traffic
  36.         (default: empty => ipsec0 for KLIPS, netdev of defaultroute otherwise).
  37.  gateway: set to an empty string or 'via IP' to explicitly set routing GW
  38.         (default: if no netdev is specified take defroute gw, otherwise '').
  39.  authhost: Machine to telnet to for the opie auth session
  40.         (default: none => skip opie auth session).
  41.  authretry: How many times to try auth session if telnet times out.
  42.         0 means infinity (default: 3).
  43.  logname: username to log in as into authhost
  44.         (default: user running the script).
  46. Expert options are:
  47.  ipseccmd: Let's you override the command to control ipsec tunnels
  48.         with --up/--down/--status (default: /usr/sbin/ipsec auto)
  49.  ipsecinit: Let's you the command to call the ipsec init script
  50.         (default: /etc/init.d/ipsec)
  51.  ipsecconfread: Let's you override how to read FreeSWAN's ipsec.conf
  52.         (default: cat /etc/ipsec.conf)
  53.  ipcmd: The iproute2 command (default: /sbin/ip)
  54.  routeraw: How to get raw routing table (default: cat /proc/net/route)
  55.  netdevexist: How to determine existence of a network device
  56.         (default: test -e /proc/sys/net/ipv4/conf/)
  57. The most common use for these expoert options is to prefix commands with
  58. ssh -t to remote control another machine who handles the tunnels. This
  59. can be more easily achieved by specifying
  60.  cmdprefix: Let's you prefix the commands ipseccmd, ipsecinit,
  61.         ipsecconfread, ipcmd, routeraw, and netdevexist.
  62.         Note that individual settings are not prefixed automatically.
  64. The global section is mandatory, but it can be empty if the
  65. defaults all work for you.  
  67. There are additional sections where the section name does specify
  68. the name of the IPsec connection as given in ipsec.conf.
  69. The following entries per section are supported:
  70. route: The route that should be set, should be equal to the
  71.         other side's subnet, e.g. (optional).
  72.         The route is taken from rightsubnet in ipsec.conf, but can be
  73.         overriden here.
  74.         The special word 'AUTO' here prevents to affect your routes
  75.         but assumes that the ipcseccmd has taken care of it.
  76. pinghost: Machine to periodically send ping commands to (optional).
  78. mtu: MTU for the route (optional, default 1428).
  80. Multiple connections can be specified this way.
  81. The script starts and stops them all.
  83. Usage
  84. -----
  85. The script is verbose about success or failure, the return codes
  86. roughly match the ones from LSB init scripts.
  88. The program can be run in daemon mode, in which case it forks
  89. a background process; subsequent calls of this program will connect
  90. to the daemon by sending it signals.
  91. The signals SIGTERM/SIGINT/SIGQUIT terminate the process/daemon,
  92. the signal  SIGUSR1 makes it log status information, and
  93. the signal  SIGUSR2 makes it close the connections, reread the config
  94. file and reconnect. SIGHUP reacts like SIGUSR2 in daemon mode, and
  95. like SIGTERM in foreground mode.
  97. Usage: [options] action [cfg file]
  98.  options: -v (verbose), -q (quiet),
  99.         -d (daemonize), -D (Direct) -a (alreadyauthenticated)
  100.  action: (start|up|status|help|stop|down|
  101.          try-restart|condrestart|restart|reload|force-reload|probe)
  103. Example configs
  104. ---------------
  105. 1. Minimal config
  106. [global]
  107. # Nothing needed
  109. [myself-mycompany]
  110. # Nothing needed
  112. 2. Remote control another machine (router), ping
  113. [global]
  114. cmdprefix: ssh root@router
  115. #telnetcmd: ssh -t root@router /usr/bin/telnet
  117. [myself-mycompany1]
  118. #route:
  119. pinghost:
  120. #pingfail: 6
  122. [myself-mycompany2]
  123. pinghost:
  124. #route:
  126. 3. With opie preauthentication and explicit virtual IP setting
  127.    and route override
  128. [global]
  129. authhost:
  130. virtip:
  131. #logname: user
  133. [myself-mycompany]
  134. route:
  135. pinghost:
  137. You must have the connections myself-mycompany(1/2) configured
  138. in /etc/ipsec.conf.
RAW Paste Data