![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Ubuntu 9.10 is out!!!
When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu. The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely. |
|
Networking & Wireless Having problems getting connected to the internet or getting your wireless card to work? Ask here. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Gee! These Aren't Roasted!
![]() Join Date: Apr 2005
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
|
Concise OpenVPN installation. . .?
Hi All,
My apologies for posting such a question when there is a plethora of information available, but I need something much more concise if possible. A client of mine just had a meltdown of their Win 2K3 VPN server -- they're starting from scratch and they're *very* open to Linux and especially OpenVPN. That said, I need a *Linux Based* OpenVPN instructional/tutorial that is both concise and accurate. Does such exist? Thus far, I've encountered and gathered a great quantity of excellent information about OpenVPN, but nothing less than about 30 pages. My requirements are simple. I need the functional equivalent of their old PPTP server. Now, I don't necessarily want to set up a PPTP server, but I *do* want as many of the capabilities that came along with it as possible. Most importantly, I need outside computers to behave as though they are *on* the network with little to no interference, so I'm guessing I'll need a bridged setup. Also, I'd like Username/Password authentication as opposed to shared keys. My client isn't interested in having to provide keys for each login. Anyway, all that said, I'd appreciate some amazingly concise direction on setting up a bridged OpenVPN server on Linux. As a sidenote, their server hardware is as follows: HP ML350 G5 Server (Quad-core Xeon) 9 GB DDR2 250GB Raid1 Best Regards! Last edited by michwill; May 29th, 2008 at 04:17 PM.. |
|
|
|
|
|
#2 |
|
Grande Half-n-Half Cinnamon Ubuntu
![]() Join Date: Apr 2007
Location: Germany
Beans: 947
Ubuntu 9.04 Jaunty Jackalope
|
Re: Concise OpenVPN installation. . .?
mhm... have you had a look at this howto yet ? that pretty much explains on how to do the job. But then i've been doing this so often i tend to forget how overwhelming OpenVPN can be to people...
But in general - i don't think there is a tutorial on how to do this in less than 30 pages, because openvpn is way to complex and has way too many options and tweaks to possibly fit it in anything under 100 pages. Not if you want to really understand what is going on. i'll just throw some bones now, and i can provide sample configurations and commands on how to manage openvpn server (I acctually earn money with these things) 1.) routing of subnets. Openvpn can be bridged or tunneld. I personally perfer the tunnels way, as it puts the clients into their own ip subnet and does not mess with the real network the server is attached to. Of course, that is a little harder to setup, as you do need ip_forwarding as well as some (basic) route settings and possibly nat to make it work. But it does work, and it does work without briding ! As an example think of the openvpn clients to have their own swicth (the openvpn process) with their own ip's and subnets. So the OpenVPN server can be thought of as to be only a router... really. Also, it is possible to redreict all traffic via the VPN, or only specific networks/ip-ranges that are to be used. For example, i have setup multiple VPN's that only set the routes for the internal networks on the client, and leave the rest to the client. You probably want to read about the --redirect-gateway vs. push "route ip/mask" commands to understand what is happening here. 2.) Authentification OpenVPN can authenticate against any and everything. Build in modules are for a normal PKI strucutre with or without password for the client certificates. But it also works against PAM (Plugable Authentification Modules ?) as well as LDAP and a lot of others. And if all fails, OpenVPN has a hook for auth scripts that you can write yourself ! So if you really want to, you can even authenticate against a textfile... 3.) ports This is a real beauty. OpenVPN uses ONE port - and one only. It work on UDP and TCP and has no other requirement. Just one Port. No GRE protocoll, no special port 500 ********. Just one Port. (i think you got the point now 4.) your server is more than enough. I've ran OpenVPN server on P-II pro with 128 mbyte ram with more than 60 clients. It's not the fastest, but the users didn't notice that. Altought, on a small machine like that, i never did redirect ALL traffic over it. So, i am sorry for not being able to point you to a more... specific howto, but wrote an advertisment post instead - but i just love openvpn. It's simple, it's powerfull and it is slim. If you have any specific question about how to setup, or if you get stuck anywhere, just ask. hope it helps
__________________
Calvin: I'm being educated against my will! My rights are being trampled! Hobbes: Is it a right to remain ignorant? Calvin: I don't know, but I refuse to find out! |
|
|
|
|
|
#3 | |
|
Gee! These Aren't Roasted!
![]() Join Date: Apr 2005
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
|
Re: Concise OpenVPN installation. . .?
Quote:
I just need a 10-line 10-step tutorial. |
|
|
|
|
|
|
#4 |
|
Grande Half-n-Half Cinnamon Ubuntu
![]() Join Date: Apr 2007
Location: Germany
Beans: 947
Ubuntu 9.04 Jaunty Jackalope
|
Re: Concise OpenVPN installation. . .?
here we go... let's see if i can compact it into 10 steps
NOTE: all commands run as root. i will skip the sudo everywhere. To fully become root, use Code:
sudo su copy the easy-rsa from /usr/share/doc/openvpn/examples/easy-rsa/the examples into the /etc/openvpn/easy-rsa folder. Code:
cp -R /usr/share/doc/openvpn/examples/easy-rsa /ect/openvpn The settings in that file are the defaults. once that is done, load the file with this command Code:
source vars 2.) creating the keys first, let the scripts inititialize the enviroment (all commands run in the directory /etc/openvpn/easy-rsa) : Code:
./clean-all Code:
./build-dh Code:
./build-ca Code:
./build-server %name 3.) configuring the server here is a sample config of a server that (should) work. create a file in /etc/openvpn calles vpn1.conf (the vpn1 can be changed to anything, really, stick with the .conf tho - that IS needed): Code:
daemon port 1194 proto udp dev tun0 ca /etc/openvpn/easy-rsa/keys/ca.crt cert /etc/openvpn/easy-rsa/keys/server.crt key /etc/openvpn/easy-rsa/keys/server.key dh /etc/openvpn/dh2048.pem server 10.20.30.0 255.255.255.0 ifconfig-pool-persist openvpn.dhcp keepalive 10 120 comp-lzo user nobody group nogroup persist-key persist-tun status /var/log/openvpn/openvpn-status.log log-append /var/log/openvpn/openvpn.log verb 4 mute 20 ;push "route 192.168.0.0 255.255.255.0" ;push "route 192.168.173.0 255.255.255.0" ;push "redirect-gateway def1" ;client-config-dir ccd ;route 192.168.40.128 255.255.255.248 ;client-to-client ; max-clients 10 # plugin /usr/lib/openvpn/openvpn-auth-pam.so common-auth # client-cert-not-required # username-as-common-name lastly, make sure the log directory exists and it is owned by nobody. Othewise, openvpn will fail to write to it's log and will fail to start. So, create the directory and chown it with these comands: Code:
mkdir /var/log/openvpn chown nobody.nogroup /var/log/openvpn All set, the server should come up fine now... start it with this command: Code:
/etc/init.d/openvpn start vpn1 5.) allowing passthrough traffic on the VPN server This is a very tricky point. Since i could write about a book here too, i will just assume some default settings and hope they (kind of) fit your environment. enable ip_forwarding: Code:
sysctl -w net.ipv4.ip_forward=1 Also, masquerade the traffic that leaves the machine, so the pakets can find their way back (this is the *easiest* solution, it is by far not the best !): Code:
iptables -A POSTROUTING --tabe nat -o ! tun0 -j MASQUERADE Code:
/sbin/iptables -A POSTROUTING --tabe nat -o ! tun0 -j MASQUERADE 6.) client certificates every client needs it's own certificate. you can generate them the same way you have done all the other generation if certificates. go into the the /etc/openvpn/easy-rsa folder, make sure you run the source vars (if this is a new console) and then type Code:
./build-client %client 7.) Windows XP Clients Download the openvpn-gui from http://openvpn.se/ and install it. Then open the config folder (usually C:\programm files\OpenVPN\config) and create a file with the ovpn extension. this is also a normal textfile. fill it up with this sample configuration: Code:
float client dev tun proto udp remote %vpn-server ;redirect-gateway resolv-retry infinite nobind persist-key persist-tun ca ..\\cert\\ca.crt cert ..\\cert\\client.crt key ..\\cert\\client.key ns-cert-type server comp-lzo verb 3 ;mute 20 Also, as you can see, the client needs three files from the server (all found in /etc/openvpn/easy-rsa/keys) - the ca.crt, it's own certificate and its own key. Make sure it's got it. NOTE: Vista clients need a small change in the config as well as a way to start the openvpn-gui as administrator and not unprivilegdes user. I have yet to find a way to do this without problems... Now, after the config is created, the files are copied and the openvpn-gui is loaded, tell it to connect. If your firewall is not blocking anything, this should work and you should be able to connect to the server. Once that is done, the client should be able to ping the 10.20.30.1 (if you kept my subnet) and the server should be able to ping the 10.20.30.6 that's pretty much the simplest, shortest way of doing this i can think of. i hope it works, and if it does i will turn this into a howto and paste it in a new thread on this forum. If anything fails or any questions arise, just ask PS: only took me seven steps
__________________
Calvin: I'm being educated against my will! My rights are being trampled! Hobbes: Is it a right to remain ignorant? Calvin: I don't know, but I refuse to find out! |
|
|
|
|
|
#5 |
|
Gee! These Aren't Roasted!
![]() Join Date: Apr 2005
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
|
Re: Concise OpenVPN installation. . .?
First and foremost: WOW! I appreciate all that. I haven't had time to try it yet, but hopefully I will have by 5 pm EST today.
That said, after glancing over this, it seems to be missing reference to two things: 1) Password authentication (key distribution is kinda out of the question as it's not sufficiently "agile") . . .again, WOW! and thank you. |
|
|
|
|
|
#6 | ||
|
Grande Half-n-Half Cinnamon Ubuntu
![]() Join Date: Apr 2007
Location: Germany
Beans: 947
Ubuntu 9.04 Jaunty Jackalope
|
Re: Concise OpenVPN installation. . .?
Quote:
Code:
# plugin /usr/lib/openvpn/openvpn-auth-pam.so common-auth # client-cert-not-required # username-as-common-name On the client side, the following lines are cancelled: Code:
cert ..\\cert\\client.crt key ..\\cert\\client.key if you do not want to authenticate against PAM, then i can also provide a sample script to authenticate against plain text files. btw: this example is taken from a server that has ldap integreated into pam - so the real auth is against LDAP via PAM. Quote:
i'd strongly advise against briding if you do not need the layer 2 support (i.e. if you need broadcasts for "lan" games or protocolls like IPX to run, then you will need briding) in favor of saving bandwidth and increasing the performance. Stick with IP based routing for as long as you can - at least that is my motto. Also, i have written a howto on ethernet network bridging. I think the bridge configuration in my case is more sufficient and closer to the operating system than the scripts mentioned in the tutorial... but that is only my opinion about my work. The thread can be found here - you are probably interested in part 2 if you want to do bridging.
__________________
Calvin: I'm being educated against my will! My rights are being trampled! Hobbes: Is it a right to remain ignorant? Calvin: I don't know, but I refuse to find out! |
||
|
|
|
|
|
#7 | |
|
Gee! These Aren't Roasted!
![]() Join Date: Apr 2005
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
|
Re: Concise OpenVPN installation. . .?
Quote:
Well, the thing is, we need all logged-in clients to be *on the network*. Initially they will only need to access "internal" web pages. However, eventually (meaning before the end of summer), they will need to access network resources like printers, other computers via VNC, and file (with the likelihood of music) sharing across the "office". For all intents and purposes they need to be verifiably *on* the network. What capabilities does routing alone provide? |
|
|
|
|
|
|
#8 |
|
Grande Half-n-Half Cinnamon Ubuntu
![]() Join Date: Apr 2007
Location: Germany
Beans: 947
Ubuntu 9.04 Jaunty Jackalope
|
Re: Concise OpenVPN installation. . .?
routing can do anything that requires an IP connection. Accessing shares, printing via IP or vnc is not a problem (as long as it runs on ip and not any other protocoll).
With "on the network" you just mean access to the internal networks - that is NOT a problem... at all. hope it helps
__________________
Calvin: I'm being educated against my will! My rights are being trampled! Hobbes: Is it a right to remain ignorant? Calvin: I don't know, but I refuse to find out! |
|
|
|
|
|
#9 |
|
Gee! These Aren't Roasted!
![]() Join Date: Apr 2005
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
|
Re: Concise OpenVPN installation. . .?
Excellent! I'll actually end up setting this up over the weekend. One more question: given that my client will likely want to be able to manage this setup without having to call me every week, he's going to want some type of interface. Are there any quality graphical interfaces (web-based or otherwise) for managing OpenVPN?
Thanks again btw! |
|
|
|
|
|
#10 |
|
Grande Half-n-Half Cinnamon Ubuntu
![]() Join Date: Apr 2007
Location: Germany
Beans: 947
Ubuntu 9.04 Jaunty Jackalope
|
Re: Concise OpenVPN installation. . .?
i only know of a management for the PKI based VPN - that one has a webmin module which is not really finished yet, but works good enough for the guys i installed the VPNs for. The module can be found here.
how that works for non PKI structures i don't know, since then you need some kind of management tool for either the useraccounts on the machine itself, or something that will edit your OpenVPN useraccount. The only other management i have worked with as a domino 6.5.3 server which has an LDAP backend that is used by PAM to authenticate local users. OpenVPN then authenticated against PAM, this against LDAP and therefore against domino 6.5.3.
__________________
Calvin: I'm being educated against my will! My rights are being trampled! Hobbes: Is it a right to remain ignorant? Calvin: I don't know, but I refuse to find out! |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|