public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Grant Taylor <gtaylor@gentoo.tnetconsulting.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
Date: Wed, 26 Oct 2022 10:38:53 -0600	[thread overview]
Message-ID: <69065fc9-fe64-55d6-6347-6001e97286cd@spamtrap.tnetconsulting.net> (raw)
In-Reply-To: <Y1jURxx+uvtr5E/Y@waltdnes.org>

On 10/26/22 12:31 AM, Walter Dnes wrote:
> My regular user has script "settime" in ${HOME}/bin
> 
> #!/bin/bash
> date
> /usr/bin/sudo /usr/bin/rdate -nsv ca.pool.ntp.org
> /usr/bin/sudo /sbin/hwclock --systohc
> date
> 
> /etc/sudoers.d/001 has, amongst other things, two lines...
> 
> waltdnes  x8940 = (root) NOPASSWD: /sbin/hwclock --systohc
> waltdnes  x8940 = (root) NOPASSWD: /usr/bin/rdate -nsv ca.pool.ntp.org
> 
> User "waltdnes" is a member of "wheel".  If the "wheel" line is 
> uncommented in /etc/sudoers, sudo works for me.  If the "wheel" 
> line is commented, then sudo breaks for my regular user.

Please try running the two sudo lines from the script as is on the 
command line as the waltdnes user.  I'm wondering if the problem is 
potentially related to something else, namely sudo wanting to read from 
a terminal (PTY) in some configurations.

I believe there is a non-zero chance that the commands allowed via the 
/etc/sudoers.d/001 file will work as entered.  But that running sudo 
from within a script, as opposed to on the command line, /may/ be the 
source of problems.  --  Divide and conquer the problem.

> There seem to be two different approaches here.  The loose approach 
> is to allow a user to run "sudo <whatever I damn well want>".

This seems to be -- what I refer to as -- the distribution default. 
E.g. get people to run things through sudo vs running things through su 
or running directly as root.

> A more locked down approach allows regular users to run "sudo <very 
> specific command>".

This is -- what I refer to as -- the (more) enterprise approach.  It 
also seems to be the next evolution of the distribution default wherein 
people want to start restricting what can and can't be run via sudo.

The enterprise approach also tends to come more into play as you use 
sudo to run things as users other than root; e.g. run RDBMS commands as 
the Oracle user or backup commands as the Tivoli user.

> This guards against "fat-finger-syndrome".

I think it's more than protection against fat-finger-syndrome.  After 
all, unless the sudoers file(s) is (are) *EXTREMELY* specific down to 
and including command parameters / options, you can still fat-finger 
command parameters / options.

When you start separating duties and who is allowed to do what is when 
you start to see the more locked down enterprise methodology.

> I go with the more locked down approach

I use the distribution default on my personal systems where I'm 95% of 
the use case.

I use the enterprise method on work systems where we have multiple 
people with different skill levels doing different tasks.

Aside:  One advantage of the enterprise method is that you can allow a 
command as one target user (Oracle) but not the (default) root user. 
Thus helping protect against people omitting a critical option.  -- 
Many things, e.g. Oracle RDBMS, get rather upset when commands 
(accidentally) change the ownership of files when run as the wrong user.



-- 
Grant. . . .
unix || die


  parent reply	other threads:[~2022-10-26 16:39 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  2:34 [gentoo-user] Update to /etc/sudoers disables wheel users!!! Walter Dnes
2022-10-26  3:04 ` Ramon Fischer
2022-10-26  3:15   ` Grant Taylor
2022-10-26  3:34     ` Ramon Fischer
2022-10-26  3:40       ` Ramon Fischer
2022-10-26  3:44     ` Matt Connell
2022-10-26 16:21       ` Grant Taylor
2022-10-26 17:15         ` Neil Bothwick
2022-10-26 17:31           ` Rich Freeman
2022-10-26 20:17             ` Dale
2022-10-26 21:26               ` [gentoo-user] " Grant Edwards
2022-10-26 22:44                 ` Dale
2022-10-27  1:23                   ` Ramon Fischer
2022-10-27  3:01                     ` Dale
2022-10-27  7:55                       ` Ramon Fischer
2022-10-27  7:59                         ` Ramon Fischer
2022-10-26 23:55                 ` Rich Freeman
2022-10-26  6:31   ` [gentoo-user] " Walter Dnes
2022-10-26  7:42     ` Ramon Fischer
2022-10-26 11:31       ` Rich Freeman
2022-10-26 14:41         ` Ramon Fischer
2022-10-26 16:52       ` Grant Taylor
2022-10-26 17:12         ` [gentoo-user] " Grant Edwards
2022-10-26 17:54           ` Ramon Fischer
2022-10-26 18:04         ` [gentoo-user] " Ramon Fischer
2022-10-26 18:22           ` Neil Bothwick
2022-10-26 19:28             ` Grant Taylor
2022-10-26 20:08               ` Neil Bothwick
2022-10-26 20:17                 ` Grant Taylor
2022-10-26 21:13                   ` Neil Bothwick
2022-10-26 21:29                     ` Grant Taylor
2022-10-26 21:48               ` Ramon Fischer
2022-10-26 23:06                 ` Grant Taylor
2022-10-27  1:27                   ` Ramon Fischer
2022-10-27  1:47                     ` Grant Taylor
2022-10-27  7:53                       ` Ramon Fischer
2022-10-26 18:35           ` Jack
2022-10-26 18:38             ` Ramon Fischer
2022-10-26 20:06               ` Neil Bothwick
2022-10-26 21:27                 ` Ramon Fischer
2022-10-26 21:30                   ` Grant Taylor
2022-10-26 19:31             ` Grant Taylor
2022-10-26 19:26           ` Grant Taylor
2022-10-26 18:04         ` Ramon Fischer
2022-10-26 16:38     ` Grant Taylor [this message]
2022-10-26  3:12 ` Matt Connell
2022-10-26  4:00 ` Anna “CyberTailor”

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69065fc9-fe64-55d6-6347-6001e97286cd@spamtrap.tnetconsulting.net \
    --to=gtaylor@gentoo.tnetconsulting.net \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox