Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add password_lock option to server.user operation, or in general make it possible to delete a password #1279

Open
moqmar opened this issue Jan 24, 2025 · 0 comments

Comments

@moqmar
Copy link

moqmar commented Jan 24, 2025

Is your feature request related to a problem? Please describe

I use PyInfra to manage actual people's accounts on devices. They should be able to set their passwords manually with "passwd" on the devices, instead of keeping a central database of all user's password hashes, hence I can't just set a password in the server.user operation.

By default, the server.user operation creates a locked password if none is set (making it impossible to change it with "passwd" without sudo), and overwrites the existing password if one is set in the operation. Both are not what I want.

I could use facts to depend on whether the user has a locked password and then remove it, but this leads to another issue: if I set the password to "" in the user operation, it will not do anything as it is falsy and thus PyInfra treats it not as a set argument, requiring a workaround involving a shell operation to call "passwd -d ".

Describe the solution you'd like

It should be allowed to delete a password. This could be done without changing current behaviour by adding a password_lock option as Ansible does, which - if set to False - sets the password to "deleted" instead of "locked".

I would prefer this approach compared to just allowing empty strings as password hashes, as it solves my problem of not wanting to override the password if it exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant