Browse Source

Tag versions, docker run version

pull/1901/head
Lucas Rattz 2 months ago
committed by GitHub
parent
commit
6586e6e968
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      How_to_generate_an_bcrypt_hash.md

12
How_to_generate_an_bcrypt_hash.md

@ -7,19 +7,23 @@ Since version 14 of wg-easy, a password hashed with bcrypt is needed instead of
The easiest way to generate a bcrypt password hash with wgpw is using docker and node:
```sh
docker run ghcr.io/wg-easy/wg-easy node -e 'const bcrypt = require("bcryptjs"); const hash = bcrypt.hashSync("YOUR_PASSWORD", 10); console.log(hash.replace(/\$/g, "$$$$"));'
docker run ghcr.io/wg-easy/wg-easy:14 node -e 'const bcrypt = require("bcryptjs"); const hash = bcrypt.hashSync("YOUR_PASSWORD", 10); console.log(hash.replace(/\$/g, "$$$$"));'
```
The hashed password will get printed on your terminal. Copy it and use on the `PASSWORD_HASH` environment variable.
The hashed password will get printed on your terminal. Copy it and use on the `PASSWORD_HASH` environment variable in your docker compose.
If you are using `docker run` for running wg-easy, you must enclose the hash string in single quotes (`'...'`).
If you are using `docker run` instead of docker compose for running wg-easy, you must enclose the hash string in single quotes (`'...'`) and unescape the dollar signs. You can use this command instead:
```sh
docker run --rm ghcr.io/wg-easy/wg-easy:14 node -e "const bcrypt = require('bcryptjs'); const hash = bcrypt.hashSync('YOUR_PASSWORD', 10); console.log('\'' + hash + '\'');"
```
## Using Docker + wgpw
`wg-password` (wgpw) is a script that generates bcrypt password hashes. You can use it with docker:
```sh
docker run ghcr.io/wg-easy/wg-easy wgpw YOUR_PASSWORD
docker run ghcr.io/wg-easy/wg-easy:14 wgpw YOUR_PASSWORD
```
You will see an output similar to this:

Loading…
Cancel
Save