View Single Post
meShell's Avatar
Posts: 60 | Thanked: 104 times | Joined on Dec 2009
#2
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

Last edited by meShell; 2014-01-29 at 08:04.
 

The Following User Says Thank You to meShell For This Useful Post: