Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] WALinuxAgent parses private systemd state #3241

Open
nmeyerhans opened this issue Oct 10, 2024 · 0 comments
Open

[BUG] WALinuxAgent parses private systemd state #3241

nmeyerhans opened this issue Oct 10, 2024 · 0 comments

Comments

@nmeyerhans
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant