Public bug reported:

Hi,

I'm seeing a permissions problem when Netplan is called by Parallels Tools
after restoring a suspended VM.

The guest is Ubuntu 26.04 LTS arm64 and the network is managed by
systemd-networkd.

After restoring the VM, Parallels Tools runs its network restart script:

    /usr/lib/parallels-tools/tools/scripts/debian-restart.sh

The script detects that enp0s5 is managed by Netplan and calls:

    netplan apply

The Parallels Tools process has umask 0077. After Netplan runs, the generated
file has these permissions:

    -rw------- root systemd-network /run/systemd/network/10-netplan-
enp0s5.network

systemd-networkd cannot read the file and logs:

    Failed to open /run/systemd/network/10-netplan-enp0s5.network: Permission 
denied
    enp0s5: Unmanaging interface.

The guest then loses its DHCP lease and network connectivity.

I have to login into the Parallels terminal (it's a headless VM), change
the permissions and restart networkd. After that it immediately restores
the network:

    sudo chmod 0640 /run/systemd/network/10-netplan-enp0s5.network
    sudo systemctl restart systemd-networkd

Interestingly, this does not happen after a normal reboot. During a reboot,
/run is recreated and Netplan generates the file through the normal systemd
startup path. The resulting permissions are 0640 and networking works.

The difference appears to be the caller’s umask:

* requested mode with boot umask:     0640 & ~0022 = 0640
* requested mode with Parallels umask: 0640 & ~0077 = 0600 (permission too 
restrictive)

I can reproduce the underlying problem from the VM console with:

    sudo -i
    umask 0077
    netplan generate
    ls -l /run/systemd/network/10-netplan-enp0s5.network

The generated file is 0600.

Looking online, it seems to be a recurrence of the problem reported in
these older bugs:

https://bugs.launchpad.net/bugs/1736965
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1768560

As I understand it, Netplan intends to create the networkd file with mode
0640, but the final mode is still being affected by the caller’s umask.

Would it be possible for Netplan to explicitly apply the requested ownership
and mode to the generated temporary file before renaming it? That would make
the generated files independent of the environment from which Netplan was
called.

Thank you.

** Affects: netplan.io (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2164636

Title:
  Netplan generates unreadable networkd files when called with umask
  0077

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2164636/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to