Skip to contentSkip to conversation

/selinux getattr messages]

[email protected]: Václav Ovsík 4 participants 6 messages Nov 16, 2007 – Nov 19, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hello,
I'm trying to stabilize refpolicy-20070928 on Debian Etch.

Repository with some updated selinux packages will be available soon. I took packages from Sid and updated these with 20070928 upstream releases.

I'm SELinux beginer, but my intention is to understand the SELinux finally :) and run targeted and possibly strict policies in production environment on Debian.

Currently I'm booting Xen DomU Debian Etch in permissive mode.

There are two audit messages, and I found solution (attached) in [email protected].

audit(1195215260.590:3): avc: denied { getattr } for pid=760 comm="mount" name="/" dev=selinuxfs ino=475 scontext=system_u:system_r:mo
unt_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

audit(1195215263.626:6): avc: denied { getattr } for pid=1017 comm="swapon" name="/" dev=selinuxfs ino=475 scontext=system_u:system_r:
fsadm_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

So after insertion

selinux_get_fs_mount(fsadm_t)
-> ./policy/modules/system/fstools.te

selinux_get_fs_mount(mount_t)
-> ./policy/modules/system/mount.te

both messages dismiss.

Is such solution ok and acceptable upstream (conditionaly for Debian distro or so)?

Regards

Signature · 1 line
Zito

I am using the targeted policy in permissive mode. During boot I get the following messages:
audit(1182511335.252:36): avc: denied { getattr } for pid=1249 comm="mount" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:mount_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem audit(1182511346.457:47): avc: denied { getattr } for pid=1503 comm="swapon" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:fsadm_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem audit(1182511347.644:48): avc: denied { getattr } for pid=1570 comm="iptables" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:iptables_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

These come because libblkid and iptables are both linked against libselinux, which locates the selinux mount point in a constructor. When this was introduced in libselinux, the selinux_get_fs_mount interface was added to the reference policy to allow this. So mount.te should gain selinux_get_fs_mount(mount_t)
and fstools.te should gain
selinux_get_fs_mount(fsadm_t)

So far as I can see iptables has no need to be linked against libselinux, but I will check further.

Signature · 1 line
Martin Orr

_______________________________________________
SELinux-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/selinux-devel

#1 lore raw

Re: [DSE-Dev] [[email protected]: /selinux getattr messages]

Hi,

Quoted 8 lines

selinux_get_fs_mount(fsadm_t)
-> ./policy/modules/system/fstools.te

selinux_get_fs_mount(mount_t)
-> ./policy/modules/system/mount.te

Is such solution ok and acceptable upstream (conditionaly for Debian distro or so)?

That is a well-defined access control switch, so I figure it's okay, at least if it has been checked that these aren't due to some bug in the programs doing these commands.

You might also want to browse the changes I did to my policy. They're all in SVN at
http://svn.debian.org/wsvn/selinux/refpolicy/branches/debian/

If you want, I can give you write access to that repository. All you need is an alioth account and join the SELinux project there.

Quoted 1 line

From the changelog you can see that upstream revision 2337 was the last

one I merged, so you should be able to get a clean diff via SVN by comparing that revision from upstream with my 'HEAD' revision. I don't know if I did something to fix that audit error. Maybe I modified one of the other macros instead to include this getattr.

best regards,
Erich Schubert

Signature · 12 lines
    erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C   (o_
                 Friends are those who reach out for                //\
                   your hand but touch your heart.                  V_/_
   Es ist beschämender seinen Freunden zu mißtrauen als von ihnen
        getäuscht zu werden. --- François de la Rochefoucauld



--
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.
#2 lore raw

Re: [DSE-Dev] [[email protected]: /selinux getattr messages]

Quoted 1 line · Erich Schubert

Hi,

Hello,

Quoted 4 lines

You might also want to browse the changes I did to my policy. They're all in SVN at
http://svn.debian.org/wsvn/selinux/refpolicy/branches/debian/

I testing selinux on my etch/lenny machine, and i prepared patch for refpolicy trunk:
http://wonder.pl/pub/debian/deby/debian-selinux-patches/refpolicy/refpolicy-debian-20071116.patch

I'm new to selinux, so this patch should be reviewed by some experienced SELinux users.

regards,
Robert Litwiniec

Signature · 7 lines
http://debian.wonder.pl - Debian/GNU Linux wiki
http://zamosc.wonder.pl - Wonders of Zamosc

--
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.
#3 lore raw

Re: [DSE-Dev] [[email protected]: /selinux getattr messages]

Hello Robert,

Quoted 3 lines

I testing selinux on my etch/lenny machine, and i prepared patch for refpolicy trunk:
http://wonder.pl/pub/debian/deby/debian-selinux-patches/refpolicy/refpolicy-debian-20071116.patch

Just some notes:
- don't include build.conf in the patch
- try to split the patch into small changes, and send them individually. That makes review easier, and they go into upstream quicker.

I don't have the time to completely review your patch, so just a few notes:

refpolicy/policy/modules/admin/alsa.fc:
/var/lib/alsa/asound\.state gen_context(system_u:object_r:alsa_etc_rw_t,s0)

Make a new context such as alsa_state_t, using *_etc_* outside of /etc is a misnamer, and you unnecessarily give write access to files in /etc when you only want to give write access to /var/lib/alsa. Also you should relabel the directory /var/lib/alsa, this helps getting the file labeled correctly upon creation already.

refpolicy/policy/modules/apps/mozilla.fc:
/usr/bin/epiphany
shouldn't be labeled mozilla_exec_t, because it's just a wrapper shell script. The correct binaries to relabel are
/usr/bin/epiphany-gecko
/usr/bin/epiphany-webkit
/usr/bin/epiphany
(for version where there was just the gecko branch)

/etc/gdm - you messed something up there. avoid bin_t there.

refpolicy/policy/modules/services/hal.fc:
also relabel the directory, so the pidfile gets labeled correctly upon creation.

Again, I didn't go through the whole diff. But on overall, I think you've been doing a quite good job. You've understood how to fix audit errors properly and how to use interfaces and macros. I hope that someone of the active SELinux users will have time to look at your diff in detail and include some of the changes into the upstream branch.

best regards,
Erich Schubert

Signature · 11 lines
     erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
 Why waste time learning, when ignorance is instantaneous? --- Calvin //\
     Die eigentliche Aufgabe eines Freundes ist, dir beizustehen,     V_/_
     wenn du im Unrecht bist. Jedermann ist auf deiner Seite, wenn
                   du im Recht bist. --- Mark Twain


--
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.
#4 lore raw

Re: [DSE-Dev] [[email protected]: /selinux getattr messages]

In reply to Václav Ovsík
Quoted 31 lines · Václav Ovsík

Hello,
I'm trying to stabilize refpolicy-20070928 on Debian Etch.

Repository with some updated selinux packages will be available soon. I took packages from Sid and updated these with 20070928 upstream releases.

I'm SELinux beginer, but my intention is to understand the SELinux finally :) and run targeted and possibly strict policies in production environment on Debian.

Currently I'm booting Xen DomU Debian Etch in permissive mode.

There are two audit messages, and I found solution (attached) in [email protected].

audit(1195215260.590:3): avc: denied { getattr } for pid=760 comm="mount" name="/" dev=selinuxfs ino=475 scontext=system_u:system_r:mo
unt_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

audit(1195215263.626:6): avc: denied { getattr } for pid=1017 comm="swapon" name="/" dev=selinuxfs ino=475 scontext=system_u:system_r:
fsadm_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

So after insertion

selinux_get_fs_mount(fsadm_t)
-> ./policy/modules/system/fstools.te

Quoted 7 lines

selinux_get_fs_mount(mount_t)
-> ./policy/modules/system/mount.te

both messages dismiss.

Is such solution ok and acceptable upstream (conditionaly for Debian distro or so)?

I have added a selinuxutil interface for libselinux-linked domains (seutil_libselinux_linked()). That way its clear why the access is needed, and we can change it if the constructor changes.

The mount change could be for all, as I also see the libblkid linkage on my Gentoo system too. However, I don't see it in Gentoo iptables (1.3.8).

Quoted 37 lines

email message attachment

Quoted 36 lines

-------- Forwarded Message --------
From: Martin Orr <[email protected]>
To: [email protected]
Subject: [DSE-Dev] /selinux getattr messages
Date: Sat, 23 Jun 2007 12:39:11 +0100

I am using the targeted policy in permissive mode. During boot I get the
following messages:
audit(1182511335.252:36): avc: denied { getattr } for pid=1249 comm="mount" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:mount_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem audit(1182511346.457:47): avc: denied { getattr } for pid=1503 comm="swapon" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:fsadm_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem audit(1182511347.644:48): avc: denied { getattr } for pid=1570 comm="iptables" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:iptables_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

These come because libblkid and iptables are both linked against libselinux,
which locates the selinux mount point in a constructor. When this was
introduced in libselinux, the selinux_get_fs_mount interface was added to
the reference policy to allow this. So mount.te should gain selinux_get_fs_mount(mount_t)
and fstools.te should gain selinux_get_fs_mount(fsadm_t)

So far as I can see iptables has no need to be linked against libselinux,
but I will check further.

Signature · 10 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150



--
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.
#5 lore raw

Re: [DSE-Dev] [[email protected]: /selinux getattr messages]

Quoted 35 lines · Christopher J. PeBenito
Quoted 34 lines · Václav Ovsík

Hello,
I'm trying to stabilize refpolicy-20070928 on Debian Etch.

Repository with some updated selinux packages will be available soon. I took packages from Sid and updated these with 20070928 upstream releases.

I'm SELinux beginer, but my intention is to understand the SELinux finally :) and run targeted and possibly strict policies in production environment on Debian.

Currently I'm booting Xen DomU Debian Etch in permissive mode.

There are two audit messages, and I found solution (attached) in [email protected].

audit(1195215260.590:3): avc: denied { getattr } for pid=760 comm="mount" name="/" dev=selinuxfs ino=475 scontext=system_u:system_r:mo
unt_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

audit(1195215263.626:6): avc: denied { getattr } for pid=1017 comm="swapon" name="/" dev=selinuxfs ino=475 scontext=system_u:system_r:
fsadm_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

So after insertion

selinux_get_fs_mount(fsadm_t)
-> ./policy/modules/system/fstools.te

selinux_get_fs_mount(mount_t)
-> ./policy/modules/system/mount.te

Quoted 8 lines
Quoted 4 lines

both messages dismiss.

Is such solution ok and acceptable upstream (conditionaly for Debian distro or so)?

I have added a selinuxutil interface for libselinux-linked domains (seutil_libselinux_linked()). That way its clear why the access is needed, and we can change it if the constructor changes.

Fine
Thanks

Quoted 3 lines

The mount change could be for all, as I also see the libblkid linkage on my Gentoo system too. However, I don't see it in Gentoo iptables (1.3.8).

I received messages from mount (mount.te) and fsck (fstools.te) wich are run from init scripts...
I'm not running iptables from init scripts right now.

But

bobek:~# ldd /sbin/iptables
        linux-gate.so.1 =>  (0xb7f2f000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7f0a000)
        libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7ef4000)
        libselinux.so.1 => /lib/libselinux.so.1 (0xb7edb000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7da7000)
        /lib/ld-linux.so.2 (0xb7f30000)

Running:

etch:/usr/src/selinux-policy-refpolicy-src# run_init iptables -L  
Authenticating root.
Password: 
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Triggers:

Nov 19 16:21:02 etch kernel: audit(1195485662.647:41): avc:  denied  { getattr } for  pid=2882 comm="iptables" name="/" dev=selinuxfs ino=475 scontext=user_u:system_r:iptables_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem
Nov 19 16:21:02 etch kernel: ip_tables: (C) 2000-2006 Netfilter Core Team

Binaries with libblkid.so.1:

etch:/usr/src/selinux-policy-refpolicy-src# for x in /bin/* /sbin/*; do objdump -p $x 2>/dev/null|egrep -s 'NEEDED[[:space:]]+libblkid.so.1' >/dev/null&& ls -Z $x; done
-rwsr-xr-x  root root system_u:object_r:mount_exec_t:s0 /bin/mount
-rwsr-xr-x  root root system_u:object_r:mount_exec_t:s0 /bin/umount
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/blkid
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /sbin/debugfs
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/e2fsck
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/e2label
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/findfs
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/fsck
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/fsck.ext2
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/fsck.ext3
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/mke2fs
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/mkfs.ext2
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/mkfs.ext3
lrwxrwxrwx  root root system_u:object_r:bin_t:s0       /sbin/swapoff -> swapon
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/swapon
-rwxr-xr-x  root root system_u:object_r:fsadm_exec_t:s0 /sbin/tune2fs

Binaries with libselinux.so.1:

etch:/usr/src/selinux-policy-refpolicy-src# for x in /bin/* /sbin/*; do objdump -p $x 2>/dev/null|egrep -s 'NEEDED[[:space:]]+libselinux.so.1' >/dev/null&& ls -Z $x; done
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /bin/cp
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /bin/dir
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /bin/ls
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /bin/mkdir
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /bin/mknod
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /bin/mv
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /bin/vdir
-rwxr-xr-x  root root system_u:object_r:init_exec_t:s0 /sbin/init
-rwxr-xr-x  root root system_u:object_r:iptables_exec_t:s0 /sbin/ip6tables
-rwxr-xr-x  root root system_u:object_r:iptables_exec_t:s0 /sbin/ip6tables-restore
-rwxr-xr-x  root root system_u:object_r:iptables_exec_t:s0 /sbin/ip6tables-save
-rwxr-xr-x  root root system_u:object_r:iptables_exec_t:s0 /sbin/iptables
-rwxr-xr-x  root root system_u:object_r:iptables_exec_t:s0 /sbin/iptables-restore
-rwxr-xr-x  root root system_u:object_r:iptables_exec_t:s0 /sbin/iptables-save
lrwxrwxrwx  root root system_u:object_r:bin_t:s0       /sbin/restorecon -> setfiles
lrwxrwxrwx  root root system_u:object_r:bin_t:s0       /sbin/scsi_id -> /lib/udev/scsi_id
-rwxr-xr-x  root root system_u:object_r:setfiles_exec_t:s0 /sbin/setfiles
-rwxr-xr-x  root root system_u:object_r:sulogin_exec_t:s0 /sbin/sulogin
lrwxrwxrwx  root root system_u:object_r:bin_t:s0       /sbin/telinit -> init
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /sbin/udevcontrol
-rwxr-xr-x  root root system_u:object_r:udev_exec_t:s0 /sbin/udevd
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /sbin/udevsettle
-rwxr-xr-x  root root system_u:object_r:bin_t:s0       /sbin/udevtrigger
-r-sr-xr-x  root root system_u:object_r:chkpwd_exec_t:s0 /sbin/unix_chkpwd
Quoted 45 lines
Quoted 39 lines

email message attachment

Quoted 36 lines

-------- Forwarded Message --------
From: Martin Orr <[email protected]>
To: [email protected]
Subject: [DSE-Dev] /selinux getattr messages
Date: Sat, 23 Jun 2007 12:39:11 +0100

I am using the targeted policy in permissive mode. During boot I get the
following messages:
audit(1182511335.252:36): avc: denied { getattr } for pid=1249 comm="mount" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:mount_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem audit(1182511346.457:47): avc: denied { getattr } for pid=1503 comm="swapon" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:fsadm_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem audit(1182511347.644:48): avc: denied { getattr } for pid=1570 comm="iptables" name="/" dev=selinuxfs ino=318 scontext=system_u:system_r:iptables_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=filesystem

These come because libblkid and iptables are both linked against libselinux,
which locates the selinux mount point in a constructor. When this was
introduced in libselinux, the selinux_get_fs_mount interface was added to
the reference policy to allow this. So mount.te should gain selinux_get_fs_mount(mount_t)
and fstools.te should gain selinux_get_fs_mount(fsadm_t)

So far as I can see iptables has no need to be linked against libselinux,
but I will check further.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150
Signature · 7 lines
Zito


--
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.