Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
Good point! This is where a public license comes into play[1] to say "we take no responsibility, if you f'ed yourself up". Just to make sure, that you are not liable. -Ramon [1] https://github.com/sudo-project/sudo/blob/main/LICENSE.md On 27/10/2022 03:47, Grant Taylor wrote: On 10/26/22 7:27 PM, Ramon Fischer wrote: Sure, you cannot cover everything, but mitigating at least a little bit would be OK or not? :) I don't know. :-/ It's the proverbial problem of spam / virus filtering and a spam / virus gets through the filters and someone saying "But it's your fault because you are supposed to protect me!!!". Sometimes there's advantages to saying "here's a gun, it's loaded, and the safety is off. we suggest not pointing it at your foot. If you do point it at your foot, don't pull the trigger." type thing. -- GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On 10/26/22 7:27 PM, Ramon Fischer wrote: Sure, you cannot cover everything, but mitigating at least a little bit would be OK or not? :) I don't know. :-/ It's the proverbial problem of spam / virus filtering and a spam / virus gets through the filters and someone saying "But it's your fault because you are supposed to protect me!!!". Sometimes there's advantages to saying "here's a gun, it's loaded, and the safety is off. we suggest not pointing it at your foot. If you do point it at your foot, don't pull the trigger." type thing. -- Grant. . . . unix || die
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
Sure, you cannot cover everything, but mitigating at least a little bit would be OK or not? :) -Ramon On 27/10/2022 01:06, Grant Taylor wrote: On 10/26/22 3:48 PM, Ramon Fischer wrote: I have created an issue at their Git repository. Maybe there will be solution for this: https://github.com/sudo-project/sudo/issues/190 I ... don't know where to begin. There are so many ways that you can hurt yourself with syntactically valid sudoers that it's not even funny. You could allow list almost all commands, without using the special ALL place holder and then remark critical commands and end up in a very similar situation. At some point we have to trust that Systems Administrators / Sudoers editors know what they are doing and let them do so. -- GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On 10/26/22 3:48 PM, Ramon Fischer wrote: I have created an issue at their Git repository. Maybe there will be solution for this: https://github.com/sudo-project/sudo/issues/190 I ... don't know where to begin. There are so many ways that you can hurt yourself with syntactically valid sudoers that it's not even funny. You could allow list almost all commands, without using the special ALL place holder and then remark critical commands and end up in a very similar situation. At some point we have to trust that Systems Administrators / Sudoers editors know what they are doing and let them do so. -- Grant. . . . unix || die
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
I have created an issue at their Git repository. Maybe there will be solution for this: https://github.com/sudo-project/sudo/issues/190 -Ramon On 26/10/2022 21:28, Grant Taylor wrote: On 10/26/22 12:22 PM, Neil Bothwick wrote: You need to be root to write to /etc/sudoers.d. If someone has that access, you are already doomed! And what happens if someone uses the existing root-via-sudo access to break sudo? You loose root-via-sudo access. Someone could become root, via sudo, edit the sudoers file without using visudo, introduce a syntax problem, thereby breaking sudo (fail secure). You could easily do this to yourself if you don't follow best practices. -- GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On 10/26/22 3:27 PM, Ramon Fischer wrote: Why was I thinking of a chroot? Maybe because of reading "grup/grub" a few e-mails before and thinking of "grub-mkconfig"... Or maybe because entering a chroot is such a prominent thing to do when booting off of Gentoo media to do an installation that it's largely habitual for some of us. ;-) -- Grant. . . . unix || die
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On 10/26/22 3:13 PM, Neil Bothwick wrote: They and you are different people. You are looking at it from the perspective of a user accidentally locking themself out of the system, so su is the best way to be able to fix it. I agree with you there. I was looking at it from the perspective of a third party changing sudo right without your consent. We were at cross purposes. ACK Thank you for clarifying. -- Grant. . . . unix || die
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
Ah, of course! Why was I thinking of a chroot? Maybe because of reading "grup/grub" a few e-mails before and thinking of "grub-mkconfig"... -Ramon On 26/10/2022 22:06, Neil Bothwick wrote: On Wed, 26 Oct 2022 20:38:35 +0200, Ramon Fischer wrote: I thought in a too complicated way. Why not just remove the entry from "/etc/sudoers.d/zzz", while being in a "chroot"? Still too complicated. Just mount the root partition from a live USB and delete the file. no need for a chroot. -- GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On Wed, 26 Oct 2022 14:17:30 -0600, Grant Taylor wrote: > On 10/26/22 2:08 PM, Neil Bothwick wrote: > > So they have root access, nothing has changed. How they get root > > access is irrelevant, just that they have it. > > No, how they get root access is not irrelevant. > > If your only access to root is via sudo and you break sudo you no > longer have root access. > > If you don't have root access through something other than sudo, you > can't fix your sudo (from your existing system). They and you are different people. You are looking at it from the perspective of a user accidentally locking themself out of the system, so su is the best way to be able to fix it. I agree with you there. I was looking at it from the perspective of a third party changing sudo right without your consent. We were at cross purposes. -- Neil Bothwick "We can't solve problems by using the same kind of thinking we used when we created them." (Albert Einstein) pgpsN2HbVhyI1.pgp Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On 10/26/22 2:08 PM, Neil Bothwick wrote: So they have root access, nothing has changed. How they get root access is irrelevant, just that they have it. No, how they get root access is not irrelevant. If your only access to root is via sudo and you break sudo you no longer have root access. If you don't have root access through something other than sudo, you can't fix your sudo (from your existing system). -- Grant. . . . unix || die
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
Rich Freeman wrote: > 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.) > > I'd like to try a GUI based tool. Is that what you talking about? If so, name or what package has it? Thanks. Dale :-) :-)
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On Wed, 26 Oct 2022 13:28:49 -0600, Grant Taylor wrote: > > You need to be root to write to /etc/sudoers.d. If someone has that > > access, you are already doomed! > > And what happens if someone uses the existing root-via-sudo access to > break sudo? So they have root access, nothing has changed. How they get root access is irrelevant, just that they have it. -- Neil Bothwick A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. pgpD5GUPcUQVi.pgp Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On Wed, 26 Oct 2022 20:38:35 +0200, Ramon Fischer wrote: > I thought in a too complicated way. > > Why not just remove the entry from "/etc/sudoers.d/zzz", while > being in a "chroot"? Still too complicated. Just mount the root partition from a live USB and delete the file. no need for a chroot. -- Neil Bothwick Facts are stubborn, but statistics are more pliable pgpcq6_EGs3CW.pgp Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On 10/26/22 12:35 PM, Jack wrote: Could you not interrupt grup and append "single" or "init=/bin/bash" to the kernel command line? Maybe. It will depend on how complex your configuration is. I don't remember if Gentoo requires root's password when entering single user mode or not. (I've not tested it in a long time.) Invoking Bash (or any shell) as init may not work as desired if your system configuration is complex and needs fancier things (modules / network resources / etc) during normal init. My 20 years worth of experience is to have a root password set so that you can fix this more directly and more reliably. Ideally, as soon as you learn that sudo is not working as desired, use su -- using root's password -- and revert the recent sudo change. -- Grant. . . . unix || die
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On 10/26/22 12:22 PM, Neil Bothwick wrote: You need to be root to write to /etc/sudoers.d. If someone has that access, you are already doomed! And what happens if someone uses the existing root-via-sudo access to break sudo? You loose root-via-sudo access. Someone could become root, via sudo, edit the sudoers file without using visudo, introduce a syntax problem, thereby breaking sudo (fail secure). You could easily do this to yourself if you don't follow best practices. -- Grant. . . . unix || die
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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/zz 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
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
Of course, that would be sufficient. I thought in a too complicated way. Why not just remove the entry from "/etc/sudoers.d/zzz", 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 OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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/zz ALL ALL=(ALL) !ALL }:-) -- GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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/zz > > > > 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! pgpkft0Ndewt6.pgp Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 : (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 : 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 OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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/zz ALL ALL=(ALL) !ALL }:-) -- GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On Wed, Oct 26, 2022 at 1:15 PM Neil Bothwick 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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 pgpiZnySyaoNJ.pgp Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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/zz 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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 ". 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 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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 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 OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
On Wed, Oct 26, 2022 at 3:42 AM Ramon Fischer 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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 ". A more locked down approach allows regular users to run "sudo ". 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 OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 ". A more locked down approach allows regular users to run "sudo ". 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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
# emerge app-admin/doas # emerge -c app-admin/sudo # ln -s ./doas /usr/bin/sudo :P
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Re: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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: [gentoo-user] Update to /etc/sudoers disables wheel users!!!
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 OpenPGP_0x155BE26413E699BF.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
[gentoo-user] 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.