Skip to contentSkip to conversation

selinux in RH8

DISCUSSION [email protected] 2 participants 2 messages Nov 7, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

I found the problems with the kernel and re-install all selinux from the
beginning. Everything went fine, no compilations problems at all. All utils were built correctly. ....

make reset

reboot and got only one error.

avc: denied {write} for pid=396 exe=/bin/bash path=/etc/passwd dev=03:05 ino=231078 scontext=system_u:system_r:initrc_t
tcontext=system_u:object_r:etc_t tclass=file

System booted ok and I logged as root and changed to system_r context and did a

make relabel

and got the following

avc: denied { read } for pid=686 exe=/usr/local/selinux/bin/checkpolicy path=/usr/src/selinux/policy/Makefile dev=03:05 ino=882701 scontext=root:sysadm_r:checkpolicy_t tcontext=system_u:object_r:src_t tclass=file /usr/local/selinux/bin/setfiles file_contexts/file_contexts mount | awk '/(ext[23]|reiserfs)/{print $3}'
/usr/local/selinux/bin/setfiles: Running on a SELinux kernel, using new system calls

avc: denied { read } for pid=687 exe=/usr/local/selinux/bin/setfiles path=/usr/src/selinux/policy/file_contexts/file_contexts dev=03:05 ino=883914 scontext=root:sysadm_r:setfiles_t tcontext=system_u:object_r:src_t tclass=file /usr/local/selinux/bin/setfiles: read 846 specifications /usr/local/selinux/bin/setfiles: labeling files under /

avc: denied { write } for pid=687 exe=/usr/local/selinux/bin/setfiles path=/dev/tty1 dev=03:05 ino=39346 scontext=root:sysadm_r:setfiles_t tcontext=system_u:object_r:tty_device_t tclass=chr_file /usr/local/selinux/bin/setfiles: conflicting specifications for /sbin/mkfs.ext3 and /sbin/mkfs.ext2, using system_u:object_r:fsadm_exec_t. /usr/local/selinux/bin/setfiles: hash table stats: 159697 elements, 30356/65536 buckets used, longest chain length 14 /usr/local/selinux/bin/setfiles: labeling files under /home /usr/local/selinux/bin/setfiles: hash table stats: 1182 elements, 1182/65536 buckets used, longest chain length 1 /usr/local/selinux/bin/setfiles: Done.

Finally I started mysqld daemon that went ok but when started apache got:

Starting httpd:
avc: denied { name_bind } for pid=802 exe=/usr/sbin/httpd port=80 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:http_port_t tclass=tcp_socket

ps -e --context

execute as expected.

I believe I am almost there. What is missing?
I read about OSDgroup and the SElinux distribution available as a beta
version. Why there is no comment in the list about?

Thanks a lot for the help.

Aldrovando Azeredo. Mathematics Department UFSC- Santa Catarina Brazil

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

--
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 5 lines · On Thu, 7 Nov 2002 23:29, [email protected] wrote:

reboot and got only one error.

avc: denied {write} for pid=396 exe=/bin/bash path=/etc/passwd dev=03:05 ino=231078 scontext=system_u:system_r:initrc_t tcontext=system_u:object_r:etc_t tclass=file

Strange. There's no good reason for a shell script to try and write to /etc/passwd. I suggest that you look into this. If you boot the machine in enforcing mode then the script in question will probably tell you what it was trying to do.

Quoted 7 lines

make relabel

and got the following

avc: denied { read } for pid=686 exe=/usr/local/selinux/bin/checkpolicy path=/usr/src/selinux/policy/Makefile dev=03:05 ino=882701 scontext=root:sysadm_r:checkpolicy_t tcontext=system_u:object_r:src_t

If you have the policy source in /etc/selinux, /etc/security/selinux/source, /usr/share/selinux, or /usr/lib/selinux then it'll get labelled with policy_src_t and this won't be a problem.

Quoted 4 lines

avc: denied { read } for pid=687 exe=/usr/local/selinux/bin/setfiles path=/usr/src/selinux/policy/file_contexts/file_contexts dev=03:05 ino=883914 scontext=root:sysadm_r:setfiles_t tcontext=system_u:object_r:src_t tclass=file

This should be the same as above.

Quoted 3 lines

avc: denied { write } for pid=687 exe=/usr/local/selinux/bin/setfiles path=/dev/tty1 dev=03:05 ino=39346 scontext=root:sysadm_r:setfiles_t tcontext=system_u:object_r:tty_device_t tclass=chr_file

The tty you used to login should not be labelled as tty_device_t, it should be sysadm_tty_device_t, that usually indicates a problem with your login program, however it assigned you the correct security context so it's probably working OK. Look for any error messages in auth.log or on the console when you login as root.

Quoted 2 lines

/usr/local/selinux/bin/setfiles: conflicting specifications for /sbin/mkfs.ext3 and /sbin/mkfs.ext2, using system_u:object_r:fsadm_exec_t.

I've attached a modified fsadm.fc file to solve this and a few other issues I discovered while looking at it. Steve, please commit this to CVS.

Quoted 4 lines

Starting httpd:
avc: denied { name_bind } for pid=802 exe=/usr/sbin/httpd port=80 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:http_port_t tclass=tcp_socket

Did you use run_init to start httpd? It looks to me like you didn't.

httpd is supposed to run in domain httpd_t not domain sysadm_t. If you type "httpd" at the command line you get sysadm_t, if you type the following you should get the right domain:
run_init /etc/init.d/apache start

Quoted 3 lines

I believe I am almost there. What is missing?
I read about OSDgroup and the SElinux distribution available as a
beta version. Why there is no comment in the list about?

There is, but maybe the message hadn't yet reached you when you asked the question. It takes quite a while for a message sent to this list to get delivered, 5+ hour delays are not uncommon.

Signature · 4 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page
# fs admin utilities
/sbin/fsck.*			system_u:object_r:fsadm_exec_t
/sbin/mkfs.*			system_u:object_r:fsadm_exec_t
/sbin/e2fsck			system_u:object_r:fsadm_exec_t
/sbin/reiserfs(ck|tune)		system_u:object_r:fsadm_exec_t
/sbin/mkreiserfs		system_u:object_r:fsadm_exec_t
/sbin/e2label			system_u:object_r:fsadm_exec_t
/sbin/mkfs			system_u:object_r:fsadm_exec_t
/sbin/mke2fs			system_u:object_r:fsadm_exec_t
/sbin/mkswap			system_u:object_r:fsadm_exec_t
/sbin/scsi_info			system_u:object_r:fsadm_exec_t
/sbin/sfdisk			system_u:object_r:fsadm_exec_t
/sbin/cfdisk			system_u:object_r:fsadm_exec_t
/sbin/fdisk			system_u:object_r:fsadm_exec_t
/sbin/tune2fs			system_u:object_r:fsadm_exec_t
/sbin/dumpe2fs			system_u:object_r:fsadm_exec_t
/sbin/swapon			system_u:object_r:fsadm_exec_t
/sbin/hdparm			system_u:object_r:fsadm_exec_t
/sbin/raidstart			system_u:object_r:fsadm_exec_t
/sbin/mkraid			system_u:object_r:fsadm_exec_t
/sbin/blockdev			system_u:object_r:fsadm_exec_t
/sbin/losetup			system_u:object_r:fsadm_exec_t
/usr/sbin/updfstab		system_u:object_r:fsadm_exec_t
/usr/sbin/smart(d|ctl)		system_u:object_r:fsadm_exec_t