-
Notifications
You must be signed in to change notification settings - Fork 176
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 base class implementation for local users' passwords reset #465
base: master
Are you sure you want to change the base?
Conversation
d933770
to
e413c77
Compare
|
5e3015b
to
b147a91
Compare
b147a91
to
6eba119
Compare
b90f7e8
to
10d9aed
Compare
10d9aed
to
1aa67f1
Compare
This method is used to reset the user's password and expire it (optional) using Linux shell commands. | ||
''' | ||
# Use 'chpasswd' shell command to change password | ||
subprocess.call([f"echo '{user}:{hashed_password}' | sudo chpasswd -e"], shell=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not concat command line. It is vulnerable to command argument injection. For example, hashed_password may include blank char.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maipbui to help review this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest not to use shell=True, instead use shell=False with an array of strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did not work, the quotations are not working correctly when I split it into list and the pipe does not work
Description
I added base class implementation for local-users-passwords-reset feautre.
Motivation and Context
It defines the abstract class the vendor needs to implement for local-users-passwords-reset feature
How Has This Been Tested?
By inheriting from this base class