home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LINUX / HOWTO / mini / vpn.txt < prev    next >
Text File  |  1997-07-07  |  14KB  |  399 lines

  1. The VPN HOWTO
  2. ┴rpßd Magosßnyi <mag@bunuel.tii.matav.hu>
  3. v0.1, 3 May 1997
  4.  
  5. This is the Linux VPN howto, a collection of information on how to set up a
  6. Virtual Protected Network in Linux (and other unices in general).
  7.  
  8. Table of contents:
  9.  
  10. 0. Blurb
  11. 0.0 Copyright
  12. 0.1 Disclaimer 
  13. 0.1.1 Disclaimer
  14. 0.1 State of this document
  15. 0.2 Related documentations
  16. 1. Introduction
  17. 1.1 Naming conventions
  18. 1.2 Planning 
  19. 1.3 Gathering the tools
  20. 1.4 Compile and install
  21. 2 Configure the other subsystems 
  22. 3. Set up the accounts for the VPN
  23. 3.1 create an account on the slave firewall
  24. 3.2 you might create an account on the master also
  25. 3.3 generate an ssh key for your master account
  26. 3.4 set up automatic ssh login for the slave account
  27. 3.5 Tighten ssh security on the bastions.
  28. 3.6 enable execution of ppp and route for both accounts.
  29. 3.7 do the scripting
  30. 4. look at what's happening:
  31. 5. doing it by hand.
  32. 5.1 logging in
  33. 5.2 firing up ppp
  34. 5.3 together the two
  35. 5.4 pty redirecting
  36. 5.5 is anything on the device?
  37. 5.6 setting up the routes
  38. 6. set up the additional firewalling rules.
  39. 7. vulnerability analisis
  40.  
  41.  
  42. 0. Blurb
  43.  
  44. 0.0 Copyright
  45. This document is part of the Linux HOWTO project. The copyright notice is
  46. the following:
  47.  
  48.     Unless otherwise stated, Linux HOWTO documents are copyrighted by
  49.     their respective authors. Linux HOWTO documents may be reproduced
  50.     and distributed in whole or in part, in any medium physical or
  51.     electronic, as long as this copyright notice is retained on all
  52.     copies. Commercial redistribution is allowed and encouraged;
  53.     however, the author would like to be notified of any such
  54.     distributions.
  55.  
  56.     All translations, derivative works, or aggregate works incorporating
  57.     any Linux HOWTO documents must be covered under this copyright
  58.     notice.  That is, you may not produce a derivative work from a HOWTO
  59.     and impose additional restrictions on its distribution. Exceptions
  60.     to these rules may be granted under certain conditions; please
  61.     contact the Linux HOWTO coordinator at the address given below.
  62.  
  63.     In short, we wish to promote dissemination of this information
  64.     through as many channels as possible. However, we do wish to retain
  65.     copyright on the HOWTO documents, and would like to be notified of
  66.     any plans to redistribute the HOWTOs.
  67.  
  68.     If you have questions, please contact Greg Hankins, the Linux HOWTO
  69.     coordinator, at gregh@sunsite.unc.edu via email.
  70.  
  71. 0.1 Disclaimer 
  72.     As usual: the author not responsible for any damage. For the
  73.     correct wording, see the relevant part of the GNU GPL
  74. 0.1.1 Disclaimer
  75.     We are dealing with security: you are not safe if you haven't got
  76.     good security policy, and other rather boring things.
  77.  
  78. 0.1 State of this document
  79.  
  80.     This is very preliminary. You should have thorough knowledge of
  81.     administrating IP, at least some knowledge of firewalls, ppp and
  82.     ssh. You should know them anyway if you want to set up a VPN.
  83.     I just decided to write down my experiences not to forget them.
  84.     There are possibly some security holes indeed. To be fair I've tried
  85.     it on hosts configured as routers not firewalls, saying: It's simple
  86.     from that point.
  87.  
  88. 0.2 Related documentations
  89.     - The Linux Firewall-HOWTO /usr/doc/HOWTO/Firewall-HOWTO
  90.     - The Linux PPP-HOWTO /usr/doc/HOWTO/PPP-HOWTO.gz
  91.     - The ssh documentations /usr/doc/ssh/*
  92.     - The Linux Network Admins' Guide
  93.     - NIST Computer Security Special Publications http://csrc.ncsl.nist.gov/nistpubs/
  94.     - Firewall list (majordomo@greatcircle.com)
  95.  
  96. 1. Introduction
  97.  
  98.     As firewalls are in more and more widely use in internet and
  99.     intranet security, the ability to do nice VPNs is important.
  100.     Here are my experiences. Comments are welcome.
  101.  
  102. 1.1 Naming conventions
  103.  
  104.     I will use the terms "master firewall" and "slave firewall", though
  105.     making a VPN has nothing to do with client-server architecture. I
  106.     simply refer to them as the active and passive participants of the
  107.     connection's setup. The host which is starts the setup will be
  108.     referred as the master, and the passive participant will be the
  109.     slave.
  110.  
  111. 1.2 Planning 
  112.  
  113.     Before you start to set up your system, you should know the
  114.     networking details. I assume you have two firewalls protecting one
  115.     intranet per firewall, and they are both connected to the internet.
  116.     So now you should have two network interfaces (at least) per
  117.     firewall. Take a sheet of paper, write down their IP addresses and
  118.     network mask. You will need one more IP adresses per firewall for
  119.     the VPN you want to do now. Those addresses should be outside of
  120.     your existing subnets. I suggest using addresses from the "private"
  121.     address ranges. They are the followings: 
  122.     10.0.0.0 - 10.255.255.255
  123.     172.16.0.0 - 172.31.255.255
  124.     192.168.0.0 - 192.168.255.255
  125.  
  126.     For the sake of example, here's a sample configuration:
  127.  
  128.     The two bastions are called fellini and polanski. They have one
  129.     interface for the internet (-out), one for the intranet (-in), and
  130.     one for the vpn (-vpn). The addresses and netmasks:
  131.  
  132.     fellini-out:    193.6.34.12    255.255.255.0
  133.     fellini-in:    193.6.35.12    255.255.255.0
  134.     fellini-vpn:    192.168.0.1    point-to-point
  135.  
  136.     polanski-out:    193.6.36.12    255.255.255.0
  137.     polanski-in:    193.6.37.12    255.255.255.0
  138.     polanski-vpn:    192.168.0.2    point-to-point
  139.  
  140.     So we have the plan.
  141.  
  142. 1.3 Gathering the tools
  143.     You will need a
  144.     - Linux firewall
  145.         -kernel
  146.         -very minimal configuration
  147.         -ipfwadm
  148.         -fwtk
  149.     - Tools for the VPN
  150.         - ssh
  151.         - pppd
  152.         - sudo
  153.         - pty-redir
  154.  
  155.     Current versions:
  156.  
  157.     kernel: 2.0.30. Use a stable kernel, and it must be newer than
  158.         2.0.20, because the ping'o'death bug.
  159.  
  160.     base system: I prefer Debian. YMMV. You absolutely don't want to use
  161.     any big packages, and you never even tought of using sendmail, of
  162.     course. You also definitely don't want to enable telnet, ftp, and
  163.     the 'r' commands (as usual in case of any other unix hosts).
  164.  
  165.     ipfwadm: I've used 2.3.0
  166.     fwtk:    I've used 1.3
  167.  
  168.     ssh:    >= 1.2.20. There are problems with the underlying protocol
  169.         in the older versions.
  170.  
  171.     pppd:    I've used 2.2.0f for the tests, but I'm not sure if is it
  172.         secure, this is why I turned the setuid bit off, and used
  173.         sudo to launch it.
  174.  
  175.     sudo: 1.5.2 the newest I am aware of 
  176.  
  177.     pty-redir: It is written by me. Try
  178.     ftp://ftp.vein.hu/ssa/contrib/mag/pty-redir-0.1.tar.gz. Its version
  179.     number is 0.1 now. Tell me it there is any problem with it.
  180.  
  181. 1.4 Compile and install
  182.     Compile or otherwise install the gathered tools. Look at every one's
  183.     documentation (and the firewall-howto) for details.
  184.  
  185.     Now we have the tools.
  186.  
  187. 2 Configure the other subsystems 
  188.  
  189.     Configure your firewall rules, etc. You need to enable ssh traffic
  190.     between the two firewll hosts. It means a connection to port 22 on
  191.     the slave from the master. Start sshd on the slave and verify if you
  192.     can login. This step is untested, please tell me your results.
  193.  
  194. 3. Set up the accounts for the VPN
  195. 3.1 create an account on the slave firewall
  196.     use your favourite tool (e.g. vi, mkdir, chown, chmod)
  197. 3.2 you might create an account on the master also
  198.     But I think you want to set up the connection at boot time, so your
  199.     ordinary root account will do. Can anyone point out risks on using the
  200.     root account on the master?
  201. 3.3 generate an ssh key for your master account
  202.     use the ssh-keygen program. Set empty password for the private key
  203.     if you want to do automatic setup of the VPN.
  204. 3.4 set up automatic ssh login for the slave account
  205.     copy the newly generated public key in the slave account under
  206.     .ssh/authorized_keys, and set up file permissions like the
  207.     following:
  208.     drwx------   2 slave slave          1024 Apr  7 23:49 ./
  209.     drwx------   4 slave slave          1024 Apr 24 14:05 ../
  210.     -rwx------   1 slave slave           328 Apr  7 03:04 authorized_keys
  211.     -rw-------   1 slave slave           660 Apr 14 15:23 known_hosts
  212.     -rw-------   1 slave slave           512 Apr 21 10:03 random_seed
  213.     The first row being ~slave/.ssh, and the second is ~slave.
  214.  
  215. 3.5 Tighten ssh security on the bastions.
  216.     It means the followings on my setup in sshd_conf:
  217.     PermitRootLogin no
  218.     IgnoreRhosts yes
  219.     StrictModes yes
  220.     QuietMode no
  221.     FascistLogging yes
  222.     KeepAlive yes
  223.     RhostsAuthentication no
  224.     RhostsRSAAuthentication no
  225.     RSAAuthentication yes
  226.     PasswordAuthentication no
  227.     PermitEmptyPasswords no
  228.  
  229.     Password authentication is turned off, so login is only poss