LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-18-2012, 05:07 PM   #1
ohlookpie
LQ Newbie
 
Registered: Apr 2012
Posts: 20

Rep: Reputation: Disabled
SELinux user context staff_u and sudo issues. Also, question related to setting conte


1. I am having issues with sudo and staff_u user context in SELinux. According to RHEL documentation, staff_u is supposed to provide user with sudo access (but not su access), but this is not working out. Here's what's happening:

[root@deepthought ~]# grep "bob" /etc/sudoers
bob ALL=(ALL) ALL
[bob@deepthought ~]$ id -Z
staff_u:staff_r:staff_t:s0-s0:c0.c1023
[bob@deepthought ~]$ sudo -s
[sudo] password for bob:
bash: /root/.bashrc: Permission denied
bash-4.1# exit
[bob@deepthought ~]$ /bin/ls /root
/bin/ls: cannot access /root: Permission denied
[bob@deepthought ~]$ sudo /bin/ls /root
/bin/ls: cannot access /root: Permission denied

2. I am wondering what the difference is between the two following commands:

a. semanage login -m -s staff_u __default__
b. semanage login -m -S targeted -s staff_u -r s0 __default__

I have always used the first command, but in doing some reading online I also see the second command used quite frequently.

3. I know I can get a listing of file contexts doing an seinfo -t (for example, seinfo -t | grep public_content), and I also know that I can find what the context for a file should be by doing matchpathcon <file>, but I am wondering, how do I find out what the contexts actually mean? For example, semanage boolean -l will show me all SELinux booleans and what they do, but semanage fcontext -l does not do this. Let's say I am wondering what public_content_rw_t does, how would I find that out?

Last edited by ohlookpie; 06-18-2012 at 05:33 PM.
 
Old 06-18-2012, 09:04 PM   #2
ohlookpie
LQ Newbie
 
Registered: Apr 2012
Posts: 20

Original Poster
Rep: Reputation: Disabled
Am I asking this question in the wrong subforum? I see almost all questions being answered, but this one still has not had any reply.
 
Old 06-18-2012, 09:09 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
That's because SELinux is a bit of niche skill.
Unfortunately, now you've answered yourself, that takes it off the zero-reply list, which would normally get it bumped up automatically ...
One option may be to ask the Mods (via the Report button) to move it to the Security forum; you might do better over there.
Do NOT re-post this as a duplicate question; thank you.

Good luck
 
1 members found this post helpful.
Old 06-18-2012, 09:24 PM   #4
ohlookpie
LQ Newbie
 
Registered: Apr 2012
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thank you for the reply! I was beginning to think I posted in the wrong subforum, but didn't want to crosspost. I didn't realize I could report my post, so that's really good to know. I reported the post. Thank you so much for your help!
 
Old 06-18-2012, 11:20 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved @ OP's request ...
 
Old 06-19-2012, 04:51 AM   #6
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
I am not an selinux expert, so I may be wrong, but it looks to me like your problem is that your user needs to assume the sysadm_r (system admin role). The user staff_u has this capability, but unless they change roles they will not be able to use privileged commands.

See these links for some additional information:
http://selinux-mac.blogspot.com/2009...inux-rbac.html
and
http://www.gentoo.org/proj/en/harden...2&chap=3#users
 
Old 06-19-2012, 02:00 PM   #7
ohlookpie
LQ Newbie
 
Registered: Apr 2012
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Noway2 View Post
I am not an selinux expert, so I may be wrong, but it looks to me like your problem is that your user needs to assume the sysadm_r (system admin role). The user staff_u has this capability, but unless they change roles they will not be able to use privileged commands.

See these links for some additional information:
http://selinux-mac.blogspot.com/2009...inux-rbac.html
and
http://www.gentoo.org/proj/en/harden...2&chap=3#users
Here's the output from "semanager user -l | grep staff_u"
Quote:
staff_u user s0 s0-s0:c0.c1023 staff_r sysadm_r system_r unconfined_r
The odd thing that I don't fully understand here is that staff_r is mapped to the role of unconfined_r, which doesn't make any sense to me at all. Anyway, I installed policycoreutils-newrole and then tried "newrole -r sysadm_r," typed my password, and still sudo doesn't work.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Related to sudo crahuldba@gmail.com Linux - Newbie 2 06-26-2017 02:44 AM
selinux problem with staff_u theillien Linux - Security 6 03-15-2012 07:12 AM
Fedora 12 SELinux context not updated when changing a user's home directory RichyAD Fedora 4 02-21-2010 05:10 PM
[SOLVED] trouble setting up sudo to allow su - user zrnaqvi Linux - Security 1 11-16-2009 06:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration