The officially official Devuan Forum!

You are not logged in.

#1 2022-04-28 19:52:04

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 106  
Website

Simple Netaid

As I announced a few days ago in the mailing list, the new version of simple-netaid relies on the OpenWRT microbus architecture (Ubus):

https://openwrt.org/docs/techref/ubus

Over a period of testing time, I thing the most recent packaging of simple-netaid can be considered stable enough for daily use. Latest packages have been upload to packages.gnuinos.org yesterday night. In this section, I'm going to explain how to install and test them under devuan chimaera.

The following steps have been tested after a fresh install of devuan chimaera xfce. First of all, download and install the GnuPG key of gnuinos:


$ wget http://packages.gnuinos.org/gnuinos/pool/main/g/gnuinos-keyring/gnuinos-keyring_2020.05.03_all.deb
$ sudo dpkg -i gnuinos-keyring_2020.05.03_all.deb

Now you'll be able to add the gnuinos repo temporarily to your system:


$ sudo su
# echo "deb http://packages.gnuinos.org/merged chimaera main" > /etc/apt/sources.list.d/gnuinos.list
# apt-get update

After updating the repository, just install simple-netaid-vte3, and the following dependencies will be installed together with it:


# apt-get install simple-netaid-vte3
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Leyendo la información de estado... Hecho
Se instalarán los siguientes paquetes adicionales:
  libcdk5nc6 libiw30 libnetaid0 libpstat libubox0 libubus0 runit-helper simple-netaid-cdk snetaid ubus
Se instalarán los siguientes paquetes NUEVOS:
  libcdk5nc6 libiw30 libnetaid0 libpstat libubox0 libubus0 runit-helper simple-netaid-cdk simple-netaid-vte3 snetaid ubus
0 actualizados, 11 nuevos se instalarán, 0 para eliminar y 32 no actualizados.
Se necesita descargar 1.046 kB de archivos.
Se utilizarán 3.941 kB de espacio de disco adicional después de esta operación.
¿Desea continuar? [S/n]

Other runtime dependencies that were already installed after my fresh install of devuan chimaera are:


ifupdown
wpasupplicantisc-dhcp-clientprocpscoreutils


Simple-netaid-vte3 consists of a Gtk container for the ncurses interface of simple-netaid that provides, beyond the systray icon, a paned vte-terminal where both system calls of the ubus service and the info about the routing table netlink events are sent to, as you can see in the image below.


Captura%20de%20pantalla_2022-04-28_13-57-39.png


Once simple-netaid has been installed, it's highly recommended to remove network-manager:


# dpkg --purge network-manager-gnome network-manager

Now configure the content of /etc/network/interfaces to suite your needs. One sample:


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp

Reboot the system. If everything goes right, ubus -v list will find out the complete list of procedures and their argument signatures the specific service ering.netaid provides:


$ sudo ubus -v list
[sudo] password for aitor: 
'ering.netaid' @2b86f84a
	"interface_down":{"id":"Integer","ifname":"String"}
	"interface_up":{"id":"Integer","ifname":"String"}
	"ifdown":{"id":"Integer","ifname":"String","tty":"Integer"}
	"ifup":{"id":"Integer","ifname":"String","tty":"Integer"}
	"ipaddr_flush":{"id":"Integer","ifname":"String"}
	"wpa_passphrase":{"id":"Integer","essid":"String","passwd":"String","filename":"String"}
	"wpa_supplicant":{"id":"Integer","ifname":"String","filename":"String","tty":"Integer"}
	"uninstall":{"id":"Integer","filename":"String"}
	"scan_active_wifis":{"id":"Integer","ifname":"String"}

Run simple-netaid from the menu:


Captura%20de%20pantalla_2022-04-28_13-52-24.png


Alternatively, if you want to automatically start simple-netaid when the session is loaded, just specify simple-netaid-vte3 --systray in the dialog displayed via:

Settings Manager -> Session and Startup -> Application Autostart -> Add:


Captura%20de%20pantalla_2022-04-28_15-02-12.png


And the application will be iconified in your systray:


Captura%20de%20pantalla_2022-04-28_13-53-32.png


The first time you lanch simple-netaid a warning dialog will tell you that you need to be added to the netaid group:


Captura%20de%20pantalla_2022-04-28_13-44-37.png


After adding yourself to the netaid group by typing:


# usermod -aG netaid <username>

you should be able to call a given procedure within the ering.netaid namespace passing arguments to it as a regular user without granted permissions. For instance (ignore the first argument "id" so far):


$ ubus call ering.netaid ifdown '{ "ifname": "eth0" , "tty": 4 }'

will invoke /sbin/ifdown eth0 in the server side, and the system call will be thrown afterwards to the client side as long as the user specifies the current tty passed throughout the last argument signature (i.e. tty). For the sake of the example, we assumed above that


$ tty
/dev/pts/4

In doing so, the root-owned program ifupdown will be executed within the non-privileged console session:


$ ubus call ering.netaid ifdown '{ "ifname": "eth0" , "tty": 4 }'
Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/........ blah blah blah

The ACLs are located in /usr/share/acl.d. Concretly, simple-netaid involves netaid-server.json:


{
  
   "group": "netaid",
   
   "access": {

      "ering.netaid": {

          "methods": [ 
                       "interface_down" , 
                       "interface_up" , 
                       "ifup" , 
                       "ifdown" , 
                       "ipaddr_flush" , 
                       "wpa_passphrase" , 
                       "wpa_supplicant" , 
                       "uninstall" , 
                       "scan_active_wifis"
                     ]
      }
      
   }
   
}


This configuration is customizable. For example, it's possible to use something like "user": "devuanita" or even wildcards (*), as explained in the website of the OpenWRT project.

To end with, don't forget to revert the changes in your repository, removing packages.gnuinos.org
It's so risky...  big_smile

Therefore, as root:


# dpkg --purge gnuinos-keyring
# rm -f /etc/apt/sources.list.d/gnuinos.list
# apt-get update

Colophon: the automatically connect option of simple-netaid is still a work in progress.

Last edited by aitor (2022-05-02 00:01:40)


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#2 2022-04-29 19:59:09

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 106  
Website

Re: Simple Netaid

My wifi connection attempts are failing under 32 bits, and i still don't know why... I wonder if anyone is experiencing something similar

Last edited by aitor (2022-04-29 20:05:28)


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#3 2022-04-30 07:36:15

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 106  
Website

Re: Simple Netaid

aitor wrote:

My wifi connection attempts are failing under 32 bits, and i still don't know why... I wonder if anyone is experiencing something similar

I solved this issue yesterday night. I did a mistake in the format of one of the functions used in policy.c (snetaid) that affected only to 32 bit binaries. I've just uploaded the new packages, and updated the isos as well:

https://www.gnuinos.org/mirror/chimaera/live/


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#4 2022-04-30 16:37:27

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 106  
Website

Re: Simple Netaid

I did another important change in the daemon. In relatively old hardware, i noticed a random behavior during the boot process which often crashed upon unsuccesful attempts trying to register the netlink kernel socket. Appearently, the origin of this failure was in the fact that the networking script of ifupdown was still running when snetaid started. The daemon of simple-netaid forks an asynchronous child, resulting on a couple of process IDs: on the one hand the ubus loop waiting for requests in the client side (parent), and the netlink monitor on the other hand (child). I solved the problem above mentioned by adding a routine called wait_on_ifupdown() before trying to bind the netlink socket in the child process.

Let's clarify further that this issue was a side-effect of handling both ifupdown and simple-netaid with runit, and i think that this wouldn't occur in the case of sysvinit. It happened that i migrated the networking script of ifupdown from /etc/init.d/networking to /etc/sv/networking/run and this approach seems to bring a definitive end to the problem of the slow boot waiting for network when the ethernet cable is unpluged, caused by stanzas like auto eth0 and allow-hotplug eth0 in /etc/network/interfaces.

You can verify this fact in the live images of gnuinos chimaera, but i need testers to confirm this point smile

Last edited by aitor (2022-04-30 17:28:12)


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#5 2022-04-30 17:22:07

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 106  
Website

Re: Simple Netaid

aitor wrote:

the automatically connect option of simple-netaid is still a work in progress.

To automatically connect eth0 i have both:

auto eth0
allow-hotplug eth0
.......

in my /etc/network/interfaces, and there is no need for ifplugd, no need for netplug. Hence, the automatically connect option of simple-netaid will involve only wireless interfaces.

Last edited by aitor (2022-04-30 17:22:55)


If you work systematically, things will come by itself (Lev D. Landau)

Offline

Board footer