SAP / macOS-enterprise-privileges

For Mac users in enterprise environments, this application gives users control over the administration of their machine by elevating their level of access to administrator privileges on macOS. Users can set a timeframe in the application's settings to perform specific tasks, such as installing or removing an application.
Apache License 2.0
1.4k stars 150 forks source link

[Privileges 2] stdin for CLI not accepting password #111

Closed mbdmbd closed 1 month ago

mbdmbd commented 1 month ago

I believe that stdin input is planned for v2.0, based on request https://github.com/SAP/macOS-enterprise-privileges/issues/35 ([Feature Request] - Local Authentication with the PrivilegesCLI), but the password doesn't appeear to work.

Trying the beta, the typical process looks like:

$ ./PrivilegesCLI -a
Please enter the reason you need administrator privileges (at least 10 characters): Install Software
Please enter your account password: _<password entered>_
User _<my username>_ now has administrator privileges.
Administrator privileges expire in 20 minutes.

When setting environment variables for the reason and password, it appears that the reason is accepted in stdin, but I don't seem to be able to feed the password in. Some examples:

$ printf "$reason\n$password\n" | ./PrivilegesCLI -a
Please enter your account password:
$ printf "$reason\n\n$password\n" | ./PrivilegesCLI -a
Please enter your account password:
$ printf "$reason\n$password\n\n\n\n\n\n\n" | ./PrivilegesCLI -a
Please enter your account password:
mthielemann commented 1 month ago

The feature request 35 refers to local authentication (a macOS password dialog or Touch ID). This has been implemented in version 2. There are no plans to support passwords via stdin.