ghostbsd / issues

Issue tracker for GhostBSD
BSD 2-Clause "Simplified" License
3 stars 1 forks source link

Create Python Library and Tool for `SUDO_ASKPASS` GUI and sudo Execution #173

Open ericbsd opened 2 months ago

ericbsd commented 2 months ago

Description

We need to develop a Python library and a tool that will handle password prompts in a GUI for sudo command execution using the SUDO_ASKPASS mechanism. The goal is to ensure the tool behaves like pkexec or gksu, but using sudo and honoring the sudoers configuration, including NOPASSWD rules.

Requirements

  1. Python Library:

    • A library that:
      • Launches a GUI prompt to ask for the user's password.
      • Sets the SUDO_ASKPASS environment variable only within the Python session (it should not be visible outside of the session or to other processes).
      • Executes the sudo command using the SUDO_ASKPASS mechanism.
      • Supports sudo options such as -u (to specify user) and -i (to run as a login shell).
      • Ensures the password prompt respects the sudoers file, meaning it only asks for a password if required. If NOPASSWD is set, it should not prompt the user.
  2. Tool:

    • A command-line tool that:
      • Acts similarly to pkexec or gksu, but uses sudo.
      • Checks if the user is in the sudoers file before prompting for a password.
      • Honors the NOPASSWD directive in sudoers (if set, no password prompt should be shown).
      • Supports common sudo options like:
        • -u: Execute the command as a different user.
        • -i: Execute the command as a login shell.

Deliverables

Acceptance Criteria