docs: update FAQ with new hashing instructions

This commit is contained in:
Joe Previte 2021-06-03 11:27:59 -07:00
parent 923761cd78
commit 517aaf71c5
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
3 changed files with 41 additions and 39 deletions

View File

@ -2,6 +2,7 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# FAQ # FAQ
- [FAQ](#faq)
- [Questions?](#questions) - [Questions?](#questions)
- [iPad Status?](#ipad-status) - [iPad Status?](#ipad-status)
- [Community Projects (awesome-code-server)](#community-projects-awesome-code-server) - [Community Projects (awesome-code-server)](#community-projects-awesome-code-server)
@ -205,17 +206,19 @@ Again, please follow [./guide.md](./guide.md) for our recommendations on setting
Yes you can! Set the value of `hashed-password` instead of `password`. Generate the hash with: Yes you can! Set the value of `hashed-password` instead of `password`. Generate the hash with:
``` ```shell
printf "thisismypassword" | sha256sum | cut -d' ' -f1 echo -n "password" | npx argon2-cli -e
$argon2i$v=19$m=4096,t=3,p=1$wst5qhbgk2lu1ih4dmuxvg$ls1alrvdiwtvzhwnzcm1dugg+5dto3dt1d5v9xtlws4
``` ```
Of course replace `thisismypassword` with your actual password. Of course replace `thisismypassword` with your actual password and **remember to put it inside quotes**!
Example: Example:
```yaml ```yaml
auth: password auth: password
hashed-password: 1da9133ab9dbd11d2937ec8d312e1e2569857059e73cc72df92e670928983ab5 # You got this from the command above hashed-password: "$argon2i$v=19$m=4096,t=3,p=1$wST5QhBgk2lu1ih4DMuxvg$LS1alrVdIWtvZHwnzCM1DUGg+5DTO3Dt1d5v9XtLws4"
``` ```
## How do I securely access web services? ## How do I securely access web services?

View File

@ -2,13 +2,12 @@ import { field, logger } from "@coder/logger"
import * as express from "express" import * as express from "express"
import * as expressCore from "express-serve-static-core" import * as expressCore from "express-serve-static-core"
import qs from "qs" import qs from "qs"
import safeCompare from "safe-compare"
import { HttpCode, HttpError } from "../common/http" import { HttpCode, HttpError } from "../common/http"
import { normalize, Options } from "../common/util" import { normalize, Options } from "../common/util"
import { AuthType, DefaultedArgs } from "./cli" import { AuthType, DefaultedArgs } from "./cli"
import { commit, rootPath } from "./constants" import { commit, rootPath } from "./constants"
import { Heart } from "./heart" import { Heart } from "./heart"
import { getPasswordMethod, handlePasswordValidation, IsCookieValidArgs, isCookieValid, isHashMatch } from "./util" import { getPasswordMethod, IsCookieValidArgs, isCookieValid } from "./util"
declare global { declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace // eslint-disable-next-line @typescript-eslint/no-namespace

View File

@ -305,7 +305,7 @@ describe("parser", () => {
}) })
}) })
it.only("should use env var hashed password", async () => { it("should use env var hashed password", async () => {
process.env.HASHED_PASSWORD = process.env.HASHED_PASSWORD =
"$argon2i$v=19$m=4096,t=3,p=1$0qR/o+0t00hsbJFQCKSfdQ$oFcM4rL6o+B7oxpuA4qlXubypbBPsf+8L531U7P9HYY" // test "$argon2i$v=19$m=4096,t=3,p=1$0qR/o+0t00hsbJFQCKSfdQ$oFcM4rL6o+B7oxpuA4qlXubypbBPsf+8L531U7P9HYY" // test
const args = parse([]) const args = parse([])