Re: Causing Sudo to terminate
"Todd C. Miller" <[email protected]>
| Newsgroups | gmane.comp.tools.sudo.user |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 19 Feb 2019 12:33:54 -0600, Bryan Christ wrote: > With the logging plugin I am writing, there is a need to cause sudo (and > the elevated program) to terminate early. Since the plugin code only runs > when certain events fire, I was contemplating using signals. If I > installed sent SIGTERM to sudo, would that be gracefully handled? In other > words, would the closed event fire? If you send sudo a signal such as SIGTERM, what happens is that sudo will catch the signal, deliver it to the actual command running, and call the plugin's close function when the command dies. If the command does not exit due to the SIGTERM, sudo will keep running. It's worth noting that interactive shells typically ignore SIGINT, SIGQUIT, and SIGTERM signals. The "nice" way to kill a shell is via SIGHUP. On the other hand, if one of the plugin's logging functions returns an error (-1), sudo will terminate the command itself, first with SIGHUP, then SIGTERM and finally SIGKILL. - todd ____________________________________________________________ sudo-users mailing list <[email protected]> For list information, options, or to unsubscribe, visit: https://www.sudo.ws/mailman/listinfo/sudo-users