Allow wgpw to prompt for a password through stdin (#1348)

* Allow wgpw to prompt for a password through stdin

If the user does not pass the password as a parameter, they are prompted
for it through stdin.
The password is not echoed back, just like any other command-line log-in
prompt (ie. sudo).

* Fix lint errors in wgpw
This commit is contained in:
Hans 2024-09-03 22:34:08 +02:00 committed by GitHub
parent 4758c0dddc
commit 11872de321
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 1 deletions

View file

@ -15,6 +15,12 @@ To generate a bcrypt password hash using docker, run the following command :
docker run ghcr.io/wg-easy/wg-easy wgpw YOUR_PASSWORD
PASSWORD_HASH='$2b$12$coPqCsPtcFO.Ab99xylBNOW4.Iu7OOA2/ZIboHN6/oyxca3MWo7fW' // literally YOUR_PASSWORD
```
If a password is not provided, the tool will prompt you for one :
```sh
docker run ghcr.io/wg-easy/wg-easy wgpw
Enter your password: // hidden prompt, type in your password
PASSWORD_HASH='$2b$12$coPqCsPtcFO.Ab99xylBNOW4.Iu7OOA2/ZIboHN6/oyxca3MWo7fW'
```
**Important** : make sure to enclose your password in **single quotes** when you run `docker run` command :