Skip to contentSkip to conversation

New SuSE rules

DISCUSSION Carsten Grohmann 2 participants 6 messages Aug 1, 2002 – Aug 2, 2002 2 messages not in the archive SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi all together!

My new rule set for SuSE can be found under
http://www.carstengrohmann.de/download/selinux/.
This include additional rules for the getty_t, so that runs now fine with the suse mingetty.
I am sorry, but this time the file README.suserules are only in german.

Please mail me any comments, if it works fine, if there problems ....

Carsten

--
You have received this message because you are subscribed to the selinux 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 7 lines · Carsten Grohmann

My new rule set for SuSE can be found under
http://www.carstengrohmann.de/download/selinux/.
This include additional rules for the getty_t, so that runs now fine with the suse mingetty.
I am sorry, but this time the file README.suserules are only in german.

Please mail me any comments, if it works fine, if there problems ....

Firstly try and avoid using file_type and domain if possible. I really doubt that getty needs to be able to read everything under /proc/[0-9]* and stat every file or device on the file system.

I guess that it's doing some type of "lsof" operation, so some dontaudit would be in order.

What is /dev/blog? It's not in Documentation/devices.txt in the kernel source...

Quoted 3 lines

# Allow access to modules_object_t (lib/modules) allow initrc_t modules_object_t:dir { write remove_name }; allow initrc_t modules_dep_t:file { unlink };

Why does initrc_t need to remove files from /lib/modules? Perhaps a domain transition to update_modules_t is what you need...

Quoted 3 lines

# Access to file_t (/opt)
allow ldconfig_t file_t:dir { getattr read search }; allow ldconfig_t file_t:{ file lnk_file } { getattr read };

You should never grant anything access to file_t. The existance of file_t labelled objects indicates a deficiency in yout file_contexts.

Quoted 2 lines

# Access to /dev/xconsole
allow syslogd_t device_t:fifo_file { ioctl read write };

We need a better type for that pipe.

Quoted 2 lines

# Access to /dev/tty10
allow syslogd_t tty_device_t:chr_file { append ioctl };

Do you realise that anyone can kill the machine by pressing ^S on VC 10?

Quoted 1 line

file_type_auto_trans(ntpd_t, etc_t, etc_ntp_t)

Why does ntpd need to create files under /etc? Must be a deficiency in the package.

Quoted 1 line

allow ntpd_t console_device_t:chr_file { read write };

My Debian package has the following patch to macros/global_macros.te to address that:
-allow $1_t console_device_t:chr_file rw_file_perms;
+allow $1_t { sysadm_tty_device_t console_device_t }:chr_file rw_file_perms;

Quoted 3 lines

# Access to /proc/sys/kernel
allow ntpd_t sysctl_kernel_t:dir { search };
allow ntpd_t sysctl_kernel_t:file { read };

That's in my Debian package.

Quoted 2 lines

# Access to /var
allow ntpd_t var_t:dir { search };

That's in the daemon_domain macro, it should have worked without that.

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

--
You have received this message because you are subscribed to the selinux 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

Am Donnerstag, 1. August 2002 17:13 schrieb Russell Coker:

Quoted 3 lines

Firstly try and avoid using file_type and domain if possible. I really doubt that getty needs to be able to read everything under /proc/[0-9]* and stat every file or device on the file system.

It's a problem with SuSE's mingetty. It reads all or the most /proc/<PID> directories and all files in /var/log. So I have to add this rules. I wrote to SuSE to change the mingetty program. On the other side, you can use Red Hat's mingetty, with runs fine without this additional rules.

Quoted 2 lines

I guess that it's doing some type of "lsof" operation, so some dontaudit would be in order.

It is not possible to deny this operations, because mingetty will not work correct.

Quoted 2 lines

What is /dev/blog? It's not in Documentation/devices.txt in the kernel source...

The blod daemon is an part of the SuSE boot concept.

Quoted 6 lines
Quoted 3 lines

# Allow access to modules_object_t (lib/modules) allow initrc_t modules_object_t:dir { write remove_name }; allow initrc_t modules_dep_t:file { unlink };

