# FreeBSD as OpenVPN Client



## cortex (Jan 12, 2011)

Hello the team,

I'm French boy from France, excuse me for my bad English. I have installed FreeNAS, this is a FreeBSD OS specialized in NAS (Network Area Storage). FreeNAS is installed with the full version, not embedded.

I'm a customer from a VPN Provider Arethusa. I have a little problem for to automate the VPN connection on my VPN provider.

First: I only have from VPN Provider a* Login and Password, ca.key and openvpn.conf.*
My openvpn.conf file:

```
client
dev tun
proto udp
remote xxx.xxxxxxx.xxx 443
resolv-retry infinite
nobind
persist-key
persist-tun
ca /usr/local/etc/openvpn/ca.crt
ns-cert-type server
cipher AES-256-CBC
comp-lzo
verb 3
auth-user-pass
redirect-gateway def1 bypass-dhcp
```

Look, *auth-user-pass*, if I try to put the Login and Password in a file -> it doesn't work

Second: in Putty SSH mode:
[cmd=]pkg_add -r openvpn[/cmd]

Third: At the End of rc.conf I have to add:

```
openvpn_enable="YES"
openvpn_if="tap"
```

Fourth: in Putty SSH mode:
[cmd=]ifconfig tun0 create[/cmd]

Fifth: in Putty SSH mode:
[cmd=]/usr/local/etc/rc.d/openvpn start[/cmd]

After the following command _openvpn start_, the Prompt of Putty ask:

```
Enter Auth Username:[i] I need to type the login[/i]
Enter Auth Password:[i] I need to type the password[/i]
```

Ok, FreeNAS VPN client works.

*Now, if I reboot FreeNas* after the file rc.conf has loaded, the prompt asks:

```
[b]Enter Auth Username[/b] and [b]Enter Auth Password[/b]
```
Ok, I type the login and password.
But the *tun0* doesn't exist, so the vpn doesn't work

I have two questions:
the problem for me is:* to type the login and password* at the boot
I tried this command: 

```
auth-user-pass /usr/local/etc/openvpn/key.conf -> it doesn't work
auth-user-pass /usr/local/etc/openvpn/key.conf via file -> it doesn't work
```

Do you have a solution ?

I also need to create an automated command for [cmd=]ifconfig tun0 create[/cmd] Do you have any idea? And where and in which file can I put this command ?

Regards,
The French boy who tried to write an English  :e


----------



## DutchDaemon (Jan 12, 2011)

Note: FreeNAS is derived from FreeBSD, but heavily customized -> Topics about PC-BSD / FreeNAS / DesktopBSD / m0N0WALL / pfSense.


----------



## DutchDaemon (Jan 12, 2011)

In FreeBSD (which FreeNAS, is not!), this would be in /etc/rc.conf:

```
openvpn_enable="YES"
openvpn_if="tun"
```


----------



## SirDice (Jan 12, 2011)

The answer is staring you right in the face....



			
				cortex said:
			
		

> Third: At the End of rc.conf I have to add:
> 
> ```
> openvpn_enable="YES"
> ...





> But the *tun0* doesn't exist, so the vpn doesn't work



Notice the difference? tap(4) and tun(4) are not the same thing.


----------



## cortex (Jan 12, 2011)

Ok thx.
I will try to replace 
	
	



```
openvpn_if="tap"
```
 with 
	
	



```
openvpn_if="tun"
```

DutchDaemon can you move this topic in Topics about PC-BSD / FreeNAS / DesktopBSD / m0N0WALL / pfSense.


----------



## DutchDaemon (Jan 12, 2011)

Maybe you should read what that link actually says?


----------



## cortex (Jan 12, 2011)

ok DutchDaemon, I did not understand, sorry.


----------



## cortex (Jan 19, 2011)

Hello the team,

I have news about my problem.

If I try to put the login ant pass in file.
The system log:

```
"Sorry, 'Auth' password cannot be read from a file"
```

I read on internet, I need to compile openvpn with â€“enable-password-save option:

http://www.itsolutionskb.com/2010/04/how-to-enable-openvpn-autologin/
http://www.google.fr/search?q=sory+...&rls=org.mozilla:fr:official&client=firefox-a

Can you read me how I can compile openvpn on my Freenas ?


----------

