Skip to contentSkip to conversation

setfiles: clarify documented path resolution behaviour

PATCH Applied Jonathan Lebon 2 participants 3 messages Jun 18, 2020 – Jun 25, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 setfiles: clarify documented path resolution behaviour

One thing that confused me when investigating
https://github.com/SELinuxProject/selinux/issues/248 (i.e.
https://github.com/coreos/fedora-coreos-tracker/issues/512) was that the manual page for setfiles seemed to imply that paths were fully resolved. This was consistent with the issues above where setfiles was failing because the target of the symbolic link didn't exist.

But in fact, the wording around symbolic links in setfiles/restorecon refers actually to whether the parent directories are canonicalized via realpath(3) before labeling.

Clarify the man pages to explain this.

---
 policycoreutils/setfiles/restorecon.8 | 6 ++++--
 policycoreutils/setfiles/setfiles.8   | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)
policycoreutils/setfiles/restorecon.8 +4 -2
index bbfc83fe..1a785258 100644
@@ -159,8 +159,10 @@ The pathname for the file(s) to be relabeled.
 .SH "NOTES"
 .IP "1." 4
 .B restorecon
-does not follow symbolic links and by default it does not
-operate recursively on directories.
+by default does not operate recursively on directories. Paths leading up the
+final component of the file(s) are canonicalized using
+.BR realpath (3)
+before labeling.
 .IP "2." 4
 If the
 .I pathname
policycoreutils/setfiles/setfiles.8 +2 -1
index 0188a75a..e328a562 100644
@@ -214,7 +214,8 @@ option is used.
 .SH "NOTES"
 .IP "1." 4
 .B setfiles
-follows symbolic links and operates recursively on directories.
+operates recursively on directories. Paths leading up the final
+component of the file(s) are not canonicalized before labeling.
 .IP "2." 4
 If the
 .I pathname
Signature · 1 line
2.26.2
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Jonathan Lebon

One thing that confused me when investigating
https://github.com/SELinuxProject/selinux/issues/248 (i.e.
https://github.com/coreos/fedora-coreos-tracker/issues/512) was that the manual page for setfiles seemed to imply that paths were fully resolved. This was consistent with the issues above where setfiles was failing because the target of the symbolic link didn't exist.

Quoted 7 lines

But in fact, the wording around symbolic links in setfiles/restorecon refers actually to whether the parent directories are canonicalized via realpath(3) before labeling.

Clarify the man pages to explain this.

maintainer Applied
#2 lore raw
Quoted 14 lines · Stephen Smalley
Quoted 12 lines · Jonathan Lebon

One thing that confused me when investigating
https://github.com/SELinuxProject/selinux/issues/248 (i.e.
https://github.com/coreos/fedora-coreos-tracker/issues/512) was that the manual page for setfiles seemed to imply that paths were fully resolved. This was consistent with the issues above where setfiles was failing because the target of the symbolic link didn't exist.

But in fact, the wording around symbolic links in setfiles/restorecon refers actually to whether the parent directories are canonicalized via realpath(3) before labeling.

Quoted 5 lines
Quoted 3 lines

Clarify the man pages to explain this.

Applied.