Skip to contentSkip to conversation

setfiles vs getfilecon

DISCUSSION Magosányi Árpád 2 participants 2 messages Feb 18, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi!

It seems there is some inconsistency in computing the label of a symlink between setfiles and [sg]etfilecon.

root@szoketto-TCB:~# setfiles -nv /etc/security/selinux/none.contexts /
|grep libpam.so
setfiles:  relabeling /lib/libpam.so.0 from kernel_u:object_r:tcb_mod_t
to object_u:object_r:tcb_exec_t
root@szoketto-TCB:~# getfilecon /lib/libpam.so.0*
/lib/libpam.so.0        object_u:object_r:tcb_exec_t
/lib/libpam.so.0.77     object_u:object_r:tcb_exec_t
root@szoketto-TCB:~# setfiles -nv /etc/security/selinux/none.contexts /
|grep libpam.so
setfiles:  relabeling /lib/libpam.so.0 from kernel_u:object_r:tcb_mod_t
to object_u:object_r:tcb_exec_t
root@szoketto-TCB:~# ls -l /lib/libpam.so.0*
lrwxrwxrwx    1 root     root           14 Feb 17 09:54 /lib/libpam.so.0
-> libpam.so.0.77
-rw-r--r--    1 root     root        31352 Feb 17 09:49
/lib/libpam.so.0.77
oot@szoketto-TCB:~# dpkg -S setfiles getfilecon
policycoreutils: /usr/share/man/man8/setfiles.8.gz
policycoreutils: /usr/sbin/setfiles
selinux-utils: /usr/bin/getfilecon
root@szoketto-TCB:~# dpkg -l policycoreutils selinux-utils
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err:
uppercase=bad)
||/ Name                         Version                     
Description
+++-============================-============================-========================================================================
ii  policycoreutils              1.4-3                        SELinux
core policy utilities
ii  selinux-utils                1.4-0.1                      SELinux
utility programs

The packages came from
deb-src http://www.coker.com.au/newselinux/ ./

Signature · 7 lines
GNU GPL: csak tiszta forrásból


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 2 lines · Magosányi Árpád

It seems there is some inconsistency in computing the label of a symlink between setfiles and [sg]etfilecon.

setfiles uses lgetfilecon(3) and lsetfilecon(3). [sg]etfilecon use getfilecon(3) and setfilecon(3). We should likely add a -h option to setfilecon and getfilecon to indicate that they should use lsetfilecon(3) and lgetfilecon(3), as with setfattr and getfattr.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.