maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   VPNC Trunk (working with FritzBox) on Jolla (https://talk.maemo.org/showthread.php?t=92338)

meShell 2014-01-10 07:47

VPNC Trunk (working with FritzBox) on Jolla
 
1 Attachment(s)
As title tells, this is a newer fixed version of "vpnc" that works my FritzBox 7490 VPN.

Jolla provides already an old version, but that still doesn't have the needed fixes like this one:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629646


So I compiled the latest revision from SVN directly on my Jolla and it connects sucessfully.

SVN



What I did

I installed the old vpnc with developer mode + terminal.

Edited the vpnc-config file: /etc/vpnc/default.conf

Code:

IPSec gateway myrouter.dyndnsxyz.com
IPSec ID myVpnUser
IPSec secret abclZfswe1234aDF
IKE Authmode psk
Xauth username myVpnUser
Xauth password myVpnUserPassword



Then I compiled trunk vpnc after installing gnutls, libgcrypt, gcc ...

Running the new vpnc as root: ./vpnc

This connects sucessfully to my VPN:

Code:

"VPNC started in background (pid: 12345)..."
and silently creates the the interface "tun0" (with it's own additional IP), as you can see with running: ifconfig

Then I manualy added a route so that only all traffic to the network 192.168.2.0/24 is going over vpn for now (should be handled by script later):

Code:

ip route add 192.168.2.0/24 dev tun0
Now I can access devices in my network via VPN.




Appended my "vpnc.zip":

Code:

File: vpnc.zip
CRC-32: 8db30d58
  MD4: cacb0a50ef3ee13d46c67ad9e4bc48fd
  MD5: a6f29926acbc92161dd76822441ac16d
 SHA-1: c19a684f7d72ba4fd6deb0ff91a3311969be5110


meShell 2014-01-17 23:31

Re: VPNC Trunk (working with FritzBox) on Jolla
 
Network + DNS

Network + DNS is managed by "connmand" acting as DNS-Proxy etc.

Getting details about connections via DBUS:

Code:

dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetServices

Changing Nameservers

DBUS: Nameservers is readonly, need to modify Nameservers.Config

possible with this script (needs Python + dbus-python)


For calling this script you must know your individual "ServiceID" (example: wifi_5050a0b0c0d0_1234567b8912_managed_psk).

you can find those ServiceIDs as folders in:

Code:

/var/lib/connman/
or using dbus-send to show your current "enabled" Services (doesn't show the ones currently disabled):

Code:

dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetServices
WARNING: DO A BACKUP

You should do a backup or at least write down your current configured nameservers as it may NOT GET CHANGED BACK even after a reboot automatically.

If you are sure what you do you can change your Nameservers like this:
Code:

./set-nameservers wifi_5050a0b0c0d0_1234567b8912_managed_psk 8.8.8.8 8.8.4.4



Changing Nameservers is not possible with dbus-send:

D-Bus supports more types than these, but dbus-send currently does not. Also, dbus-send does not permit empty containers or nested containers (e.g. arrays of variants).





VPNC-Helper

VPNC cannot be run as normal user.
So I created a small helper for it to be able to start my "vpnc" with a GUI-Button (did not find any other "recommended way to run as privileged" via Sailfis-App).


So there are 3 steps.
  • compile helper program
  • change owner to root:root
  • change permissions to 4755


Code:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
  setuid( 0 );
  system( "/usr/sbin/vpnc && /sbin/ip route add xxx.xxx.x.0/24 dev tun0);

  return 0;
}


compiled it with gcc on the phone like this:

Code:

gcc vpnc-helper.c -o vpnc-helper
devel-su
chown root:root vpnc-helper
chmod 4755 vpnc-helper


Casanunda 2014-04-15 16:16

Re: VPNC Trunk (working with FritzBox) on Jolla
 
Thanks!

Your modded vpnc from first post works fine for me.
By the way, it's no problem to rename that vpnc or move it to another folder in order to keep the original vpnc (on my N900 after doing a similar mod I could connect fine to my Fritzbox at home, but VPN connection to work did not work any more...)


To be honest, I don't quite understand what the second post is about, so I haven't tried following that...

meShell 2014-04-15 16:44

Re: VPNC Trunk (working with FritzBox) on Jolla
 
Great to hear that it is working for you!

The first part is enough to "reach" the remote network.

But if one would want to do more like using DNS from the remote network or forward traffic through the tunnel, it is much more work to do and create some script. The first problem for me was how to change the dns-server-configuration.

I created the vpnc-helper so that I can start it from my Sailfish-GUI-App as normal user.

jacobodonosor 2015-03-02 12:54

Re: VPNC Trunk (working with FritzBox) on Jolla
 
Hello MeShell.
I was unable to download the script, it is not available on github,.
https://github.com/connectivity/conn...et-nameservers ( 404 :/ )
You can share it again ?.
Thank you very much!

meShell 2015-04-06 14:04

Re: VPNC Trunk (working with FritzBox) on Jolla
 
Hi, should be this I think:

https://github.com/aldebaran/connman...et-nameservers


All times are GMT. The time now is 13:27.

vBulletin® Version 3.8.8