Skip to content

[BUG] WALinuxAgent parses private systemd state #3241

Description

@nmeyerhans

WALinuxAgent parses data explicitly listed as internal to systemd and not for direct access

#2979 updated WALinuxAgent to handle Ubuntu's switch to from ISC DHCP Client to systemd-networkd. That change introduced code that reads from files in /run/systemd/netif/leases/, which begin with a line indicating that they contain "private data. Do not parse."

As this is an internal interface to systemd, it may change at any time in a way that could break WALinuxAgent. This issue was discussed in the original PR and concludes that "there is no proper way of getting the lease file details." This was an accurate statement at the time, but that has been addressed with systemd 256, which exposes the DHCP lease details through the systemd-networkd dbus interface.

An example of obtaining option 245 using via the dbus interface on the commandline using busctl and jq (for parsing the json responses) is:

noahm@scratch:~$ busctl -j --system call  \
   org.freedesktop.network1 \
   /org/freedesktop/network1/link/_32 \
   org.freedesktop.network1.Link \
   Describe \
   | jq -r '.data[0]' | \
   jq -r '.DHCPv4Client.PrivateOptions | map(select(.Option == 245)) | .[].PrivateOptionData'
a83f8110

This can, of course, be implemented in pure python.

It would be good to update WALinuxAgent to use supported interfaces where possible. Distros using systemd <256 will likely need to continue parsing internal systemd-networkd state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions