Skip to contentSkip to conversation

Swollen su_macros.te file

DISCUSSION Brad Chapman 3 participants 15 messages Aug 11, 2002 – Aug 13, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

Mr. Russell,

Lately I have noticed that my su_macros.te file is becoming unmanageable
due to the enormous amount of stuff that I use su for. Could you (and the list) please review my su_macros.te file and tell me how to make it smaller?

Thanks,

Brad

=====
Brad Chapman

Permanent e-mails: [email protected]
[email protected]
[email protected]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

#1 lore raw
Quoted 4 lines · Brad Chapman

Lately I have noticed that my su_macros.te file is becoming
unmanageable due to the enormous amount of stuff that I use su for. Could you (and the list) please review my su_macros.te file and tell me how to make it smaller?

I think that you have something wrong with your setup. The $1_su_t domain is only to be used for the "su" program, I think that you are using the shell in that domain too for some reason.

$1_su_t should not have access to man pages, home directories, sysctl, debian_menu_t, device files, boot_t, etc.

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.

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

Mr. Russell,

Quoted 6 lines · --- Russell Coker
Quoted 4 lines · Brad Chapman

Lately I have noticed that my su_macros.te file is becoming
unmanageable due to the enormous amount of stuff that I use su for. Could you (and the list) please review my su_macros.te file and tell me how to make it smaller?

Quoted 8 lines

I think that you have something wrong with your setup. The $1_su_t domain is

only to be used for the "su" program, I think that you are using the shell in

that domain too for some reason.

$1_su_t should not have access to man pages, home directories, sysctl, debian_menu_t, device files, boot_t, etc.

I know, but everything keeps showing up as $1_su_t instead of
the correct domain, such as insmod_t, devfsd_t, init_t, etc. I wouldn't have had this problem if that wasn't the case.

BTW, here are some more files which look more like spaghetti pots
IMHO. They are devfsd.te, admin_macros.te, and xserver_macros.te. I would very much like to straighten these messy files out. Thanks for your help.

Brad

=====
Brad Chapman

Permanent e-mails: [email protected]
[email protected]
[email protected]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

#3 lore raw
Quoted 11 lines · Brad Chapman
Quoted 11 lines
Quoted 4 lines

Lately I have noticed that my su_macros.te file is becoming
unmanageable due to the enormous amount of stuff that I use su for. Could you (and the list) please review my su_macros.te file and tell me how to make it smaller?

I think that you have something wrong with your setup. The $1_su_t domain is

only to be used for the "su" program, I think that you are using the shell in

Quoted 8 lines
Quoted 4 lines

that domain too for some reason.

$1_su_t should not have access to man pages, home directories, sysctl, debian_menu_t, device files, boot_t, etc.

I know, but everything keeps showing up as $1_su_t instead of
the correct domain, such as insmod_t, devfsd_t, init_t, etc. I wouldn't have had this problem if that wasn't the case.

Giving one domain access to everything brings you back towards the standard Linux permission system.

What you have to do is determine why it isn't transitioning back to the correct domain.

Maybe your shell is not labelled as shell_exec_t.

Quoted 3 lines

BTW, here are some more files which look more like spaghetti pots
IMHO. They are devfsd.te, admin_macros.te, and xserver_macros.te. I would very much like to straighten these messy files out. Thanks for your help.

You will be better off copying from the latest versions I maintain, especially for devfsd. Also what distribution do you use? If it's not Debian then make sure the init scripts for devfsd are run in the same way as the Debian package regarding making device nodes for non-devfs devices. If it is Debian then upgrade to the latest devfsd package.

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.

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

Mr. Russell,

Quoted 21 lines · --- Russell Coker
Quoted 11 lines · Brad Chapman
Quoted 11 lines
Quoted 4 lines

Lately I have noticed that my su_macros.te file is becoming
unmanageable due to the enormous amount of stuff that I use su for. Could you (and the list) please review my su_macros.te file and tell me how to make it smaller?

I think that you have something wrong with your setup. The $1_su_t domain is

only to be used for the "su" program, I think that you are using the shell in

Quoted 8 lines
Quoted 4 lines

that domain too for some reason.

$1_su_t should not have access to man pages, home directories, sysctl, debian_menu_t, device files, boot_t, etc.

I know, but everything keeps showing up as $1_su_t instead of
the correct domain, such as insmod_t, devfsd_t, init_t, etc. I wouldn't have had this problem if that wasn't the case.

Quoted 7 lines

Giving one domain access to everything brings you back towards the standard Linux permission system.

What you have to do is determine why it isn't transitioning back to the correct domain.

Maybe your shell is not labelled as shell_exec_t.

It is labeled as shell_exec_t.

Quoted 10 lines
Quoted 4 lines

BTW, here are some more files which look more like spaghetti pots
IMHO. They are devfsd.te, admin_macros.te, and xserver_macros.te. I would very much like to straighten these messy files out. Thanks for your help.

You will be better off copying from the latest versions I maintain, especially for devfsd. Also what distribution do you use? If it's not Debian then make sure the init scripts for devfsd are run in the same way as the Debian package regarding making device nodes for non-devfs devices. If it is Debian then upgrade to the latest devfsd package.

I know that, but how long will it take me to remove all of the errors
that I KNOW will pop up, because of basic differences in locations and such? I use Red Hat 6.2, BTW.

Brad

=====
Brad Chapman

Permanent e-mails: [email protected]
[email protected]
[email protected]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
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
Quoted 10 lines · Brad Chapman
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

$1_su_t should not have access to man pages, home directories, sysctl, debian_menu_t, device files, boot_t, etc.

I know, but everything keeps showing up as $1_su_t instead of
the correct domain, such as insmod_t, devfsd_t, init_t, etc. I wouldn't have had this problem if that wasn't the case.

Giving one domain access to everything brings you back towards the standard Linux permission system.

Quoted 6 lines
Quoted 4 lines

What you have to do is determine why it isn't transitioning back to the correct domain.

Maybe your shell is not labelled as shell_exec_t.

It is labeled as shell_exec_t.

Check that you have the domain_auto_trans() macro correctly functioning for transitioning to the user_t domain from user_su_t on execute of shell_exec_t.

Inside the domain_auto_trans macro put the following line for debugging purposes:
#DOMAIN_AUTO_TRANS($1, $2, $3)

Then you'll be able to easily check that the correct rule is going in.

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

BTW, here are some more files which look more like spaghetti
pots IMHO. They are devfsd.te, admin_macros.te, and xserver_macros.te. I would very much like to straighten these messy files out. Thanks for your help.

You will be better off copying from the latest versions I maintain, especially for devfsd. Also what distribution do you use? If it's not Debian then make sure the init scripts for devfsd are run in the same way as the Debian package regarding making device nodes for non-devfs devices. If it is Debian then upgrade to the latest devfsd package.

Quoted 3 lines

I know that, but how long will it take me to remove all of the
errors that I KNOW will pop up, because of basic differences in locations and such? I use Red Hat 6.2, BTW.

The easy way to solve these problems is to find out why things aren't working as they should and fix it.

The hard way is to continually hack in extra rules for domains that shouldn't have them so that eventually every domain can do almost everything, and you lose most of the security you wanted to gain from SE Linux in the first place.

The NSA people wrote their original policy for Red Hat. In my changes I have been careful to try and avoid doing things that are likely to break it for Red Hat users. Steve is presumably still testing his policy on Red Hat before commiting it to the CVS.

Getting it to work on Red Hat should not be THAT difficult.

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.

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

#6 lore raw

Mr. Russell,

Quoted 4 lines · --- Russell Coker
Quoted 2 lines · Brad Chapman

It is labeled as shell_exec_t.

Quoted 8 lines

Check that you have the domain_auto_trans() macro correctly functioning for transitioning to the user_t domain from user_su_t on execute of shell_exec_t.

