aschuma

UBUNTU 14.04 :: VPNC SPLIT

Sep 13th, 2014
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.31 KB | None | 0 0
  1. http://lists.unix-ag.uni-kl.de/pipermail/vpnc-devel/2009-February/002990.html
  2.  
  3. [vpnc-devel] Tutorial: client side split tunnel
  4.  
  5. Antonio Borneo borneo.antonio at gmail.com
  6. Sat Feb 28 14:27:52 CET 2009
  7. Previous message: [vpnc-devel] vpnc 0.5.1 -- connection lost - error: Disabled Privacy Extensions
  8. Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
  9. Hi,
  10. in attachment a tutorial about setting a split tunnel with vpnc on client side.
  11. It means, setting split tunnel even if the VPN server is not configured for it.
  12.  
  13. Today it is only tested for Nortel server and Linux client.
  14. Any suggestion to improve it is welcome.
  15.  
  16. Joerg, Maurice,
  17. could this tutorial be added as new file to vpnc?
  18.  
  19. Best Regards,
  20. Antonio Borneo
  21. --
  22. -------------- next part --------------
  23. $Id$
  24.  
  25. User defined "Split Tunnel" tutorial
  26. Antonio Borneo, borneo.antonio at gmail.com
  27. v0.1, February 28, 2009
  28.  
  29. This tutorial targets creating your own split tunnel with vpnc. Split tunnel
  30. is configured on client side, independently form settings deployed by your VPN
  31. server.
  32.  
  33. ______________________________________________________________________________
  34.  
  35.  
  36. Table of Contents
  37.  
  38. 1. DISCLAIMER
  39. 2. Status
  40. 3. Introduction
  41. 4. Security issues
  42. 5. DNS
  43. 6. Web Proxy
  44. 7. Extended connection script
  45. 8. Example
  46. 9. Changelog
  47.  
  48. ______________________________________________________________________________
  49.  
  50.  
  51. 1. DISCLAIMER
  52. =============
  53.  
  54. Misusing the information provided in this document, you can open a security
  55. hole in the network protected by VPN.
  56. Nor the authors of this document nor the developers of vpnc can be considered
  57. responsible for any damage or legal issue caused by using the information in
  58. this document.
  59. If you are not fully aware of all the possible consequences created by your
  60. actions, DON'T use any of the configuration below.
  61.  
  62.  
  63. 2. Status
  64. =========
  65.  
  66. Following information has been tested only with Linux host and Nortel server.
  67. Any support or suggestion to improve this tutorial and to include other hosts
  68. and servers is warmly welcome.
  69.  
  70.  
  71. 3. Introduction
  72. ===============
  73.  
  74. A usual VPN configuration routes all the network connections through the VPN
  75. tunnel.
  76. Split tunnel is able to discriminate between IPs that have to be accessed
  77. through the VPN tunnel and IPs that have to be accessed directly.
  78. Practically, split tunnel lets your computer accessing the secure network
  79. through the VPN tunnel, while also accessing internet directly.
  80.  
  81. Split tunnel is usually set and controlled by the VPN server configuration and
  82. deployed to VPN client.
  83. This tutorial explains how to use vpnc to set your own split tunnel on client
  84. side, bypassing server setting.
  85. Possible applications are:
  86. - fixing, on client side, a server misconfiguration;
  87. - enabling split tunnel when server doesn't offer it.
  88.  
  89. Several users connect to VPN just to access their corporate internal mail
  90. server. When VPN is on, lack of split tunnel stops every connection not
  91. supported or allowed in the corporate network (e.g. video, voip, chat, ssh) or
  92. dramatically slows down connection to other internet resources.
  93.  
  94. Thanks to split tunnel, you can still read mail form corporate server, while
  95. enjoying full internet experience.
  96.  
  97.  
  98. 4. Security issues
  99. ==================
  100.  
  101. Split tunnel is usually not enabled in VPN servers, since it can open a
  102. security hole.
  103. In fact, in a split tunnel configuration, your computer can act as a bridge
  104. between internet and the protected network.
  105. Typical risky situations are:
  106. - your computer is not fully secured (e.g. infected by virus or, even worst,
  107. part of a botnet);
  108. - your computer has active accounts that can be accessed remotely;
  109. - you use a pear-to-pear SW that builds a mesh network.
  110. For such reason, most VPN server administrator guide discourage split tunnel,
  111. and system administrators usually don't take risk, keeping it disabled.
  112. So, be aware that any split tunnel on client side is done "by you" "at your
  113. own risk!"
  114. My personal suggestion is to enable it ONLY in specific situation, and only
  115. for few dedicated servers in the protected network (e.g. mail server). List
  116. one by one each server you need to connect with, and never enable a whole
  117. subnet.
  118.  
  119.  
  120. 5. DNS
  121. ======
  122.  
  123. Consider that your computer only manages "one" set of DNS servers.
  124. Usually corporate networks deploy their own DNS server, that only resolves
  125. corporate internal name space.
  126. In a split tunnel your computer cannot inquire either corporate and internet
  127. DNS, but only one of them.
  128. You have now to decide which DNS you have to use, while you can use the local
  129. static lookup table in /etc/hosts for the other case.
  130.  
  131. Of course, you can setup a local DNS server, that inquires either corporate or
  132. internet DNS. Such arrangement is not covered by this tutorial.
  133.  
  134. If you only want to use the corporate mail server (supposed having fix IP),
  135. you can resolve it with /etc/hosts, and use internet DNS for all other cases.
  136.  
  137.  
  138. 6. Web Proxy
  139. ============
  140.  
  141. Some corporate network is organized with a proxy server to access external web
  142. sites that can also be used to access internal ones.
  143. In this case, you do not have to configure routes to every corporate internal
  144. website you want to access, but just route to the proxy server.
  145. You can then use the same proxy to access internet web sites, or you can use a
  146. browser proxy switch (e.g. FoxyProxy http://foxyproxy.mozdev.org/ for Firefox)
  147. to select the best routing.
  148.  
  149.  
  150. 7. Extended connection script
  151. =============================
  152.  
  153. Current vpnc just follows what VPN server configures.
  154. To setup your own split tunnel, there is no need to modify vpnc code, nor the
  155. connection script /etc/vpnc/vpnc-script.
  156. It is possible to create an extension of such script; practically a script
  157. that sets few variables and in turns calls /etc/vpnc/vpnc-script script.
  158. More details in example below.
  159.  
  160.  
  161. 8. Example
  162. ==========
  163. In the following example we will consider:
  164. - Linux host (maybe valid for other UNIXes);
  165. - Nortel server (maybe works as is also with Cisco);
  166. - split tunnel to access just few hosts inside the corporate network;
  167. - hosts in corporate network have fixed IP addresses;
  168. - DNS and all other routes to internet.
  169.  
  170.  
  171. 8.1 Step 1
  172. ----------
  173.  
  174. List all the hosts you need to access in the corporate network.
  175. In the following example we will consider:
  176. - mail server, to read messages: pop3.mycom.com;
  177. - smtp server, to send messages out: smtp.mycom.com;
  178. - ldap server, to search mail accounts: ldap.mycom.com;
  179. - internet proxy, to access internal websites: proxy.mycom.com.
  180. Avoid a long list; keep security in mind and just map what you really need.
  181.  
  182.  
  183. 8.2 Step 2
  184. ----------
  185.  
  186. Resolve IP address of all the names you listed in Step 1, and put them in your
  187. local file /etc/hosts. We suppose all of them are fixed IP.
  188. Sometimes two or more servers are mapped to the same IP. Practically it is the
  189. same server that implements multiple functions. In the example below, we
  190. suppose that pop3 and smtp services are on the same server.
  191. Example of /etc/hosts:
  192. ______________________________________________________________________
  193. 127.0.0.1 localhost.localdomain localhost
  194. ::1 localhost6.localdomain6 localhost6
  195. 10.0.0.130 pop3.mycom.com smtp.mycom.com
  196. 10.0.14.1 ldap.mycom.com
  197. 10.1.0.5 proxy.mycom.com
  198. ______________________________________________________________________
  199.  
  200.  
  201. 8.3 Step 3
  202. ----------
  203.  
  204. Create a copy of your working vpnc config file:
  205. #> cp /etc/vpnc/corp.conf /etc/vpnc/split.conf
  206.  
  207.  
  208. 8.4 Step 4
  209. ----------
  210.  
  211. Edit the new file "split.conf" and add the following line:
  212. Script /etc/vpnc/vpnc-script-corp-split
  213. It will force this new configuration to use a special script file.
  214.  
  215.  
  216. 8.5 Step 5
  217. ----------
  218.  
  219. Create the file /etc/vpnc/vpnc-script-corp-split with following content
  220. ______________________________________________________________________
  221. #!/bin/sh
  222.  
  223. # Add one IP to the list of split tunnel
  224. add_ip ()
  225. {
  226. export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_ADDR=$1
  227. export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_MASK=255.255.255.255
  228. export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_MASKLEN=32
  229. export CISCO_SPLIT_INC=$(($CISCO_SPLIT_INC + 1))
  230. }
  231.  
  232. # Initialize empty split tunnel list
  233. export CISCO_SPLIT_INC=0
  234.  
  235. # Delete DNS info provided by VPN server to use internet DNS
  236. # Comment following line to use DNS beyond VPN tunnel
  237. unset INTERNAL_IP4_DNS
  238.  
  239. # List of IPs beyond VPN tunnel
  240. add_ip 10.0.0.130 # pop3.mycom.com and smtp
  241. add_ip 10.0.14.1 # ldap.mycom.com
  242. add_ip 10.1.0.5 # proxy.mycom.com
  243.  
  244. # Execute default script
  245. . /etc/vpnc/vpnc-script
  246.  
  247. # End of script
  248. ______________________________________________________________________
  249.  
  250. Parameter passed to "add_ip" is used, in /etc/vpnc/vpnc-script, to set routing
  251. table by running either "ip" or "route" command, depending on system
  252. configuration.
  253. While "route" accepts both host names and IP in the command line, "ip"
  254. strictly requires numeric IP.
  255. This is quite annoying, since would be easier using only host names in the
  256. script abobe, keeping numeric IP relations in /etc/hosts only.
  257. Eventually, could be possible improving the script above by resolving names
  258. before running /etc/vpnc/vpnc-script.
  259. The command "gethostip" could be used for name resolution. Does anybody knows
  260. if the command "gethostip" is present in every Linux distro?
  261.  
  262.  
  263. 8.6 Step 6
  264. ----------
  265.  
  266. At last, provide the proper execution permission:
  267. #> chmod 755 /etc/vpnc/vpnc-script-corp-split
  268.  
  269. That's all, folks!
  270. You can now run:
  271. #> vpnc split.conf
  272.  
  273. Reading routing table, you can verify the split is active.
  274. #> route
  275. Kernel IP routing table
  276. Destination Gateway Genmask Flags Metric Ref Use Iface
  277. proxy.mycom.com * 255.255.255.255 UH 0 0 0 tun0
  278. ldap.mycom.com * 255.255.255.255 UH 0 0 0 tun0
  279. pop3.mycom.com * 255.255.255.255 UH 0 0 0 tun0
  280. vpn.mycom.com 192.168.1.1 255.255.255.255 UGH 0 0 0 eth0
  281. 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
  282. 10.2.0.0 * 255.255.255.0 U 0 0 0 tun0
  283. 169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
  284. default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
  285.  
  286.  
  287. 9 Changelog
  288. ===========
  289.  
  290. 2009-02-28 v0.1 Antonio Borneo <borneo.antonio at gmail.com>
  291. * first version
Advertisement
Add Comment
Please, Sign In to add comment