<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>:: HawkEYE Expression :: &#187; howto</title>
	<atom:link href="http://blog.namran.net/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.namran.net</link>
	<description>R35p3c7 7h3 !n7311!93n7,h31p wh0 c4n’7 4ff02d….        [blog.namran.net]</description>
	<lastBuildDate>Thu, 29 Jul 2010 05:36:03 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing and configuring OpenVPN server in CentOS 5.4</title>
		<link>http://blog.namran.net/2010/02/08/installing-and-configuring-openvpn-server-in-centos-5-4/</link>
		<comments>http://blog.namran.net/2010/02/08/installing-and-configuring-openvpn-server-in-centos-5-4/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 16:53:12 +0000</pubDate>
		<dc:creator>namran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://blog.namran.net/?p=3299</guid>
		<description><![CDATA[First assuming you already had rpmforge yum repos.
Just need to get open rpm installed..

 yum install openvpn -y

Now start configure it :
get into the OpenVPN configuration folder

  cd /etc/openvpn/

Generate the secret key at the server ..
(this file shall be transferred to each client too..)

 openvpn --genkey --secret ta.key

Now get the rest of cert and [...]

<div class="post-fixed">
Related posts:<ol><li><a href='http://blog.namran.net/2009/11/12/setting-up-multiple-ssh-key-for-different-machine/' rel='bookmark' title='Permanent Link: Setting Up multiple SSH key for different machine'>Setting Up multiple SSH key for different machine</a></li><li><a href='http://blog.namran.net/2009/02/14/installing-nagios-3-in-centos-52/' rel='bookmark' title='Permanent Link: Installing Nagios 3 in CentOS 5.2'>Installing Nagios 3 in CentOS 5.2</a></li><li><a href='http://blog.namran.net/2009/03/09/installing-windows-xp-on-xen-virtualization-in-centos-5/' rel='bookmark' title='Permanent Link: Installing windows XP on XEN virtualization in CentOS 5'>Installing windows XP on XEN virtualization in CentOS 5</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>First assuming you already had rpmforge yum repos.<br />
Just need to get open rpm installed..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> yum <span style="color: #c20cb9; font-weight: bold;">install</span> openvpn <span style="color: #660033;">-y</span></pre></div></div>

<p>Now start configure it :<br />
get into the OpenVPN configuration folder</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Generate the secret key at the server ..<br />
(this file shall be transferred to each client too..)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> openvpn <span style="color: #660033;">--genkey</span> <span style="color: #660033;">--secret</span> ta.key</pre></div></div>

<p>Now get the rest of cert and generate appropriate keys/pair.<br />
The tools are provided under the following directory</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>openvpn-2.0.9<span style="color: #000000; font-weight: bold;">/</span>easy-rsa<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>make all the script there it executable ..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #c20cb9; font-weight: bold;">chmod</span> a+x <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>Prepare the output keys folder</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> keys
  .<span style="color: #000000; font-weight: bold;">/</span>vars</pre></div></div>

<p>Clean it up..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> .<span style="color: #000000; font-weight: bold;">/</span>clean-all</pre></div></div>

<p>Start building server key first ..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> .<span style="color: #000000; font-weight: bold;">/</span>build-ca
.<span style="color: #000000; font-weight: bold;">/</span>build-key-server home.namran.net</pre></div></div>

<p>Okay .. now try to add a client cert to it..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> .<span style="color: #000000; font-weight: bold;">/</span>build-key nbnamran</pre></div></div>

<p>Some encryption/decipher thing..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> .<span style="color: #000000; font-weight: bold;">/</span>build-dh</pre></div></div>

<p>Now copied the generated keys/cert into openvpn configuration folder.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>openvpn-2.0.9<span style="color: #000000; font-weight: bold;">/</span>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Time to config the configuration file ..<br />
<span id="more-3299"></span><br />
<script type="text/javascript"><!--
google_ad_client = "pub-0486192213670544";
google_ad_slot = "0715863013";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn</pre></div></div>

<p>Let&#8217;s just copy from sample first ..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>openvpn-2.0.9<span style="color: #000000; font-weight: bold;">/</span>sample-config-files<span style="color: #000000; font-weight: bold;">/</span>server.conf .</pre></div></div>

<p>Edit it ..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #c20cb9; font-weight: bold;">vi</span> server.conf</pre></div></div>

<p>.. so that it become something like this :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-up</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>openvpn-2.0.9<span style="color: #000000; font-weight: bold;">/</span>sample-config-files<span style="color: #000000; font-weight: bold;">/</span>server.conf <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>server.conf 
<span style="color: #660033;">---</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>openvpn-2.0.9<span style="color: #000000; font-weight: bold;">/</span>sample-config-files<span style="color: #000000; font-weight: bold;">/</span>server.conf        <span style="color: #000000;">2006</span>-01-07 05:<span style="color: #000000;">49</span>:<span style="color: #000000;">27.000000000</span> +0800
+++ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>server.conf    <span style="color: #000000;">2010</span>-02-01 <span style="color: #000000;">21</span>:<span style="color: #000000;">10</span>:<span style="color: #000000;">48.000000000</span> +0800
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">32</span>,<span style="color: #000000;">8</span> +<span style="color: #000000;">32</span>,<span style="color: #000000;">8</span> <span style="color: #000000; font-weight: bold;">@@</span>
 port <span style="color: #000000;">1194</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># TCP or UDP server?</span>
-;proto tcp
<span style="color: #660033;">-proto</span> udp
+proto tcp
+;proto udp
&nbsp;
 <span style="color: #666666; font-style: italic;"># &quot;dev tun&quot; will create a routed IP tunnel,</span>
 <span style="color: #666666; font-style: italic;"># &quot;dev tap&quot; will create an ethernet tunnel.</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">75</span>,<span style="color: #000000;">16</span> +<span style="color: #000000;">75</span>,<span style="color: #000000;">16</span> <span style="color: #000000; font-weight: bold;">@@</span> dev tun
 <span style="color: #666666; font-style: italic;"># Any X509 key management system can be used.</span>
 <span style="color: #666666; font-style: italic;"># OpenVPN can also use a PKCS #12 formatted key file</span>
 <span style="color: #666666; font-style: italic;"># (see &quot;pkcs12&quot; directive in man page).</span>
<span style="color: #660033;">-ca</span> ca.crt
<span style="color: #660033;">-cert</span> server.crt
<span style="color: #660033;">-key</span> server.key  <span style="color: #666666; font-style: italic;"># This file should be kept secret</span>
+ca <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>ca.crt
+cert <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>home.namran.net.crt
+key <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>home.namran.net.key  <span style="color: #666666; font-style: italic;"># This file should be kept secret</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># Diffie hellman parameters.</span>
 <span style="color: #666666; font-style: italic;"># Generate your own with:</span>
 <span style="color: #666666; font-style: italic;">#   openssl dhparam -out dh1024.pem 1024</span>
 <span style="color: #666666; font-style: italic;"># Substitute 2048 for 1024 if you are using</span>
 <span style="color: #666666; font-style: italic;"># 2048 bit keys. </span>
<span style="color: #660033;">-dh</span> dh1024.pem
+dh <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>dh1024.pem
&nbsp;
 <span style="color: #666666; font-style: italic;"># Configure server mode and supply a VPN subnet</span>
 <span style="color: #666666; font-style: italic;"># for OpenVPN to draw client addresses from.</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">93</span>,<span style="color: #000000;">14</span> +<span style="color: #000000;">93</span>,<span style="color: #000000;">14</span> <span style="color: #000000; font-weight: bold;">@@</span> dh dh1024.pem
 <span style="color: #666666; font-style: italic;"># Each client will be able to reach the server</span>
 <span style="color: #666666; font-style: italic;"># on 10.8.0.1. Comment this line out if you are</span>
 <span style="color: #666666; font-style: italic;"># ethernet bridging. See the man page for more info.</span>
<span style="color: #660033;">-server</span> 10.8.0.0 255.255.255.0
+server 192.168.144.0 255.255.255.0
&nbsp;
 <span style="color: #666666; font-style: italic;"># Maintain a record of client &lt;-&gt; virtual IP address</span>
 <span style="color: #666666; font-style: italic;"># associations in this file.  If OpenVPN goes down or</span>
 <span style="color: #666666; font-style: italic;"># is restarted, reconnecting clients can be assigned</span>
 <span style="color: #666666; font-style: italic;"># the same virtual IP address from the pool that was</span>
 <span style="color: #666666; font-style: italic;"># previously assigned.</span>
<span style="color: #660033;">-ifconfig-pool-persist</span> ipp.txt
+ifconfig-pool-persist <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>ipp.txt
&nbsp;
 <span style="color: #666666; font-style: italic;"># Configure server mode for ethernet bridging.</span>
 <span style="color: #666666; font-style: italic;"># You must first use your OS's bridging capability</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">121</span>,<span style="color: #000000;">7</span> +<span style="color: #000000;">121</span>,<span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">@@</span> ifconfig-pool-persist ipp.txt
 <span style="color: #666666; font-style: italic;"># to know to route the OpenVPN client</span>
 <span style="color: #666666; font-style: italic;"># address pool (10.8.0.0/255.255.255.0)</span>
 <span style="color: #666666; font-style: italic;"># back to the OpenVPN server.</span>
-;push <span style="color: #ff0000;">&quot;route 192.168.10.0 255.255.255.0&quot;</span>
+push <span style="color: #ff0000;">&quot;route 192.168.133.0 255.255.255.0&quot;</span>
 ;push <span style="color: #ff0000;">&quot;route 192.168.20.0 255.255.255.0&quot;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># To assign specific IP addresses to specific</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">193</span>,<span style="color: #000000;">7</span> +<span style="color: #000000;">193</span>,<span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">@@</span> ifconfig-pool-persist ipp.txt
 <span style="color: #666666; font-style: italic;"># To force clients to only see the server, you</span>
 <span style="color: #666666; font-style: italic;"># will also need to appropriately firewall the</span>
 <span style="color: #666666; font-style: italic;"># server's TUN/TAP interface.</span>
-;client-to-client
+client-to-client
&nbsp;
 <span style="color: #666666; font-style: italic;"># Uncomment this directive if multiple clients</span>
 <span style="color: #666666; font-style: italic;"># might connect with the same certificate/key</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">206</span>,<span style="color: #000000;">7</span> +<span style="color: #000000;">206</span>,<span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">@@</span> ifconfig-pool-persist ipp.txt
 <span style="color: #666666; font-style: italic;"># CERTIFICATE/KEY PAIRS FOR EACH CLIENT,</span>
 <span style="color: #666666; font-style: italic;"># EACH HAVING ITS OWN UNIQUE &quot;COMMON NAME&quot;,</span>
 <span style="color: #666666; font-style: italic;"># UNCOMMENT THIS LINE OUT.</span>
-;duplicate-cn
+duplicate-cn
&nbsp;
 <span style="color: #666666; font-style: italic;"># The keepalive directive causes ping-like</span>
 <span style="color: #666666; font-style: italic;"># messages to be sent back and forth over</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">228</span>,<span style="color: #000000;">7</span> +<span style="color: #000000;">228</span>,<span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">@@</span> keepalive <span style="color: #000000;">10</span> <span style="color: #000000;">120</span>
 <span style="color: #666666; font-style: italic;"># a copy of this key.</span>
 <span style="color: #666666; font-style: italic;"># The second parameter should be '0'</span>
 <span style="color: #666666; font-style: italic;"># on the server and '1' on the clients.</span>
-;tls-auth ta.key <span style="color: #000000;">0</span> <span style="color: #666666; font-style: italic;"># This file is secret</span>
+tls-auth <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>ta.key <span style="color: #000000;">0</span> <span style="color: #666666; font-style: italic;"># This file is secret</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># Select a cryptographic cipher.</span>
 <span style="color: #666666; font-style: italic;"># This config item must be copied to</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">251</span>,<span style="color: #000000;">8</span> +<span style="color: #000000;">251</span>,<span style="color: #000000;">8</span> <span style="color: #000000; font-weight: bold;">@@</span> comp-lzo
 <span style="color: #666666; font-style: italic;">#</span>
 <span style="color: #666666; font-style: italic;"># You can uncomment this out on</span>
 <span style="color: #666666; font-style: italic;"># non-Windows systems.</span>
-;user nobody
-;group nobody
+user nobody
+group nobody
&nbsp;
 <span style="color: #666666; font-style: italic;"># The persist options will try to avoid</span>
 <span style="color: #666666; font-style: italic;"># accessing certain resources on restart</span>
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">264</span>,<span style="color: #000000;">7</span> +<span style="color: #000000;">264</span>,<span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">@@</span> persist-tun
 <span style="color: #666666; font-style: italic;"># Output a short status file showing</span>
 <span style="color: #666666; font-style: italic;"># current connections, truncated</span>
 <span style="color: #666666; font-style: italic;"># and rewritten every minute.</span>
<span style="color: #660033;">-status</span> openvpn-status.log
+status <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>openvpn-status.log
&nbsp;
 <span style="color: #666666; font-style: italic;"># By default, log messages will go to the syslog (or</span>
 <span style="color: #666666; font-style: italic;"># on Windows, if running as a service, they will go to</span></pre></div></div>

<p>Start the openvpn server services :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  service openvpn start</pre></div></div>

<p>setup the client and then Monitor the incoming connection..</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>messages</pre></div></div>

<p>&#8230; ops.. firewall might need to open the port accordingly first!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>arno-iptables-firewall<span style="color: #000000; font-weight: bold;">/</span>firewall.conf
  <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>arno-iptables-firewall restart</pre></div></div>

<p>.. the client preparation is as below :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>openvpn-2.0.9<span style="color: #000000; font-weight: bold;">/</span>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>nbnamran.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>namran<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>vpn
  <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>openvpn-2.0.9<span style="color: #000000; font-weight: bold;">/</span>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>ca.crt <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>namran<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>vpn
&nbsp;
&nbsp;
  <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>ta.key <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>namran<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>vpn
  <span style="color: #c20cb9; font-weight: bold;">chown</span> namran:namran <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>namran<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>vpn<span style="color: #000000; font-weight: bold;">/</span>nbnamran.<span style="color: #000000; font-weight: bold;">*</span>
  <span style="color: #c20cb9; font-weight: bold;">chown</span> namran:namran <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>namran<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>vpn<span style="color: #000000; font-weight: bold;">/</span>ta.key</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>namran<span style="color: #000000; font-weight: bold;">@</span>nb-namran openvpn<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">cat</span> client.ovpn 
<span style="color: #666666; font-style: italic;">##############################################</span>
<span style="color: #666666; font-style: italic;"># Sample client-side OpenVPN 2.0 config file #</span>
<span style="color: #666666; font-style: italic;"># for connecting to multi-client server.     #</span>
<span style="color: #666666; font-style: italic;">#                                            #</span>
<span style="color: #666666; font-style: italic;"># This configuration can be used by multiple #</span>
<span style="color: #666666; font-style: italic;"># clients, however each client should have   #</span>
<span style="color: #666666; font-style: italic;"># its own cert and key files.                #</span>
<span style="color: #666666; font-style: italic;">#                                            #</span>
<span style="color: #666666; font-style: italic;"># On Windows, you might want to rename this  #</span>
<span style="color: #666666; font-style: italic;"># file so it has a .ovpn extension           #</span>
<span style="color: #666666; font-style: italic;">##############################################</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Specify that we are a client and that we</span>
<span style="color: #666666; font-style: italic;"># will be pulling certain config file directives</span>
<span style="color: #666666; font-style: italic;"># from the server.</span>
client
&nbsp;
<span style="color: #666666; font-style: italic;"># Use the same setting as you are using on</span>
<span style="color: #666666; font-style: italic;"># the server.</span>
<span style="color: #666666; font-style: italic;"># On most systems, the VPN will not function</span>
<span style="color: #666666; font-style: italic;"># unless you partially or fully disable</span>
<span style="color: #666666; font-style: italic;"># the firewall for the TUN/TAP interface.</span>
;dev tap
dev tun
&nbsp;
<span style="color: #666666; font-style: italic;"># Windows needs the TAP-Win32 adapter name</span>
<span style="color: #666666; font-style: italic;"># from the Network Connections panel</span>
<span style="color: #666666; font-style: italic;"># if you have more than one.  On XP SP2,</span>
<span style="color: #666666; font-style: italic;"># you may need to disable the firewall</span>
<span style="color: #666666; font-style: italic;"># for the TAP adapter.</span>
;dev-node MyTap
&nbsp;
<span style="color: #666666; font-style: italic;"># Are we connecting to a TCP or</span>
<span style="color: #666666; font-style: italic;"># UDP server?  Use the same setting as</span>
<span style="color: #666666; font-style: italic;"># on the server.</span>
proto tcp
;proto udp
&nbsp;
<span style="color: #666666; font-style: italic;"># The hostname/IP and port of the server.</span>
<span style="color: #666666; font-style: italic;"># You can have multiple remote entries</span>
<span style="color: #666666; font-style: italic;"># to load balance between the servers.</span>
remote home.namran.net <span style="color: #000000;">1194</span>
;remote my-server-<span style="color: #000000;">2</span> <span style="color: #000000;">1194</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Choose a random host from the remote</span>
<span style="color: #666666; font-style: italic;"># list for load-balancing.  Otherwise</span>
<span style="color: #666666; font-style: italic;"># try hosts in the order specified.</span>
;remote-random
&nbsp;
<span style="color: #666666; font-style: italic;"># Keep trying indefinitely to resolve the</span>
<span style="color: #666666; font-style: italic;"># host name of the OpenVPN server.  Very useful</span>
<span style="color: #666666; font-style: italic;"># on machines which are not permanently connected</span>
<span style="color: #666666; font-style: italic;"># to the internet such as laptops.</span>
resolv-retry infinite
&nbsp;
<span style="color: #666666; font-style: italic;"># Most clients don't need to bind to</span>
<span style="color: #666666; font-style: italic;"># a specific local port number.</span>
nobind
&nbsp;
<span style="color: #666666; font-style: italic;"># Downgrade privileges after initialization (non-Windows only)</span>
;user nobody
;group nobody
&nbsp;
<span style="color: #666666; font-style: italic;"># Try to preserve some state across restarts.</span>
persist-key
persist-tun
&nbsp;
<span style="color: #666666; font-style: italic;"># If you are connecting through an</span>
<span style="color: #666666; font-style: italic;"># HTTP proxy to reach the actual OpenVPN</span>
<span style="color: #666666; font-style: italic;"># server, put the proxy server/IP and</span>
<span style="color: #666666; font-style: italic;"># port number here.  See the man page</span>
<span style="color: #666666; font-style: italic;"># if your proxy server requires</span>
<span style="color: #666666; font-style: italic;"># authentication.</span>
;http-proxy-retry <span style="color: #666666; font-style: italic;"># retry on connection failures</span>
;http-proxy <span style="color: #7a0874; font-weight: bold;">&#91;</span>proxy server<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>proxy port <span style="color: #666666; font-style: italic;">#]</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Wireless networks often produce a lot</span>
<span style="color: #666666; font-style: italic;"># of duplicate packets.  Set this flag</span>
<span style="color: #666666; font-style: italic;"># to silence duplicate packet warnings.</span>
;mute-replay-warnings
&nbsp;
<span style="color: #666666; font-style: italic;"># SSL/TLS parms.</span>
<span style="color: #666666; font-style: italic;"># See the server config file for more</span>
<span style="color: #666666; font-style: italic;"># description.  It's best to use</span>
<span style="color: #666666; font-style: italic;"># a separate .crt/.key file pair</span>
<span style="color: #666666; font-style: italic;"># for each client.  A single ca</span>
<span style="color: #666666; font-style: italic;"># file can be used for all clients.</span>
ca ca.crt
cert nbnamran.crt
key nbnamran.key
&nbsp;
<span style="color: #666666; font-style: italic;"># Verify server certificate by checking</span>
<span style="color: #666666; font-style: italic;"># that the certicate has the nsCertType</span>
<span style="color: #666666; font-style: italic;"># field set to &quot;server&quot;.  This is an</span>
<span style="color: #666666; font-style: italic;"># important precaution to protect against</span>
<span style="color: #666666; font-style: italic;"># a potential attack discussed here:</span>
<span style="color: #666666; font-style: italic;">#  http://openvpn.net/howto.html#mitm</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># To use this feature, you will need to generate</span>
<span style="color: #666666; font-style: italic;"># your server certificates with the nsCertType</span>
<span style="color: #666666; font-style: italic;"># field set to &quot;server&quot;.  The build-key-server</span>
<span style="color: #666666; font-style: italic;"># script in the easy-rsa folder will do this.</span>
ns-cert-type server
&nbsp;
<span style="color: #666666; font-style: italic;"># If a tls-auth key is used on the server</span>
<span style="color: #666666; font-style: italic;"># then every client must also have the key.</span>
tls-auth ta.key <span style="color: #000000;">1</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Select a cryptographic cipher.</span>
<span style="color: #666666; font-style: italic;"># If the cipher option is used on the server</span>
<span style="color: #666666; font-style: italic;"># then you must also specify it here.</span>
;cipher x
&nbsp;
<span style="color: #666666; font-style: italic;"># Enable compression on the VPN link.</span>
<span style="color: #666666; font-style: italic;"># Don't enable this unless it is also</span>
<span style="color: #666666; font-style: italic;"># enabled in the server config file.</span>
comp-lzo
&nbsp;
<span style="color: #666666; font-style: italic;"># Set log file verbosity.</span>
verb <span style="color: #000000;">3</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Silence repeating messages</span>
;mute <span style="color: #000000;">20</span></pre></div></div>

<p>and the files needed for the client is as below :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>namran<span style="color: #000000; font-weight: bold;">@</span>nb-namran openvpn<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">ls</span>
ca.crt  client.ovpn  nbnamran.crt  nbnamran.csr  nbnamran.key  ta.key</pre></div></div>

<p>.. that&#8217;s it.!</p>
<p>p/s : .. pretty nice as it also work on windows machine&#8230;<br />
only the part of cert would make it a bit difficult to connect from other native device such as handphone!<br />
.. if someone happen to hack the way for IPSec on this.. kindly leave your note below .. hehe..</p>



<div class="post-fixed"><p>Related posts:<ol><li><a href='http://blog.namran.net/2009/11/12/setting-up-multiple-ssh-key-for-different-machine/' rel='bookmark' title='Permanent Link: Setting Up multiple SSH key for different machine'>Setting Up multiple SSH key for different machine</a></li><li><a href='http://blog.namran.net/2009/02/14/installing-nagios-3-in-centos-52/' rel='bookmark' title='Permanent Link: Installing Nagios 3 in CentOS 5.2'>Installing Nagios 3 in CentOS 5.2</a></li><li><a href='http://blog.namran.net/2009/03/09/installing-windows-xp-on-xen-virtualization-in-centos-5/' rel='bookmark' title='Permanent Link: Installing windows XP on XEN virtualization in CentOS 5'>Installing windows XP on XEN virtualization in CentOS 5</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.namran.net/2010/02/08/installing-and-configuring-openvpn-server-in-centos-5-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