Inside the domain_auto_trans macro put the following line for debugging purposes:
#DOMAIN_AUTO_TRANS($1, $2, $3)

Then you'll be able to easily check that the correct rule is going in.

ACK.

Quoted 14 lines
Quoted 3 lines

I know that, but how long will it take me to remove all of the
errors that I KNOW will pop up, because of basic differences in locations and such? I use Red Hat 6.2, BTW.

The easy way to solve these problems is to find out why things aren't working

as they should and fix it.

The hard way is to continually hack in extra rules for domains that shouldn't

have them so that eventually every domain can do almost everything, and you lose most of the security you wanted to gain from SE Linux in the first place.

Quoted 7 lines

The NSA people wrote their original policy for Red Hat. In my changes I have

been careful to try and avoid doing things that are likely to break it for Red Hat users. Steve is presumably still testing his policy on Red Hat before commiting it to the CVS.

Getting it to work on Red Hat should not be THAT difficult.

All right. I'll try it out and report back any major problems I have.

Quoted 6 lines
Signature · 5 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
From field.

=====
Brad Chapman

Permanent e-mails: [email protected]
[email protected]
[email protected]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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

#7 lore raw
In reply to Brad Chapman
Quoted 3 lines · Brad Chapman

Lately I have noticed that my su_macros.te file is becoming unmanageable
due to the enormous amount of stuff that I use su for. Could you (and the list) please review my su_macros.te file and tell me how to make it smaller?

Assuming Russell does not help you with his line of questioning (which I won't duplicate here), how do you use su to get root access?

What is the output of "id"[1] before and after the su command?

Note:
[1] I am assuming your version of su has been modified to display the SE-Linux label here.

Signature · 6 lines
Brian May <[email protected]>

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

Mr. May,

Quoted 9 lines · --- Brian May
Quoted 1 line · Brad Chapman

Lately I have noticed that my su_macros.te file is becoming

unmanageable

Quoted 1 line

due to the enormous amount of stuff that I use su for. Could you (and the

list)

Quoted 1 line

please review my su_macros.te file and tell me how to make it smaller?

Assuming Russell does not help you with his line of questioning (which I won't duplicate here), how do you use su to get root access?

By typing plain 'su', not 'su -l'.

Quoted 2 lines

What is the output of "id"[1] before and after the su command?

        A-HA!

        Before: uid=500(Brad) gid=500(Brad)
                groups=500(Brad),4(adm),20(games),100(users)
 
                context=Brad:sysadm_r:sysadm_t sid=243

        After: uid=0(root) gid=0(root)        
               groups=0(root),1(bin),2(daemon),3(sys),4(adm),
               6(disk),10(wheel),20(games)

                context=Brad:sysadm_r:sysadm_t sid=243

        The context REMAINS THE SAME! Even when I use 'su -l' !!!

        What does this mean?  
Quoted 6 lines

Note:
[1] I am assuming your version of su has been modified to display the SE-Linux label here.

Signature · 1 line
Brian May <[email protected]>

Brad

=====
Brad Chapman

Permanent e-mails: [email protected]
[email protected]
[email protected]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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

#9 lore raw
Quoted 3 lines · Brad Chapman

The context REMAINS THE SAME! Even when I use 'su -l' !!!

What does this mean?

This means that su is operating correctly on your system.

So how do you cause the situation where your programs are running in the su domain and causing the errors to be logged?

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.

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

#10 lore raw

Mr. Russell,

Quoted 6 lines · --- Russell Coker
Quoted 3 lines · Brad Chapman

The context REMAINS THE SAME! Even when I use 'su -l' !!!

What does this mean?

This means that su is operating correctly on your system.

Um.... OK. Could you explain that?

Quoted 4 lines

So how do you cause the situation where your programs are running in the su domain and causing the errors to be logged?

I don't know. Does it have anything to do with the domain_auto_trans()
m4 macro, or does it have to do with the use of su at all?

Brad

=====
Brad Chapman

Permanent e-mails: [email protected]
[email protected]
[email protected]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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

#11 lore raw
Quoted 3 lines · Brad Chapman
Quoted 1 line

This means that su is operating correctly on your system.

Um.... OK. Could you explain that?

su is not meant to change your context, and in your case it isn't.

That is good.

Signature · 6 lines
Brian May <[email protected]>

--
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.
#12 lore raw
In reply to Brad Chapman
Quoted 1 line · Brad Chapman

Mr. Russell,

Mr. Brad,
What's with the "Mr" prefix to all email?

Quoted 9 lines
Quoted 6 lines · --- Russell Coker
Quoted 3 lines · Brad Chapman

The context REMAINS THE SAME! Even when I use 'su -l' !!!

What does this mean?

This means that su is operating correctly on your system.

Um.... OK. Could you explain that?

The point of the su domain is that the su program runs in it's own domain with access to authenticate the user and then transitions back to the original domain that it was run from. So you run su from user_t, and then after the su you're in user_t again.

Quoted 6 lines
Quoted 2 lines

So how do you cause the situation where your programs are running in the su domain and causing the errors to be logged?

I don't know. Does it have anything to do with the
domain_auto_trans() m4 macro, or does it have to do with the use of su at all?

Show me the error messages from your system logs that caused you to add all those rules. They will contain the name of the program which was denied access.

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.

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

#13 lore raw

Mr. Russell,

Quoted 5 lines · --- Russell Coker
Quoted 1 line · Brad Chapman

Mr. Russell,

Mr. Brad,
What's with the "Mr" prefix to all email?

Politeness. Being polite to a person over e-mail gets you listened to ;)

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines · --- Russell Coker
Quoted 3 lines · Brad Chapman

The context REMAINS THE SAME! Even when I use 'su -l' !!!

What does this mean?

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

This means that su is operating correctly on your system.

Um.... OK. Could you explain that?

The point of the su domain is that the su program runs in it's own domain with access to authenticate the user and then transitions back to the original domain that it was run from. So you run su from user_t, and then after the su you're in user_t again.

Aahhhh - OK, I understand.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

So how do you cause the situation where your programs are running in the su domain and causing the errors to be logged?

I don't know. Does it have anything to do with the
domain_auto_trans() m4 macro, or does it have to do with the use of su at all?

Show me the error messages from your system logs that caused you to add all those rules. They will contain the name of the program which was denied access.

TBH, I never retained any. But I can tell you that any and every
program not already covered caused errors. For example, programs like rpm, lilo, kwrite, kedit, XFree86, quake3.x86, devfsd, insmod, depmod, smbd, nmbd, etc would all generate errors, all from the scontext of Brad:sysadm_r:sysadm_su_t (I made myself a sysadm as an experiment. Maybe that's the problem?)

BTW, should I try your policy now, or wait until this is fixed,
then try your policy?

Brad

=====
Brad Chapman

Permanent e-mails: [email protected]
[email protected]
[email protected]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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

#14 lore raw
Quoted 11 lines · Brad Chapman
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

So how do you cause the situation where your programs are running in the su domain and causing the errors to be logged?

I don't know. Does it have anything to do with the
domain_auto_trans() m4 macro, or does it have to do with the use of su at all?

Show me the error messages from your system logs that caused you to add all those rules. They will contain the name of the program which was denied access.

Quoted 6 lines

TBH, I never retained any. But I can tell you that any and every
program not already covered caused errors. For example, programs like rpm, lilo, kwrite, kedit, XFree86, quake3.x86, devfsd, insmod, depmod, smbd, nmbd, etc would all generate errors, all from the scontext of Brad:sysadm_r:sysadm_su_t (I made myself a sysadm as an experiment. Maybe that's the problem?)

Firstly, you should not be running quake etc as sysadm_t. Running programs that are known to be a security risk (such as games) with administrative privs is a bad idea.

Quoted 2 lines

BTW, should I try your policy now, or wait until this is fixed,
then try your policy?

Either should work. But if you want to try my policy then do it now.

Russell Coker

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