[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:misc:openvpn [2013/01/14 20:40 (UTC)] – [Using OpenVPN with automatic password input] comfreehowtos:security:openvpn [2013/01/23 00:28 (UTC)] (current) – [Using OpenVPN with the i3wm] comfree
Line 1: Line 1:
 <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). -->
 ====== OpenVPN ====== ====== OpenVPN ======
- 
-=============== Wikipedia about OpenVPN ============ 
  
 OpenVPN is an open source software application that implements virtual private network (VPN) techniques for creating secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It uses a custom security protocol that utilizes SSL/TLS for key exchange. It is capable of traversing network address translators (NATs) and firewalls. It was written by James Yonan and is published under the GNU General Public License (GPL). OpenVPN is an open source software application that implements virtual private network (VPN) techniques for creating secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It uses a custom security protocol that utilizes SSL/TLS for key exchange. It is capable of traversing network address translators (NATs) and firewalls. It was written by James Yonan and is published under the GNU General Public License (GPL).
Line 9: Line 7:
 ===== How to use OpenVPN ===== ===== How to use OpenVPN =====
  
-It's barely simple if you already got a ready-to-go config by any openvpn provider. 
  
 +It's very simple if you already got a ready-to-go config by any openvpn provider.
 <code> <code>
-openvpn --config yourconfig.ovpn+openvpn --config yourconfig.ovpn
 </code> </code>
  
 +If you don't have a config that you can use you should have a look in /etc/openvpn. Slackware has a example config with some good hints in there.
  
 +==== Using OpenVPN with the i3 status bar ====
  
 +I'm using the [[howtos:window_managers:i3wm|i3 window manager]] with dmenu and the i3statusbar. You can configure the bar to show you if you're running openvpn or not.
 +The i3status.conf lies in /etc/ if installed with the SlackBuild.
  
-If you don't get a config that you can use you should have a look at /etc/openvpn. +You have to start openvpn with an additional --writepid /path/to/your.pid.
-Slackware got a example config with some good hints in there.+
  
-===== Using OpenVPN with automatic password input =====+For example:
  
-Since I wanted to use my openvpn connection to start automatically when I put my Thinkpad into the dock I thought it would be usefull to add the 'password safe' feature. +<code> 
-That feature is not added by default on Slackwares package. You have to add it to the slackbuild and recompile the package.+openvpn --config /etc/openvpn/vpn.ovpn --writepid /var/run/pid/openvpn.pid 
 +</code> 
 + 
 +To use the build in feature you have to edit the config file. 
 +Look for the 
 +<code> 
 +run_watch VPN { 
 +        pidfile = "/var/run/something.pid" 
 +}</code> 
 + 
 +block and change the something into your choosen pid name.  
 +In this case: 
 + 
 +<code> 
 +run_watch VPN 
 +        pidfile = "/var/run/openvpn.pid" 
 +
 +</code> 
 + 
 + 
 +===== Rebuilding OpenVPN to read your login from file ===== 
 +Since I wanted my openvpn connection to start automatically when I connect my Thinkpad to the dock I thought it would be usefull to add the 'password safe' feature. ('password safe' setting allows you to store your username and password in a file for scripting) This feature is not installed by default. You have to add it to the slackbuild and recompile the package.
  
-Start with grabbing the source and slackbuild from one of the Slackware mirrors.+Start by grabbing the source and slackbuild from one of the Slackware mirrors.
  
 [[http://mirrors.slackware.com/slackware/slackware64-14.0/source/n/openvpn/]] [[http://mirrors.slackware.com/slackware/slackware64-14.0/source/n/openvpn/]]
Line 32: Line 54:
 Change the mirror for your needs, for example -current. Change the mirror for your needs, for example -current.
  
-In the next step we will change the openvpn.Slackbuild file.+In the next step we will change the openvpn.SlackBuild file.
  
-<code> +Open the slackbuild file with you editor of choice. 
-vim openvpn.Slackbuild + 
-</code>+For vim do: 
 + 
 +<code>vim openvpn.SlackBuild</code>
  
 Now look for this block of code: Now look for this block of code:
Line 65: Line 89:
 </code> </code>
  
-Save the file and rebuild the package with+Save the file, make it executable and rebuild the package with
  
-<code>./openvpn.Slackbuild</code>+<code>$ chmod +x openvpn.SlackBuild && ./openvpn.SlackBuild</code>
  
 The new package should be in the /tmp directory. The new package should be in the /tmp directory.
Line 73: Line 97:
 Install it with: Install it with:
  
-<code>upgradepkg --install-new /tmp/yourpackage.tgz</code>+<code>upgradepkg --install-new /tmp/yourpackage.tgz</code>
  
 +Now you are able to load your login and password from a file.
 +The file should contain two lines of text:
  
 +<code>
 +username
 +password
 +</code>
 +
 +
 +Save the file and make it only readable for the owner.
 +<code>$ chmod 700 yourfile</code>
 +
 +Lastly add the line below to your openvpn config.
 +<code>auth-user-pass /path/to/your/passwordfile</code>
 +Now you should be able to login without typing your password everytime.
  
  
Line 87: Line 125:
 <!-- * Originally written by [[wiki:user:xxx | User X]] --> <!-- * Originally written by [[wiki:user:xxx | User X]] -->
 <!-- * Contributions by [[wiki:user:yyy | User Y]] --> <!-- * Contributions by [[wiki:user:yyy | User Y]] -->
 +  * Wikipedia: [[http://en.wikipedia.org/wiki/Openvpn]] 
 +  * Originally written by [[wiki:user:comfree | comfree]]
 <!-- Please do not modify anything below, except adding new tags.--> <!-- Please do not modify anything below, except adding new tags.-->
 <!-- You must remove the tag-word "template" below before saving your new page --> <!-- You must remove the tag-word "template" below before saving your new page -->
-{{tag>howtos template}}+{{tag>howtos openvpn slackbuild security}} 
 howtos:security:openvpn ()