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 input from environment variable and file #107

Merged
merged 9 commits into from
Nov 6, 2019

Conversation

gitseti
Copy link
Contributor

@gitseti gitseti commented Oct 27, 2019

Motivation
resolve #103

Most of the time it is not a best practice to read in passwords in the command line in clear text like mqtt> con -i myClient -u gitseti -pw mypassword. Therefore, it is already possible to omit the password text so that the cli will prompt the user to enter the password in a masked input field.

Nevertheless, this input field shows some limitations (like the input being kept to a specific internal buffer size) so that another option for securely reading in a password is needed.

Therefore, this PR introduces two new sources for password input:

  • Environment variable
  • File

These options can be specified in con, mqtt pub and mqtt sub as follows:

$ export PASSWORD mypassword
mqtt> con -i myClient -u gitseti -pw:env PASSWORD
$ echo mypassword > password.txt
mqtt> con -i myClient -u gitseti -pw:file password.txt

Changes

  • Refactor file conversion into an own class
  • Add converters for converting a file and an environment variable to a ByteBuffer

@gitseti gitseti requested review from ahelmbr and SgtSilvio October 27, 2019 11:57
@gitseti gitseti changed the title Feature/add more password inputs #103 Add password input from environment variable and file Oct 27, 2019
Copy link
Member

@SgtSilvio SgtSilvio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, only remark is the file to string to bytebuffer conversion

@gitseti gitseti requested a review from SgtSilvio November 6, 2019 08:49
@gitseti gitseti merged commit 0cb56de into develop Nov 6, 2019
@gitseti gitseti deleted the feature/add-more-password-inputs-#103 branch November 6, 2019 13:29
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

Successfully merging this pull request may close these issues.

CLI freezes in shell mode when connecting using interactive password a with long value
2 participants