Mailing List Archive

Update to /etc/sudoers disables wheel users!!!
I had the following in my /etc/sudoers before tonight's update...

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL:ALL) ALL

## Same thing without a password
%wheel ALL=(ALL:ALL) NOPASSWD: ALL

...and my regular user was able to run commands and scripts via
/usr/bin/sudo which had been authorized in files in the /etc/sudoers.d
directory. Tonight's update changed /etc/sudoers to...

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL:ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL:ALL) NOPASSWD: ALL

I was "like WTF?!?" but I let it through. sudo stopped working for my
regular user. As root, I went in and manually reverted the update with
visudo. Is this a bug?

--
I've seen things, you people wouldn't believe; Gopher, Netscape with
frames, the first Browser Wars. Searching for pages with AltaVista,
pop-up windows self-replicating, trying to uninstall RealPlayer. All
those moments, will be lost in time like tears in rain... time to die.
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Hello Walter,

I do not think, that this is a bug, since it is the default file, which
should not be edited by the user. All changes should be done in
"/etc/sudoers.d/" to avoid such cases.

I kept mine unchanged from 2nd October and only have two uncommented lines:

    [...]
    root ALL=(ALL:AlL) ALL
    [...]
    @includedir /etc/sudoers.d

I am using version "1.9.11_p3-r1".

What version are you using?
-Ramon

Maybe you have edited the default file before?

On 26/10/2022 04:34, Walter Dnes wrote:
> I had the following in my /etc/sudoers before tonight's update...
>
> ## Uncomment to allow members of group wheel to execute any command
> %wheel ALL=(ALL:ALL) ALL
>
> ## Same thing without a password
> %wheel ALL=(ALL:ALL) NOPASSWD: ALL
>
> ...and my regular user was able to run commands and scripts via
> /usr/bin/sudo which had been authorized in files in the /etc/sudoers.d
> directory. Tonight's update changed /etc/sudoers to...
>
> ## Uncomment to allow members of group wheel to execute any command
> # %wheel ALL=(ALL:ALL) ALL
>
> ## Same thing without a password
> # %wheel ALL=(ALL:ALL) NOPASSWD: ALL
>
> I was "like WTF?!?" but I let it through. sudo stopped working for my
> regular user. As root, I went in and manually reverted the update with
> visudo. Is this a bug?
>

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On Tue, 2022-10-25 at 22:34 -0400, Walter Dnes wrote:
>  Is this a bug?

Nope, this is the way it is supposed to work.

Ramon is correct, user changes should go into sudoers.d which has been
the case for... some years now, I think? I don't recall.

I still make changes in sudoers directly, and just make sure dispatch-
conf doesn't squish them. I like to live dangerously I guess.
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On 10/25/22 9:04 PM, Ramon Fischer wrote:
> I do not think, that this is a bug, since it is the default file, which
> should not be edited by the user.

I *STRONGLY* /OBJECT/ to the notion that users should not edit
configuration files.

By design, that's the very purpose of the configuration file, for users
to edit them to be what they want them to be.

The concept of "don't edit configuration files" seems diametrically
opposed to the idea of Gentoo as I understand it. Namely, /you/ build
/your/ system to behave the way that /you/ want it to.

> All changes should be done in "/etc/sudoers.d/" to avoid such cases.

Then why in the world does the /default/ file, as installed by Gentoo,
include directions to edit the the file?!?!?!

Aside: Someone recently posted a comment to the sudo users mailing list
(exact name escapes me) wherein their security policy prohibited
@includedir explicitly because of the capability that adding a file to
such included directories inherently enabled sudo access -or- caused
sudo to fail secure and perform a Denial of Service. They were required
to use individual @include directives.

IMHO telling a Gentoo user not to modify a file in /etc takes hutzpah.



--
Grant. . . .
unix || die
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Hello Grant,

generelly, I totally agree with you! Freedom of changing files
everywhere is what makes Gentoo a good, user-suited Linux distribution.

But changing *default files* comes with the risk, that a package update
will overwrite it.

Therefore "[...].d/" directories were "invented", where "d" is an
abbreviation for "directory" as far as I remember. This is supposed to
be the playground for users.

Of course including external files come with risks, but how do you want
to balance usability and security? It is difficult to answer this for me
as well.
-Ramon