Why does initrc_t need to remove files from /lib/modules? Perhaps a domain transition to update_modules_t is what you need...

I can not change the domain, because the boot script (/etc/init.d/boot) remove /lib/modules/'uname -r'/modules.dep. I see not a possibility to do a domain transition for this -- it is a shell script with an rm in it.

Quoted 6 lines
Quoted 3 lines

# Access to file_t (/opt)
allow ldconfig_t file_t:dir { getattr read search }; allow ldconfig_t file_t:{ file lnk_file } { getattr read };

You should never grant anything access to file_t. The existance of file_t labelled objects indicates a deficiency in yout file_contexts.

The NSA distribution have not a type for /opt. Next days I will send a patch to correct this.

Quoted 4 lines
Quoted 2 lines

# Access to /dev/xconsole
allow syslogd_t device_t:fifo_file { ioctl read write };

We need a better type for that pipe.

Done. I label it as devlog_t.

Quoted 4 lines
Quoted 2 lines

# Access to /dev/tty10
allow syslogd_t tty_device_t:chr_file { append ioctl };

Do you realise that anyone can kill the machine by pressing ^S on VC 10?

No this was me unknown. Could it be that this problem not selinux specific? I don't no any solution. Have you disabled the log messages on tty10?

Quoted 4 lines
Quoted 1 line

file_type_auto_trans(ntpd_t, etc_t, etc_ntp_t)

Why does ntpd need to create files under /etc? Must be a deficiency in the package.

On SuSE: Under /etc are the ntpd configuration file and ntp.dift.

Thanks for your comment

Carsten

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 7 lines · Carsten Grohmann

Am Donnerstag, 1. August 2002 17:13 schrieb Russell Coker:

Quoted 3 lines

Firstly try and avoid using file_type and domain if possible. I really doubt that getty needs to be able to read everything under /proc/[0-9]* and stat every file or device on the file system.

It's a problem with SuSE's mingetty. It reads all or the most /proc/<PID> directories and all files in /var/log. So I have to add this rules. I wrote

Just because a program tries something does not mean that it needs to do it. For example I have added many dontaudit rules for sysadm_home_dir_t (sysadm_home_t for the NSA policy) because of daemons that try to access files or directories under /root and have no need to do so.

Any domain that runs "ps" will request access to all of /proc/[0-9]*. The only domain that needs such access is sysadm_t to allow the administrator to see what's running.

There is no way that mingetty could require access to ps data on all domains, it may require access to all userdomain, but definately not domain!

Why should a getty know anything about a dhcp server, BIND, or a mail server?

Quoted 2 lines

to SuSE to change the mingetty program. On the other side, you can use Red Hat's mingetty, with runs fine without this additional rules.

Can you email me the source and binary of this SuSe mingetty, I'll look into it and determine what it really needs (or how to fix it).

Quoted 5 lines
Quoted 2 lines

I guess that it's doing some type of "lsof" operation, so some dontaudit would be in order.

It is not possible to deny this operations, because mingetty will not work correct.

How does it fail?

Quoted 4 lines
Quoted 2 lines

What is /dev/blog? It's not in Documentation/devices.txt in the kernel source...

The blod daemon is an part of the SuSE boot concept.

How does it work? What does it do?

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

# Allow access to modules_object_t (lib/modules) allow initrc_t modules_object_t:dir { write remove_name }; allow initrc_t modules_dep_t:file { unlink };

Why does initrc_t need to remove files from /lib/modules? Perhaps a domain transition to update_modules_t is what you need...

I can not change the domain, because the boot script (/etc/init.d/boot) remove /lib/modules/'uname -r'/modules.dep. I see not a possibility to do a domain transition for this -- it is a shell script with an rm in it.

Why not just have your rpm package of SE Linux replace that shell script with another one that does it differently? Surely RPM has some equivalent to the diversion mechanism I use in some of my Debian packages...

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

# Access to file_t (/opt)
allow ldconfig_t file_t:dir { getattr read search }; allow ldconfig_t file_t:{ file lnk_file } { getattr read };

You should never grant anything access to file_t. The existance of file_t labelled objects indicates a deficiency in yout file_contexts.

The NSA distribution have not a type for /opt. Next days I will send a patch to correct this.

I suggest making opt root_t as it's likely to be the root of a different file system (and it's not something you'll restrict access to unless you're restricting access to the root directory). Then have rules labelling /opt/.*/bin(|/.*) bin_t, etc.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

# Access to /dev/xconsole
allow syslogd_t device_t:fifo_file { ioctl read write };

We need a better type for that pipe.

Done. I label it as devlog_t.

I'm not sure if that's a good idea. The sock_file vs fifo_file distinction will allow you to suitably lock it down, but there may be confusion among administrators as to what to do.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

# Access to /dev/tty10
allow syslogd_t tty_device_t:chr_file { append ioctl };

Do you realise that anyone can kill the machine by pressing ^S on VC 10?

No this was me unknown. Could it be that this problem not selinux specific? I don't no any solution. Have you disabled the log messages on tty10?

It's not a SE Linux issue. I noticed the problem years ago on Debian and AFAIK all distributions have always had it. I just don't enable logging to a VC unless you have a moderate amount of trust that the local users aren't malicious or careless enough to do it. If you press ^S the write buffers eventually fill up, syslogd stops accepting logs, and then everything that tries to log will not work. Logging in does an log write and therefore you can't login to a machine in such a state.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

file_type_auto_trans(ntpd_t, etc_t, etc_ntp_t)

Why does ntpd need to create files under /etc? Must be a deficiency in the package.

On SuSE: Under /etc are the ntpd configuration file and ntp.dift.

They should change it to be under /var/lib. /etc is for configuration files not for data files that are always changing.

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

--
You have received this message because you are subscribed to the selinux 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: New SuSE rules -- opt file type

Am Donnerstag, 1. August 2002 21:56 schrieb Russell Coker:

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

# Access to file_t (/opt)
allow ldconfig_t file_t:dir { getattr read search }; allow ldconfig_t file_t:{ file lnk_file } { getattr read };

You should never grant anything access to file_t. The existance of file_t labelled objects indicates a deficiency in yout file_contexts.

Quoted 7 lines
Quoted 2 lines

The NSA distribution have not a type for /opt. Next days I will send a patch to correct this.

I suggest making opt root_t as it's likely to be the root of a different file system (and it's not something you'll restrict access to unless you're restricting access to the root directory). Then have rules labelling /opt/.*/bin(|/.*) bin_t, etc.

Why root_t?
The standard policy labled follow directories as file_t:
opt, swap, mnt and some links.
This entries should be not labelling in the same type. If several file system entries have the same security context, I need only grand access to one directory and all other can also access. That's why I think we should use different types.

Carsten

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: New SuSE rules -- opt file type

Quoted 11 lines · Carsten Grohmann

Am Donnerstag, 1. August 2002 21:56 schrieb Russell Coker:

Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

# Access to file_t (/opt)
allow ldconfig_t file_t:dir { getattr read search }; allow ldconfig_t file_t:{ file lnk_file } { getattr read };

You should never grant anything access to file_t. The existance of file_t labelled objects indicates a deficiency in yout file_contexts.

The NSA distribution have not a type for /opt. Next days I will send a patch to correct this.

Quoted 6 lines
Quoted 4 lines

I suggest making opt root_t as it's likely to be the root of a different file system (and it's not something you'll restrict access to unless you're restricting access to the root directory). Then have rules labelling /opt/.*/bin(|/.*) bin_t, etc.

Why root_t?

In what way is my explanation in the preceeding paragraph unclear?

Quoted 2 lines

The standard policy labled follow directories as file_t:
opt, swap, mnt and some links.

What is "swap" directory?

Nothing should have type file_t on a properly configured system. Any existance of file_t indicates inadequacies in the file_contexts.

Quoted 4 lines

This entries should be not labelling in the same type. If several file system entries have the same security context, I need only grand access to one directory and all other can also access. That's why I think we should use different types.

In what situation might you want to grant access to / but not /opt? In what situation might you want to grant access to /opt but not /?

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.