/usr/share/doc/sudo/examples
NameSizeModeActions
cvtsudoers.conf35730644editdlrm
example_approval_plugin.py5570644editdlrm
example_audit_plugin.py33770644editdlrm
example_conversation.py41350644editdlrm
example_debugging.py37060644editdlrm
example_group_plugin.py18440644editdlrm
example_io_plugin.py54700644editdlrm
example_policy_plugin.py61940644editdlrm
pam.conf11820644editdlrm
sudo.conf43560644editdlrm
sudoers42100644editdlrm
syslog.conf10750644editdlrm
Edit: /usr/share/doc/sudo/examples/example_approval_plugin.py (557B)
import sudo from datetime import datetime class BusinessHoursApprovalPlugin(sudo.Plugin): def check(self, command_info: tuple, run_argv: tuple, run_env: tuple) -> int: error_msg = "" now = datetime.now() if now.weekday() >= 5: error_msg = "That is not allowed on the weekend!" if now.hour < 8 or now.hour > 17: error_msg = "That is not allowed outside the business hours!" if error_msg: sudo.log_info(error_msg) raise sudo.PluginReject(error_msg)