maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   [HowTo] automatic vpn for wifi connections (https://talk.maemo.org/showthread.php?t=88994)

mcbook 2013-02-04 17:32

[HowTo] automatic vpn for wifi connections
 
Since some of you might be interested in this.. here's a little HowTo

In order to automatically connect to a VPN when you connect your N9(50) to a wifi network you need to...

1.) install VPN9C (graphical frontend for vpnc on meego harmattan)

you can get it form the store.
(note that with vpnc you can only connect to VPN using IPSec)

2.) create a config file for vpnc (contains all the necesary credentials)

create a .conf file and store it somewhere
It should look somehting like this

Quote:

IPSec gateway address
IPSec ID id
IPSec secret secret
Xauth username user
Xauth Password password
3.) install Profilematic and create a new rule

choose your desired wifi network as a condition for the rule

to connect to VPN use this command

Quote:

sh -c "/opt/vpn9c/bin/vpnc.sh < /path/to/your/conf/file"
to disconnect from VPN once you disconnect from wifi

Quote:

sh -c "/opt/vpn9c/bin/vpnc.sh stop"

have fun!

coderus 2013-02-04 18:12

Re: automatic vpn for certain wifi connections
 
you can use Profilematic for that.

mcbook 2013-02-04 18:29

Re: automatic vpn for certain wifi connections
 
do you know how to start a VPN connection with VPN9C via terminal?

tortoisedoc 2013-02-04 18:34

Re: automatic vpn for certain wifi connections
 
Quote:

Originally Posted by mcbook (Post 1320784)
do you know how to start a VPN connection with VPN9C via terminal?

Does VPN9C have a command line interface?
If so, you could integrate that to Profilemantic via bash scrips.
But I doubt VPN9C does. Although I never used it, so I am most likely wrong :).

mcbook 2013-02-04 18:45

Re: automatic vpn for certain wifi connections
 
there is an executable in /opt/vpn9c/bin but it doesnt take arguments and there are 2 scripts vpnc.sh and vpnc-script but i don't know how to feed them parameters

mcbook 2013-02-05 19:22

Re: automatic vpn for certain wifi connections
 
ok, i managed to feed vpnc the parameters (host, password, group secret,...) but it tells me that the operation is not permitted

Quote:

vpnc: Error binding to source port. Try '--local-port 0'
Failed to bind to 0.0.0.0:500: Permission denied
also tried
Quote:

~ $ vpnc /etc/vpnc/lrz.conf --local-port 0
sh: /etc/vpnc/vpnc-script: not found
vpnc: can't initialise tunnel interface: Operation not permitted
i wonder if this might have something to do with aegis?

coderus 2013-02-05 20:14

Re: automatic vpn for certain wifi connections
 
devel-su ?

mcbook 2013-02-05 20:14

Re: automatic vpn for certain wifi connections
 
same thing

mcbook 2013-02-05 21:14

Re: automatic vpn for certain wifi connections
 
ok i figured it out (it's atcually quite simple)

vpnc.sh < path_to_config_file

thank you guys

ajalkane 2013-02-06 23:12

Re: [HowTo] automatic vpn for wifi connections
 
Quote:

Originally Posted by mcbook (Post 1320770)
3.) install Profilematic and create a new rule

choose your desired wifi network as a condition for the rule

to connect to VPN use this command
Code:

/opt/vpn9c/bin/vpnc.sh < /path/to/your/conf/file

Good otherwise, but ProfileMatic doesn't run the command in shell at the moment. So the redirection "<" will not work unless you run it in shell like this in ProfileMatic's custom action

Code:

sh -c "/opt/vpn9c/bin/vpnc.sh < /path/to/your/conf/file"


All times are GMT. The time now is 12:25.

vBulletin® Version 3.8.8