Feature Request - Notify Prompt - Willing to create PR
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
Research direction
The proof of concept points to src/tgetpass.c, in tgetpass just before the prompt is written. First read how prompt handling and sudoers defaults are defined and validated, including their visudo editing path; the issue does not identify those entry points. Done means a scoped, safe configuration design and implementation that notifies when sudo waits for a password, with behavior and security expectations defined.
Written by the indexing model from the issue text.
Description
I often have multiple terminals open with each terminal running some pipeline, (compiling, linting, installing, etc).
Some of those pipelines take a very long time and other than intermittently checking back in with each terminal, I have no way of knowing if a pipeline is done compiling and waiting to install and sitting at a sudo prompt for installation permission.
I would like to provide a user-configurable way to hook some (pre-approved and defined) external tool to let me know that sudo is waiting for input before it eventually times out the and pipeline fails.
I have a proof of concept which accomplishes exactly what I want:
// in src/tgetpass.c::tgetpass
// right before writing the prompt to output
if (notify) {
system("notify-send \"sudo\" \"sudo is prompting for a password\"");
}
I realize I don't want the external tool to be any arbitrary executable which could allow an injection and I don't want the notification to be configurable either. I would imagine that the user could specify something in the sudoers conf file something like:
Defaults promptpass_notify=notify-send
And the values for that option would be checked at init time to ensure there are no arbitrary calls to unexpected notifier scripts. (Although I realize someone could just symlink whatever they want, is this even a concern? This would be executed before sudo was even authorized to execute the given command)
I would be willing to do the legwork on this feature, but I got stuck in understanding how to implement this with support for editing with visudo and where a flag like this would live in conf or if it should just be an env flag.
- Dominant language
- C
- Stars
- 1.7k
- Forks
- 306
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 22
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sudo-project/sudo
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
sudo-project/sudo#583 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
sudo-project/sudo#581 · 4 comments ·
Maintainers usually reply within 1 day
-
Signal forwarded to the command is lost when it arrives between fork() and execve() of the commandOpen
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sudo-project/sudo#566 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
sudo-project/sudo#553 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
sudo-project/sudo#552 ·
Maintainers usually reply within 1 day
All issues in sudo-project/sudo
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
libsdl-org/SDL#16607 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PowerShell/Win32-OpenSSH#2482 · 1 reaction ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenMathLib/OpenBLAS#6192 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days