ElektraInitiative / libelektra

Elektra serves as a universal and secure framework to access configuration settings in a global, hierarchical key database.
https://www.libelektra.org
BSD 3-Clause "New" or "Revised" License
208 stars 123 forks source link

support debian network/interfaces #974

Closed markus2330 closed 7 years ago

markus2330 commented 8 years ago

Suggested from user "fork" at http://www.pro-linux.de/news/1/23981/comm/1/show-all-comments.html

markus2330 commented 8 years ago

@reox Can you take a look at https://github.com/dggreenbaum/debinterface and write the python plugin that reads/write from interfaces?

megabert commented 8 years ago

I did only a quick search for a parser for /etc/network/interfaces and found debinterface. I would assume there are at least some more parsers available for that. If I find another projects I'll note them here as comment.

megabert commented 8 years ago

There are a few projects parsing /etc/network/interfaces:

markus2330 commented 8 years ago

@megabert thanks for the investigation! Augeas is already integrated in Elektra. Unfortunately it only provides a very low abstraction, i.e. the tree it yields is nearly unusable:

$ kdb mount /etc/network/interfaces system/network/interfaces augeas lens=Interfaces.lns
$ kdb ls system/network/interfaces
system/network/interfaces
system/network/interfaces/#comment[1]
system/network/interfaces/#comment[2]
system/network/interfaces/#comment[3]
system/network/interfaces/allow-hotplug[1]
system/network/interfaces/allow-hotplug[1]/1
system/network/interfaces/allow-hotplug[2]
system/network/interfaces/allow-hotplug[2]/1
system/network/interfaces/auto[1]
system/network/interfaces/auto[1]/1
system/network/interfaces/auto[2]
system/network/interfaces/auto[2]/1
...

@megabert Any idea which of the python libraries is better?

megabert commented 8 years ago

I'll may have a look into it.

I'd like to point out, that /etc/network/interfaces is actually a little more complex than it might be expected:

markus2330 commented 8 years ago

I'll may have a look into it.

Thanks, we appreciate your feedback.

I'd like to point out, that /etc/network/interfaces is actually a little more complex than it might be expected

Do the libraries and the augeas lens provide all the features?

Subdirectory /etc/network/interfaces.d/

We work on a multi-file resolver #728 to support this.

megabert commented 8 years ago

Seems that are a lot Extensions to interfaces:

man interfaces

...
OPTIONS PROVIDED BY OTHER PACKAGES
This manual page documents the configuration options provided by the ifupdown package.
However, other packages can make other options available for use in /etc/network/inter‐
faces. Here is a list of packages that provide such extensions:

arping, avahi-autoipd, avahi-daemon, bind9, bridge-utils, clamav-freshclam, controlaula,
epoptes-client, ethtool, guidedog, hostap-utils, hostapd, htpdate, ifenslave, ifmetric,
ifupdown-extra, ifupdown-multi, ifupdown-scripts-zg2, initscripts, isatapd, linux-wlan-ng,
lprng, macchanger, miredo, nslcd, ntpdate, openntpd, openresolv, openssh-server, openvpn,
openvswitch-switch, postfix, resolvconf, sendmail-base, shorewall-init, slrn, slrnpull,
tinc, ucarp, uml-utilities, uruk, vde2, vlan, vzctl, whereami, wide-dhcpv6-client, wire‐
less-tools, wpasupplicant.

...
megabert commented 8 years ago

I got the hint, that /etc/network/interfaces may be replaced in some of the next releases by systemd-network:

https://www.freedesktop.org/software/systemd/man/systemd.network.html

Seems it may good to do a bit more research before investing work in stuff which is being deprecated soon.

markus2330 commented 8 years ago

ifupdown2 was also developed recently (mostly same syntax). And there is also the option of using NetworkManager. It does not seem that there will be a single networking tool anytime soon.

markus2330 commented 7 years ago

Closed because of low priority, will be reevaluated after 1.0