KIAUH asks for a sudo password even if sudo does not require a password. #395

Closed
opened 2023-10-30 05:11:17 +01:00 by LoganDark · 15 comments
LoganDark commented 2023-10-30 05:11:17 +01:00 (Migrated from github.com)

Linux Distribution

Raspberry Pi OS (Legacy) Lite (Debian Bullseye)

What happened

KIAUH asks for a sudo password.

What did you expect to happen

KIAUH should just run sudo, because I have pi ALL=(ALL) NOPASSWD:ALL in the sudoers file, and it does not require a password.

How to reproduce

Put pi ALL=(ALL) NOPASSWD:ALL in the sudoers file and then run KIAUH. It will ask for a sudo password despite not needing one.

Additional information

This makes it impossible to use KIAUH unless you set a password for pi, which I don't like to have to do because I prefer key authentication for its security.

### Linux Distribution Raspberry Pi OS (Legacy) Lite (Debian Bullseye) ### What happened KIAUH asks for a sudo password. ### What did you expect to happen KIAUH should just run sudo, because I have `pi ALL=(ALL) NOPASSWD:ALL` in the sudoers file, and it does not require a password. ### How to reproduce Put `pi ALL=(ALL) NOPASSWD:ALL` in the sudoers file and then run KIAUH. It will ask for a sudo password despite not needing one. ### Additional information This makes it impossible to use KIAUH unless you set a password for `pi`, which I don't like to have to do because I prefer key authentication for its security.
EricZimmerman commented 2023-12-17 05:38:40 +01:00 (Migrated from github.com)

there is still a password on the account, no? i am in the same boat, NOPASSWD set, public/private key auth, and it worked fine afaik

there is still a password on the account, no? i am in the same boat, NOPASSWD set, public/private key auth, and it worked fine afaik
LoganDark commented 2023-12-17 05:39:39 +01:00 (Migrated from github.com)

there is still a password on the account, no?

But sudo does not require one and sudo is what this script is using so there's no reason for it to ask for my password.

> there is still a password on the account, no? But `sudo` does not require one and `sudo` is what this script is using so there's no reason for it to ask for my password.
dw-0 commented 2023-12-17 11:38:19 +01:00 (Migrated from github.com)

I assume it's a misconfiguration of your sudoers file. I can't reproduce it. Make sure there are no group privileges overwriting the user priviliges.

I assume it's a misconfiguration of your sudoers file. I can't reproduce it. Make sure there are no group privileges overwriting the user priviliges.
LoganDark commented 2023-12-17 11:39:48 +01:00 (Migrated from github.com)

I assume it's a misconfiguration of your sudoers file.

It's... not? I can log in at any time and run any command using sudo, absolutely no problem. But when I try to run KIAUH, it asks me for a password anyway, even though sudo certainly and absolutely does not require one. I had to run a sudo passwd just to set a password to use for KIAUH.

> I assume it's a misconfiguration of your sudoers file. It's... not? I can log in at any time and run any command using `sudo`, absolutely no problem. But when I try to run KIAUH, it asks me for a password anyway, even though `sudo` *certainly and absolutely does not require one*. I had to run a `sudo passwd` *just to set a password to use for KIAUH*.
dw-0 commented 2023-12-17 11:47:38 +01:00 (Migrated from github.com)

Well, as i don't know the content of your sudoers file, i can just make assumptions.

For example, my user is part of the sudo group:
image
-> i'l' still get asked for the sudo password.
But:
image
-> i'll not be asked for the password.

That's where my assumption came from.

Well, as i don't know the content of your sudoers file, i can just make assumptions. For example, my user is part of the sudo group: ![image](https://github.com/dw-0/kiauh/assets/31533186/fe5d4827-6133-4074-9418-e9b2597eea77) -> i'l' still get asked for the sudo password. But: ![image](https://github.com/dw-0/kiauh/assets/31533186/a111d6d1-6a57-410d-be31-e7d3b120c8f4) -> i'll not be asked for the password. That's where my assumption came from.
LoganDark commented 2023-12-17 11:49:38 +01:00 (Migrated from github.com)

I added my user at the bottom of the file, so that seems fine. I'm no longer using the system that had this issue since I gave up on 3D printing. Can you share what sudo command KIAUH uses in order to ask for the password? Is there a way to just make it not do that?

I added my user at the bottom of the file, so that seems fine. I'm no longer using the system that had this issue since I gave up on 3D printing. Can you share what sudo command KIAUH uses in order to ask for the password? Is there a way to just make it not do that?
dw-0 commented 2023-12-17 11:53:05 +01:00 (Migrated from github.com)

Can you share what sudo command KIAUH uses in order to ask for the password?

What do you mean what sudo command? There is only one sudo command -> sudo 😅
It's mainly used in cases where KIAUH does something in terms of checking system packages. Updating the package list, getting the age of the last update of that list. How should KIAUH prevent a user getting asked for a password it its a system-level thing if not configured otherwise?

https://github.com/dw-0/kiauh/blob/master/scripts/ui/install_menu.sh#L38
Probably the very virst occurence of sudo if a user opens KIAUH for the first time.

> Can you share what sudo command KIAUH uses in order to ask for the password? What do you mean what sudo command? There is only one sudo command -> `sudo` 😅 It's mainly used in cases where KIAUH does something in terms of checking system packages. Updating the package list, getting the age of the last update of that list. How should KIAUH prevent a user getting asked for a password it its a system-level thing if not configured otherwise? https://github.com/dw-0/kiauh/blob/master/scripts/ui/install_menu.sh#L38 Probably the very virst occurence of `sudo` if a user opens KIAUH for the first time.
LoganDark commented 2023-12-17 11:54:05 +01:00 (Migrated from github.com)

Found it:

7a9e752f9c/scripts/ui/install_menu.sh (L38)

sudo -v: asks the user for a password, no exceptions. Forces sudo to ask for a password even if NOPASSWD is set.

It's not my fault.

I absolutely do configure it otherwise, but again, KIAUH forces sudo to ask for a password, even if it's not necessary.

Use sudo something without -v for this. Maybe sudo true?

Found it: https://github.com/dw-0/kiauh/blob/7a9e752f9ca3297fbca311d5fbb1d95da3093cac/scripts/ui/install_menu.sh#L38 `sudo -v`: asks the user for a password, no exceptions. Forces sudo to ask for a password even if NOPASSWD is set. It's not my fault. I absolutely do configure it otherwise, but again, KIAUH forces sudo to ask for a password, even if it's not necessary. Use sudo something without `-v` for this. Maybe `sudo true`?
dw-0 commented 2023-12-17 11:59:00 +01:00 (Migrated from github.com)

And sudo true won't ask you for password? It does for me.

And `sudo true` won't ask you for password? It does for me.
LoganDark commented 2023-12-17 11:59:44 +01:00 (Migrated from github.com)

And sudo true won't ask you for password? It does for me.

That's correct, it won't ask me for a password because the sudoers file tells it not to. sudo -v forces it to ask for a password even if sudoers says NOPASSWD:ALL. sudo true only asks for a password if it actually needs one.

> And `sudo true` won't ask you for password? It does for me. That's correct, it won't ask me for a password because the sudoers file tells it not to. `sudo -v` forces it to ask for a password even if sudoers says `NOPASSWD:ALL`. `sudo true` only asks for a password if it actually needs one.
dw-0 commented 2023-12-17 12:08:49 +01:00 (Migrated from github.com)

Okay, i can switch that command to use "true" instead.

Okay, i can switch that command to use "true" instead.
LoganDark commented 2023-12-17 12:11:08 +01:00 (Migrated from github.com)

thank you!

thank you!
dw-0 commented 2023-12-17 12:19:40 +01:00 (Migrated from github.com)

Thank you for making me aware of an alternative.

Thank you for making me aware of an alternative.
randellhodges commented 2024-01-01 04:57:33 +01:00 (Migrated from github.com)

Looks like it needs adjusted in another spot.

image

Looks like it needs adjusted in another spot. ![image](https://github.com/dw-0/kiauh/assets/7727467/1d3fec33-3d77-483d-a239-3d8bf9a6cad7)
dw-0 commented 2024-01-01 20:05:40 +01:00 (Migrated from github.com)

Looks like it needs adjusted in another spot.

image

Thank you for the hint! I pushed a commit with that change.

> Looks like it needs adjusted in another spot. > > ![image](https://private-user-images.githubusercontent.com/7727467/293541041-1d3fec33-3d77-483d-a239-3d8bf9a6cad7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQxMzUxODcsIm5iZiI6MTcwNDEzNDg4NywicGF0aCI6Ii83NzI3NDY3LzI5MzU0MTA0MS0xZDNmZWMzMy0zZDc3LTQ4M2QtYTIzOS0zZDhiZjlhNmNhZDcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDEwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAxMDFUMTg0ODA3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2QyZDBjNWMzMGNhNGIwNTY1MDcyMTQ0ZWQwZDYwNmQ5MTEwZmYyOTg0NmNmMzdmMGQzNTA0MjAzN2ZiMDJiNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.aAiZzQQxuihu6S-yHT3XX0UfbfKHpP2DskVuvVPJD_8) Thank you for the hint! I pushed a commit with that change.
Sign in to join this conversation.