Skip to content

nm-manager: fix selinux label for dhclient lease file from initramfs

Alexey Kodanev requested to merge akodanev/NetworkManager:master into master

When moving a lease file from initramfs directory to NetworkManager run directory, SELinux label for that file retains tmpfs_t type.

Fix it by using sendfile() instead of rename(). That way, the lease file will have the default type: NetworkManager_var_run_t.

  • Before the patch: ls -Z /var/run/NetworkManager/dhclient-*.lease system_u:object_r:tmpfs_t:s0

  • After: ls -Z /var/run/NetworkManager/dhclient-*.lease system_u:object_r:NetworkManager_var_run_t:s0

Merge request reports