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,38 +2,39 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# FAQ # FAQ
- [Questions?](#questions) - [FAQ](#faq)
- [iPad Status?](#ipad-status) - [Questions?](#questions)
- [Community Projects (awesome-code-server)](#community-projects-awesome-code-server) - [iPad Status?](#ipad-status)
- [How can I reuse my VS Code configuration?](#how-can-i-reuse-my-vs-code-configuration) - [Community Projects (awesome-code-server)](#community-projects-awesome-code-server)
- [Differences compared to VS Code?](#differences-compared-to-vs-code) - [How can I reuse my VS Code configuration?](#how-can-i-reuse-my-vs-code-configuration)
- [Installing an extension](#installing-an-extension) - [Differences compared to VS Code?](#differences-compared-to-vs-code)
- [How can I request a missing extension?](#how-can-i-request-a-missing-extension) - [Installing an extension](#installing-an-extension)
- [Installing an extension manually](#installing-an-extension-manually) - [How can I request a missing extension?](#how-can-i-request-a-missing-extension)
- [How do I configure the marketplace URL?](#how-do-i-configure-the-marketplace-url) - [Installing an extension manually](#installing-an-extension-manually)
- [Where are extensions stored?](#where-are-extensions-stored) - [How do I configure the marketplace URL?](#how-do-i-configure-the-marketplace-url)
- [How is this different from VS Code Codespaces?](#how-is-this-different-from-vs-code-codespaces) - [Where are extensions stored?](#where-are-extensions-stored)
- [How should I expose code-server to the internet?](#how-should-i-expose-code-server-to-the-internet) - [How is this different from VS Code Codespaces?](#how-is-this-different-from-vs-code-codespaces)
- [Can I store my password hashed?](#can-i-store-my-password-hashed) - [How should I expose code-server to the internet?](#how-should-i-expose-code-server-to-the-internet)
- [How do I securely access web services?](#how-do-i-securely-access-web-services) - [Can I store my password hashed?](#can-i-store-my-password-hashed)
- [Sub-paths](#sub-paths) - [How do I securely access web services?](#how-do-i-securely-access-web-services)
- [Sub-domains](#sub-domains) - [Sub-paths](#sub-paths)
- [Why does the code-server proxy strip `/proxy/<port>` from the request path?](#why-does-the-code-server-proxy-strip-proxyport-from-the-request-path) - [Sub-domains](#sub-domains)
- [Proxying to Create React App](#proxying-to-create-react-app) - [Why does the code-server proxy strip `/proxy/<port>` from the request path?](#why-does-the-code-server-proxy-strip-proxyport-from-the-request-path)
- [Multi-tenancy](#multi-tenancy) - [Proxying to Create React App](#proxying-to-create-react-app)
- [Docker in code-server container?](#docker-in-code-server-container) - [Multi-tenancy](#multi-tenancy)
- [How can I disable telemetry?](#how-can-i-disable-telemetry) - [Docker in code-server container?](#docker-in-code-server-container)
- [How does code-server decide what workspace or folder to open?](#how-does-code-server-decide-what-workspace-or-folder-to-open) - [How can I disable telemetry?](#how-can-i-disable-telemetry)
- [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server) - [How does code-server decide what workspace or folder to open?](#how-does-code-server-decide-what-workspace-or-folder-to-open)
- [Heartbeat File](#heartbeat-file) - [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server)
- [Healthz endpoint](#healthz-endpoint) - [Heartbeat File](#heartbeat-file)
- [How does the config file work?](#how-does-the-config-file-work) - [Healthz endpoint](#healthz-endpoint)
- [Isn't an install script piped into sh insecure?](#isnt-an-install-script-piped-into-sh-insecure) - [How does the config file work?](#how-does-the-config-file-work)
- [How do I make my keyboard shortcuts work?](#how-do-i-make-my-keyboard-shortcuts-work) - [Isn't an install script piped into sh insecure?](#isnt-an-install-script-piped-into-sh-insecure)
- [How do I access my Documents/Downloads/Desktop folders in code-server on OSX?](#how-do-i-access-my-documentsdownloadsdesktop-folders-in-code-server-on-osx) - [How do I make my keyboard shortcuts work?](#how-do-i-make-my-keyboard-shortcuts-work)
- [Differences compared to Theia?](#differences-compared-to-theia) - [How do I access my Documents/Downloads/Desktop folders in code-server on OSX?](#how-do-i-access-my-documentsdownloadsdesktop-folders-in-code-server-on-osx)
- [`$HTTP_PROXY`, `$HTTPS_PROXY`, `$NO_PROXY`](#http_proxy-https_proxy-no_proxy) - [Differences compared to Theia?](#differences-compared-to-theia)
- [Enterprise](#enterprise) - [`$HTTP_PROXY`, `$HTTPS_PROXY`, `$NO_PROXY`](#http_proxy-https_proxy-no_proxy)
- [Enterprise](#enterprise)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
@ -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([])