On 26/10/2022 05:15, Grant Taylor wrote:
> On 10/25/22 9:04 PM, Ramon Fischer wrote:
>> I do not think, that this is a bug, since it is the default file,
>> which should not be edited by the user.
>
> I *STRONGLY* /OBJECT/ to the notion that users should not edit
> configuration files.
>
> By design, that's the very purpose of the configuration file, for
> users to edit them to be what they want them to be.
>
> The concept of "don't edit configuration files" seems diametrically
> opposed to the idea of Gentoo as I understand it. Namely, /you/ build
> /your/ system to behave the way that /you/ want it to.
>
>> All changes should be done in "/etc/sudoers.d/" to avoid such cases.
>
> Then why in the world does the /default/ file, as installed by Gentoo,
> include directions to edit the the file?!?!?!
>
> Aside:  Someone recently posted a comment to the sudo users mailing
> list (exact name escapes me) wherein their security policy prohibited
> @includedir explicitly because of the capability that adding a file to
> such included directories inherently enabled sudo access -or- caused
> sudo to fail secure and perform a Denial of Service.  They were
> required to use individual @include directives.
>
> IMHO telling a Gentoo user not to modify a file in /etc takes hutzpah.
>
>
>

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Good question, which confused me as well, when I was looking into the file.

Maybe ask the package maintainer or the developers?

-Ramon

On 26/10/2022 05:34, Ramon Fischer wrote:
> Then why in the world does the /default/ file, as installed by Gentoo,
> include directions to edit the the file?!?!?!

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On Tue, 2022-10-25 at 21:15 -0600, Grant Taylor wrote:
> I *STRONGLY* /OBJECT/ to the notion that users should not edit
> configuration files.

Calm down. Nobody said you can't. I do. Just know what you're doing
and pay attention to what portage does with package-managed
configuration files.

dispatch-conf even gives you the opportunity to edit it before
applying.
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
# emerge app-admin/doas
# emerge -c app-admin/sudo
# ln -s ./doas /usr/bin/sudo

:P
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On Wed, Oct 26, 2022 at 05:04:35AM +0200, Ramon Fischer wrote
> Hello Walter,
>
> I do not think, that this is a bug, since it is the default file, which
> should not be edited by the user.

Firstly "grep -i uncomment /etc/sudoers" results in...

## Uncomment to enable special input methods. Care should be taken as
## Uncomment to use a hard-coded PATH instead of the user's to find commands
## Uncomment to send mail if the user does not enter the correct password.
## Uncomment to enable logging of a command's output, except for
## Uncomment to allow members of group wheel to execute any command
## Uncomment to allow members of group sudo to execute any command
## Uncomment to allow any user to run sudo if they know the password

...I.e. the file is explicitly telling you to edit it if required!!!

> All changes should be done in "/etc/sudoers.d/" to avoid such cases.

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.

> I kept mine unchanged from 2nd October and only have two uncommented lines:
>
> ??? [...]
> ??? root ALL=(ALL:AlL) ALL
> ??? [...]
> ??? @includedir /etc/sudoers.d
>
> I am using version "1.9.11_p3-r1".

Me too.

There seem to be two different approaches here. The loose approach is
to allow a user to run "sudo <whatever I damn well want>". A more locked
down approach allows regular users to run "sudo <very specific command>".
This guards against "fat-finger-syndrome". I go with the more locked
down approach

--
I've seen things, you people wouldn't believe; Gopher, Netscape with
frames, the first Browser Wars. Searching for pages with AltaVista,
pop-up windows self-replicating, trying to uninstall RealPlayer. All
those moments, will be lost in time like tears in rain... time to die.
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
> User "waltdnes" is a member of "wheel". If the "wheel" line is
> uncommented in /etc/sudoers, sudo works for me.
So you could create the file "/etc/sudoers.d/000" with the following
content:

    %wheel ALL=(ALL:ALL) ALL
    %wheel ALL=(ALL:ALL) NOPASSWD: ALL

and your user is able to synchronise your clock again.

I do not know, what the developers were thinking to encourage the user
to edit a default file, which gets potentially overwritten after each
package update...

"etc-update" helps to have an eye on, but muscle memory and fast fingers
are sometimes faster.

> I go with the more locked down approach
This is the best way. Try to be as precise as possible, but be aware of
wildcards![1]

-Ramon

[1]
https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-4-wildcards/

On 26/10/2022 08:31, Walter Dnes wrote:
> On Wed, Oct 26, 2022 at 05:04:35AM +0200, Ramon Fischer wrote
>> Hello Walter,
>>
>> I do not think, that this is a bug, since it is the default file, which
>> should not be edited by the user.
> Firstly "grep -i uncomment /etc/sudoers" results in...
>
> ## Uncomment to enable special input methods. Care should be taken as
> ## Uncomment to use a hard-coded PATH instead of the user's to find commands
> ## Uncomment to send mail if the user does not enter the correct password.
> ## Uncomment to enable logging of a command's output, except for
> ## Uncomment to allow members of group wheel to execute any command
> ## Uncomment to allow members of group sudo to execute any command
> ## Uncomment to allow any user to run sudo if they know the password
>
> ...I.e. the file is explicitly telling you to edit it if required!!!
>
>> All changes should be done in "/etc/sudoers.d/" to avoid such cases.
> 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.
>
>> I kept mine unchanged from 2nd October and only have two uncommented lines:
>>
>>     [...]
>>     root ALL=(ALL:AlL) ALL
>>     [...]
>>     @includedir /etc/sudoers.d
>>
>> I am using version "1.9.11_p3-r1".
> Me too.
>
> There seem to be two different approaches here. The loose approach is
> to allow a user to run "sudo <whatever I damn well want>". A more locked
> down approach allows regular users to run "sudo <very specific command>".
> This guards against "fat-finger-syndrome". I go with the more locked
> down approach
>

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On Wed, Oct 26, 2022 at 3:42 AM Ramon Fischer <Ramon_Fischer@hotmail.de> wrote:
>
> I do not know, what the developers were thinking to encourage the user
> to edit a default file, which gets potentially overwritten after each
> package update...
>
> "etc-update" helps to have an eye on, but muscle memory and fast fingers
> are sometimes faster.

The Gentoo preference tends to be to follow upstream. So if sudo
upstream distributes a file like this that has comments encouraging
users to edit it, then that is likely how Gentoo will ship it. If
sudo switched to moving everything into an include-based system
UPSTREAM then Gentoo would probably start shipping that. If you look
at the sudo ebuild you'll see that the config files are 100% upstream.

If you look at things like systemd units or udev rules they're much
more include-oriented, as this is the upstream preference.

Gentoo has emphasized using config file protection early on, and
doesn't have any official preference for using included config
directories distro-wide. Portage has been moving in this direction
for a while though (for the stuff in /etc/portage).

--
Rich
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Interesting! Thank you for your research!

After working 20 hours straight - uptime said so - I did not feel like
it to do deeper research myself. :)

-Ramon

On 26/10/2022 13:31, Rich Freeman wrote:
> On Wed, Oct 26, 2022 at 3:42 AM Ramon Fischer <Ramon_Fischer@hotmail.de> wrote:
>> I do not know, what the developers were thinking to encourage the user
>> to edit a default file, which gets potentially overwritten after each
>> package update...
>>
>> "etc-update" helps to have an eye on, but muscle memory and fast fingers
>> are sometimes faster.
> The Gentoo preference tends to be to follow upstream. So if sudo
> upstream distributes a file like this that has comments encouraging
> users to edit it, then that is likely how Gentoo will ship it. If
> sudo switched to moving everything into an include-based system
> UPSTREAM then Gentoo would probably start shipping that. If you look
> at the sudo ebuild you'll see that the config files are 100% upstream.
>
> If you look at things like systemd units or udev rules they're much
> more include-oriented, as this is the upstream preference.
>
> Gentoo has emphasized using config file protection early on, and
> doesn't have any official preference for using included config
> directories distro-wide. Portage has been moving in this direction
> for a while though (for the stuff in /etc/portage).
>

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On 10/25/22 9:44 PM, Matt Connell wrote:
> Calm down.

I am calm.

The suggestion to not edit the (/etc/sudoeres) configuration file is one
of those types of things that if nobody objects to then eventually not
doing so will become defacto policy. So I objected, calmly, but with
emphasis.

> Nobody said you can't.

Yet. (See above.)

> I do.

I do too.

> Just know what you're doing and pay attention to what portage does
> with package-managed configuration files.

Yep.

This is a common pitfall across multiple distributions / operating
systems / platforms.

> dispatch-conf even gives you the opportunity to edit it before
> applying.

Yep.

I almost always reject the changes suggested on config files that I've
modified and accept them on files that I've not modified.

I really do wish that there was a better way to manage this, likely
involving diffs / deltas. E.g. what changed between the N distribution
file and the N+1 distribution file. Can that same change be safely
applied to the N' distribution file to create the N'+1 file?



--
Grant. . . .
unix || die
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
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
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On 10/26/22 1:42 AM, Ramon Fischer wrote:
> and your user is able to synchronise your clock again.

I'm not sure that will work as hoped. See my other reply about PTY and
testing the commands at the command line for more explanation of what I
suspect is happening.

> I do not know, what the developers were thinking to encourage the user
> to edit a default file, which gets potentially overwritten after each
> package update...

To the sudo developers, the /etc/sudoers file is *SUPPOSED* *TO* /be/
/edited/.

The sudo developers provide the sudo (et al.) program(s) for your use
and /you/ provide the configuration file(s) that it (they) use.

It is natural for the /etc/sudoers file to be edited.

To me the disconnect is when people other than the sudo developers
distribute the /etc/sudoers file and expect that it will not be edited.

What are end users / systems administrators to do if the default file
has something like the following enabled in the default /etc/sudoers
file and the EUs / SAs want it to not be there?

%wheel ALL=(ALL:ALL) ALL

They have no choice but to change (edit / replace) the /etc/sudoers file.

Especially if other parts of the system rely on the wheel group and not
putting users in it is not an option. -- The above line *MUST* be
taken out, thus the /etc/sudoers file *MUST* be edited.

Unix has 50 years of editing files to make the system behave as desired.
Modularization and including other files is nice /when/ /it/ /works/.
But there are times that modularization doesn't work and files *MUST* be
edited.

> "etc-update" helps to have an eye on, but muscle memory and fast fingers
> are sometimes faster.

How many levels of safety do you suggest that we put in place?

What if someone were to put the following into /etc/sudoers.d/zzzzzzzzzz

ALL ALL=(ALL) !ALL

}:-)

> This is the best way. Try to be as precise as possible, but be aware of
> wildcards![1]

The /etc/sudoers syntax can be tricky to master. But it can also be
very powerful when done correctly.



--
Grant. . . .
unix || die
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On 2022-10-26, Grant Taylor <gtaylor@gentoo.tnetconsulting.net> wrote:

> To the sudo developers, the /etc/sudoers file is *SUPPOSED* *TO* /be/
> /edited/.

And editing that file is how I configure sudo. And when an emerge
update changes /etc/sudoers, the edited file is left as-is and there
is a message that you need to run etc-update to merge the changes.

--
Grant
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On Wed, 26 Oct 2022 10:21:06 -0600, Grant Taylor wrote:

> > dispatch-conf even gives you the opportunity to edit it before
> > applying.
>
> Yep.
>
> I almost always reject the changes suggested on config files that I've
> modified and accept them on files that I've not modified.
>
> I really do wish that there was a better way to manage this, likely
> involving diffs / deltas. E.g. what changed between the N distribution
> file and the N+1 distribution file. Can that same change be safely
> applied to the N' distribution file to create the N'+1 file?

conf-update allows you to merge the new and old files, prompting you to
pick which to use on each differing section, with a further option to
edit the lines. That way you can keep your changed lines but still add
lines relating to new config options.


--
Neil Bothwick

Top Oxymorons Number 36: Alone together
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On Wed, Oct 26, 2022 at 1:15 PM Neil Bothwick <neil@digimed.co.uk> wrote:
>
> On Wed, 26 Oct 2022 10:21:06 -0600, Grant Taylor wrote:
>
> > > dispatch-conf even gives you the opportunity to edit it before
> > > applying.
> >
> > Yep.
> >
> > I almost always reject the changes suggested on config files that I've
> > modified and accept them on files that I've not modified.
> >
> > I really do wish that there was a better way to manage this, likely
> > involving diffs / deltas. E.g. what changed between the N distribution
> > file and the N+1 distribution file. Can that same change be safely
> > applied to the N' distribution file to create the N'+1 file?
>
> conf-update allows you to merge the new and old files, prompting you to
> pick which to use on each differing section, with a further option to
> edit the lines. That way you can keep your changed lines but still add
> lines relating to new config options.
>

It could really use an overhaul but cfg-update does 3-way diffs and
auto-merges based on them. Ie, if in a block of text you make a
change, and in a new update that particular block of text hasn't
changed, then your previous change will get auto-merged. If the
upstream file changed in that block of text then you can do a 3-way
diff.

