-
Notifications
You must be signed in to change notification settings - Fork 190
identity: avoid using the password argument when creating a user #2271
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
base: main
Are you sure you want to change the base?
Conversation
Chris-Peterson444
left a comment
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.
Nice, LGTM. Tentative yes based on the VM tests showing no logged passwords on the chpasswd call.
Thanks!
We can now pass input when calling runner.run() using the "input" argument. That said, because of how reading stdin is implemented in systemd-run, using input="something" will cause stdout and stderr to not end up in the journal. Therefore, we currently only allow input="something" in combination with capture=True. In the future, it would be good to support one without the other. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
15859b0 to
62e9a9b
Compare
|
Well, the original implementation was far from a working implementation. The following problems were found during testing and have been resolved:
|
| source: https://git.launchpad.net/curtin | ||
| source: https://git.launchpad.net/~ogayot/curtin | ||
| source-type: git | ||
| source-commit: "ff79541249aa40f228f87681cdb028c69975cd8c" |
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.
To update once the MP has been merged.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In general, if we pass an encrypted password using the --password option of useradd, then we need to make sure that the invocation is not logged anywhere. This is challenging to do, especially in Subiquity where we run useradd through systemd-run. Indeed the command automatically gets recorded in the journal as a transient unit. To avoid the problem, we now call useradd without the password option, and then immediately call chpasswd to update the password, using stdin. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
| ",".join(sorted(groups)), | ||
| "--create-home", | ||
| ] | ||
| async def run_in_target(cmd: list[str], **kwargs): |
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.
(future PR) we have 13 places where we run "in-target", moving a helper like this to subiquity/server/curtin.py would help.
In general, if we pass an encrypted password using the --password option of useradd, then we need to make sure that the invocation is not logged anywhere.
This is challenging to do. Furthermore, in Subiquity, we run useradd through systemd-run, so the command automatically gets recorded in the journal as a transient unit.
To avoid the problem, we now call useradd without the password option, and then immediately call chpasswd to update the password, using stdin.
Marking as a draft until I test in a VM.Depends on https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/496404