LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-10-2011, 06:11 PM   #1
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: a few...
Posts: 654

Rep: Reputation: 32
sudo to disallow certain commands


Hello there

I'm trying to devise a new sudoers configuration while building a new SOE and would like to force everyone (including system administrators) to use rootsh in favour of doing things like sudo -s, sudo bash, sudo tcsh and so forth. Effectively, use sudo to use any shell other than rootsh.

Is there a way to allow users to run anything they want except shells. I realise this is a default permit which inherently is defective, but I'm not convinced that going through the 1559 executable commands of my (as yet incomplete) built system to decided on the likely 1000+ commands I would want to be genuinely allowed.

As I said this is for system administrators first, and I'd like to forcibly instil the habit of sudo <command> or using rootsh to get an audited shell. But I know people are already not doing enough sudo <command> as it stands, rather they switch to bash, but any auditing would help.

Any strategies or settings I'm just not seeing?

For reference this is on RHEL6 with sudo 1.7.2p2-9.el6.x86_64

Any help appreciated
 
Old 01-10-2011, 06:44 PM   #2
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,654
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Just make the programs you don't want used (by $USER) a member of the admin/root group.

And re/edit the /etc/sudoers file to reflect the same.

Also check your .bashrc/.zshrc (shell config) and remove/comment (#) any undesired aliases/commands.

Hope this helps, Glenn

Last edited by GlennsPref; 01-10-2011 at 06:45 PM. Reason: undesired aliases
 
Old 01-10-2011, 07:35 PM   #3
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: a few...
Posts: 654

Original Poster
Rep: Reputation: 32
Sorry, how should i make them a member? You mean chown root:root ... but that doesn't seem right because:
Code:
[root@pomelo chakkerz]# ls -l /bin/bash
-rwxr-xr-x. 1 root root 943248 Jun 23  2010 /bin/bash
And I don't see anything in the default /etc/sudoers file that appears relevant either ... well there is the User_Alias and Cmnd_Alias stuff .. but that doesn't seem entirely relevant...

Can you give me more detail please?

Thanks for the Alias comment ... i was going to forget that.
 
Old 01-10-2011, 08:04 PM   #4
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,654
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Oh, sorry 'bout that, I meant to say the "wheel" group.

Then only members of the wheel group have access

Without a gui it's a bit hard to everything at once, but you may dictate which shell (bash, csh, zsh, etcetera etcetera) users have access to.

and from there you may be able to restrict users, but if you want everybody to have admin rights, it may be difficult to split them into categories/groups.

You may use the wheel group and sudo to do it. (I think

Glenn
 
Old 01-10-2011, 08:38 PM   #5
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: a few...
Posts: 654

Original Poster
Rep: Reputation: 32
wheel group - hmm ... no good:

[root@pomelo puppet]# which tcsh
/bin/tcsh
[root@pomelo puppet]# chgrp wheel /bin/tcsh
[root@pomelo puppet]# visudo
## where I allowed myself to do ALL, everywhere ... same as root
[root@pomelo puppet]# exit
[chakkerz@pomelo ~]$ sudo bash
[sudo] password for chakkerz:
[root@pomelo chakkerz]# exit
[chakkerz@pomelo ~]$ sudo tcsh
[root@pomelo chakkerz]#
 
Old 01-10-2011, 08:41 PM   #6
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: a few...
Posts: 654

Original Poster
Rep: Reputation: 32
%nsysadm ALL=ALL,!/bin/tcsh

Maybe this is the answer...
 
Old 01-10-2011, 09:01 PM   #7
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,654
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
That's all I got.

All the best! Glenn

http://glennwaller.blogspot.com/2010...-and-sudo.html

Last edited by GlennsPref; 01-10-2011 at 09:02 PM. Reason: fix url truncation
 
  


Reply

Tags
auditting, default permit, sudo



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
[SOLVED] Allow commands without SUDO Touch Linux - Newbie 6 01-05-2011 08:33 AM
Problem using sudo <commands> just a man Ubuntu 13 06-05-2009 11:13 AM
sudo not giving me all commands, I have to su. Romanus81 Slackware 6 03-14-2008 09:26 AM
Limited 'sudo' commands Casket Linux - Security 1 10-23-2007 02:05 AM
sudo and at commands ulto Programming 2 05-01-2004 08:36 AM

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

All times are GMT -5. The time now is 12:58 PM.

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