forked from mirrors/amnezia-wg-easy

For users using docker-compose.yml, please note that you should not wrap the generated hash password in single quotes. Instead, replace each `$` symbol with two `$$` symbols. For example, for the password 'foobar123', use the following command to generate the hash: `docker run ghcr.io/wg-easy/wg-easy wgpw foobar123` The resulting hash should be used in docker-compose.yml like this: ``` yaml - PASSWORD_HASH=$$2y$$10$$hBCoykrB95WSzuV4fafBzOHWKu9sbyVa34GJr8VV5R/pIelfEMYyG ``` Signed-off-by: cyicz123 <cyicz123@outlook.com>
36 lines
1.3 KiB
Markdown
36 lines
1.3 KiB
Markdown
# wg-password
|
|
|
|
`wg-password` (wgpw) is a script that generates bcrypt password hashes for use with `wg-easy`, enhancing security by requiring passwords.
|
|
|
|
## Features
|
|
|
|
- Generate bcrypt password hashes.
|
|
- Easily integrate with `wg-easy` to enforce password requirements.
|
|
|
|
## Usage with Docker
|
|
|
|
To generate a bcrypt password hash using docker, run the following command :
|
|
|
|
```sh
|
|
docker run ghcr.io/wg-easy/wg-easy wgpw YOUR_PASSWORD
|
|
PASSWORD_HASH='$2b$12$coPqCsPtcFO.Ab99xylBNOW4.Iu7OOA2/ZIboHN6/oyxca3MWo7fW' // literally YOUR_PASSWORD
|
|
```
|
|
|
|
**Important** : make sure to enclose your password in **single quotes** when you run `docker run` command :
|
|
|
|
```bash
|
|
$ echo $2b$12$coPqCsPtcF <-- not correct
|
|
b2
|
|
$ echo "$2b$12$coPqCsPtcF" <-- not correct
|
|
b2
|
|
$ echo '$2b$12$coPqCsPtcF' <-- correct
|
|
$2b$12$coPqCsPtcF
|
|
```
|
|
|
|
**Important** : Please note: don't wrap the generated hash password in single quotes when you use `docker-compose.yml`. Instead, replace each `$` symbol with two `$$` symbols. For example:
|
|
|
|
``` yaml
|
|
- PASSWORD_HASH=$$2y$$10$$hBCoykrB95WSzuV4fafBzOHWKu9sbyVa34GJr8VV5R/pIelfEMYyG
|
|
```
|
|
|
|
This hash is for the password 'foobar123', obtained using the command `docker run ghcr.io/wg-easy/wg-easy wgpw foobar123` and then inserted an additional `$` before each existing `$` symbal.
|