The tool is really old and barely maintained (I'm caretaking it but
don't really want to deal with that - patches welcome). It also uses
RCS to store the change history for 3-way merging and that could
probably be switched to git or something more modern. If you use an
x11-based merge tool then it will also refuse to attempt an automatic
merge if X11 isn't available. (Obviously you can't actually run the
manual merge if the tool uses X11 and that isn't available.)

Using it I find that maybe 95% of my config file changes involve no prompts.

Another useful tool is etckeeper which is basically just some
integrations for portage around maintaining /etc in git. You can of
course just do that manually but it will auto-commit changes if you
forget to do so before an update.

--
Rich
Re: Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Of course, you are free to do so, but then blindly overwriting default
configuration files is a Layer 8 problem.

-Ramon

On 26/10/2022 19:12, Grant Edwards wrote:
> On 2022-10-26, Grant Taylor <gtaylor@gentoo.tnetconsulting.net> wrote:
>
>> To the sudo developers, the /etc/sudoers file is *SUPPOSED* *TO* /be/
>> /edited/.
> And editing that file is how I configure sudo. And when an emerge
> update changes /etc/sudoers, the edited file is left as-is and there
> is a message that you need to run etc-update to merge the changes.
>
> --
> Grant
>
>
>

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Also a very interesting question!

I just tested this with "visudo" and it does not intercept this.

If "su" is disabled, you are locked out and you are forced to enter your
system via a live USB stick and a "chroot" in order to edit
"/etc/shadow" to set a root password via "mkpasswd" and enable "su".
Nice. :D

-Ramon

On 26/10/2022 18:52, Grant Taylor wrote:
> What if someone were to put the following into /etc/sudoers.d/zzzzzzzzzz
>
>    ALL ALL=(ALL) !ALL
>
> }:-)

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Indeed, an intersting question, which you actually already answered
yourself. I just tested it myself:

   $ visudo -f /etc/sudoers.d/00-wheel
        %wheel ALL=(ALL) ALL

   $ sudo --list
        User ramon may run the following commands on <some_hostname>:
            (ALL) ALL

   $ sudo -f /etc/sudoers.d/00-wheel
        # negate the entry
        !wheel ALL=(ALL) ALL

   $ sudo --list
        User ramon may run the following commands on <some_hostname>:
            Entry is gone

-Ramon

On 26/10/2022 18:52, Grant Taylor wrote:
> What are end users / systems administrators to do if the default file
> has something like the following enabled in the default /etc/sudoers
> file and the EUs / SAs want it to not be there?
>
>    %wheel ALL=(ALL:ALL) ALL
>
> They have no choice but to change (edit / replace) the /etc/sudoers file.

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On Wed, 26 Oct 2022 20:04:10 +0200, Ramon Fischer wrote:

> Also a very interesting question!
>
> I just tested this with "visudo" and it does not intercept this.
>
> If "su" is disabled, you are locked out and you are forced to enter
> your system via a live USB stick and a "chroot" in order to edit
> "/etc/shadow" to set a root password via "mkpasswd" and enable "su".
> Nice. :D

You need to be root to write to /etc/sudoers.d. If someone has that
access, you are already doomed!

>
> -Ramon
>
> On 26/10/2022 18:52, Grant Taylor wrote:
> > What if someone were to put the following into
> > /etc/sudoers.d/zzzzzzzzzz
> >
> >    ALL ALL=(ALL) !ALL
> >
> > }:-)




--
Neil Bothwick

I thought I saw the light at the end of the tunnel...
but it was just some sod with a torch bringing me more work!
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On 2022.10.26 14:04, Ramon Fischer wrote:
> Also a very interesting question!
>
> I just tested this with "visudo" and it does not intercept this.
>
> If "su" is disabled, you are locked out and you are forced to enter
> your system via a live USB stick and a "chroot" in order to edit
> "/etc/shadow" to set a root password via "mkpasswd" and enable "su".
> Nice. :D
Could you not interrupt grup and append "single" or "init=/bin/bash"
to the kernel command line?
>
> -Ramon
>
> On 26/10/2022 18:52, Grant Taylor wrote:
>> What if someone were to put the following into
>> /etc/sudoers.d/zzzzzzzzzz
>>
>> ?? ALL ALL=(ALL) !ALL
>>
>> }:-)
>
>--
> GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
>
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
Of course, that would be sufficient.

I thought in a too complicated way.

Why not just remove the entry from "/etc/sudoers.d/zzzzzzz", while being
in a "chroot"?

-Ramon

On 26/10/2022 20:35, Jack wrote:
> Could you not interrupt  grup and append "single" or "init=/bin/bash"
> to the kernel command line?

--
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: Update to /etc/sudoers disables wheel users!!! [ In reply to ]
On 10/26/22 12:04 PM, Ramon Fischer wrote:
> Also a very interesting question!

}:-)

> I just tested this with "visudo" and it does not intercept this.

Nor should it.

It's perfect legitimate sudoers syntax.

The location; /etc/sudoers.d/zzzzzzzzzz vs the end of /etc/sudoers
(proper), doesn't matter.

> If "su" is disabled, you are locked out and you are forced to enter your
> system via a live USB stick and a "chroot" in order to edit
> "/etc/shadow" to set a root password via "mkpasswd" and enable "su".

Which is one of the reasons that it's important to have (set) a known
root password.



--
Grant. . . .
unix || die

1 2  View All