Merge pull request #52 from linuxserver/master-hashed-password

Add note regarding hashed code password
This commit is contained in:
aptalca 2021-02-04 11:51:57 -05:00 committed by GitHub
commit 37fd58ddf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 13 deletions

View File

@ -91,6 +91,7 @@ services:
- PGID=1000 - PGID=1000
- TZ=Europe/London - TZ=Europe/London
- PASSWORD=password #optional - PASSWORD=password #optional
- HASHED_PASSWORD= #optional
- SUDO_PASSWORD=password #optional - SUDO_PASSWORD=password #optional
- SUDO_PASSWORD_HASH= #optional - SUDO_PASSWORD_HASH= #optional
- PROXY_DOMAIN=code-server.my.domain #optional - PROXY_DOMAIN=code-server.my.domain #optional
@ -110,6 +111,7 @@ docker run -d \
-e PGID=1000 \ -e PGID=1000 \
-e TZ=Europe/London \ -e TZ=Europe/London \
-e PASSWORD=password `#optional` \ -e PASSWORD=password `#optional` \
-e HASHED_PASSWORD= `#optional` \
-e SUDO_PASSWORD=password `#optional` \ -e SUDO_PASSWORD=password `#optional` \
-e SUDO_PASSWORD_HASH= `#optional` \ -e SUDO_PASSWORD_HASH= `#optional` \
-e PROXY_DOMAIN=code-server.my.domain `#optional` \ -e PROXY_DOMAIN=code-server.my.domain `#optional` \
@ -130,7 +132,8 @@ Container images are configured using parameters passed at runtime (such as thos
| `-e PUID=1000` | for UserID - see below for explanation | | `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation | | `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London | | `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London |
| `-e PASSWORD=password` | Optional web gui password, if not provided, there will be no auth. | | `-e PASSWORD=password` | Optional web gui password, if `PASSWORD` or `HASHED_PASSWORD` is not provided, there will be no auth. |
| `-e HASHED_PASSWORD=` | Optional web gui password, overrides `PASSWORD`, instructions on how to create it is below. |
| `-e SUDO_PASSWORD=password` | If this optional variable is set, user will have sudo access in the code-server terminal with the specified password. | | `-e SUDO_PASSWORD=password` | If this optional variable is set, user will have sudo access in the code-server terminal with the specified password. |
| `-e SUDO_PASSWORD_HASH=` | Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`. | | `-e SUDO_PASSWORD_HASH=` | Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`. |
| `-e PROXY_DOMAIN=code-server.my.domain` | If this optional variable is set, this domain will be proxied for subdomain proxying. See [Documentation](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#sub-domains) | | `-e PROXY_DOMAIN=code-server.my.domain` | If this optional variable is set, this domain will be proxied for subdomain proxying. See [Documentation](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#sub-domains) |
@ -170,14 +173,18 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel
   
## Application Setup ## Application Setup
Access the webui at `http://<your-ip>:8443`. Access the webui at `http://<your-ip>:8443`.
For github integration, drop your ssh key in to `/config/.ssh`. For github integration, drop your ssh key in to `/config/.ssh`.
Then open a terminal from the top menu and set your github username and email via the following commands Then open a terminal from the top menu and set your github username and email via the following commands
```
```bash
git config --global user.name "username" git config --global user.name "username"
git config --global user.email "email address" git config --global user.email "email address"
``` ```
### Hashed code-server password
To create the [hashed password](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#can-i-store-my-password-hashed), use printf instead of echo as echo introduces newlines in the hash.
## Docker Mods ## Docker Mods
[![Docker Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=code-server&query=%24.mods%5B%27code-server%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=code-server "view available mods for this container.") [![Docker Universal Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=universal&query=%24.mods%5B%27universal%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=universal "view available universal mods.") [![Docker Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=code-server&query=%24.mods%5B%27code-server%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=code-server "view available mods for this container.") [![Docker Universal Mods](https://img.shields.io/badge/dynamic/yaml?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=universal&query=%24.mods%5B%27universal%27%5D.mod_count&url=https%3A%2F%2Fraw.githubusercontent.com%2Flinuxserver%2Fdocker-mods%2Fmaster%2Fmod-list.yml)](https://mods.linuxserver.io/?mod=universal "view available universal mods.")
@ -250,6 +257,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions ## Versions
* **04.02.20:** - Allow setting gui password via hash using env var `HASHED_PASSWORD`.
* **23.12.20:** - Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`. * **23.12.20:** - Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`.
* **29.05.20:** - Add --domain-proxy support. * **29.05.20:** - Add --domain-proxy support.
* **21.05.20:** - Shrink images, install via yarn, fix arm32v7 build. * **21.05.20:** - Shrink images, install via yarn, fix arm32v7 build.

View File

@ -5,7 +5,7 @@ project_name: code-server
project_url: "https://coder.com" project_url: "https://coder.com"
project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/code-server-banner.png" project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/code-server-banner.png"
project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is VS Code running on a remote server, accessible through the browser. project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is VS Code running on a remote server, accessible through the browser.
- Code on your Chromebook, tablet, and laptop with a consistent dev environment. - Code on your Chromebook, tablet, and laptop with a consistent dev environment.
- If you have a Windows or Mac workstation, more easily develop for Linux. - If you have a Windows or Mac workstation, more easily develop for Linux.
@ -47,7 +47,8 @@ param_env_vars:
# optional container parameters # optional container parameters
opt_param_usage_include_env: true opt_param_usage_include_env: true
opt_param_env_vars: opt_param_env_vars:
- { env_var: "PASSWORD", env_value: "password", desc: "Optional web gui password, if not provided, there will be no auth." } - { env_var: "PASSWORD", env_value: "password", desc: "Optional web gui password, if `PASSWORD` or `HASHED_PASSWORD` is not provided, there will be no auth." }
- { env_var: "HASHED_PASSWORD", env_value: "", desc: "Optional web gui password, overrides `PASSWORD`, instructions on how to create it is below." }
- { env_var: "SUDO_PASSWORD", env_value: "password", desc: "If this optional variable is set, user will have sudo access in the code-server terminal with the specified password." } - { env_var: "SUDO_PASSWORD", env_value: "password", desc: "If this optional variable is set, user will have sudo access in the code-server terminal with the specified password." }
- { env_var: "SUDO_PASSWORD_HASH", env_value: "", desc: "Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`." } - { env_var: "SUDO_PASSWORD_HASH", env_value: "", desc: "Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`." }
- { env_var: "PROXY_DOMAIN", env_value: "code-server.my.domain", desc: "If this optional variable is set, this domain will be proxied for subdomain proxying. See [Documentation](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#sub-domains)" } - { env_var: "PROXY_DOMAIN", env_value: "code-server.my.domain", desc: "If this optional variable is set, this domain will be proxied for subdomain proxying. See [Documentation](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#sub-domains)" }
@ -58,17 +59,22 @@ optional_block_1_items: ""
# application setup block # application setup block
app_setup_block_enabled: true app_setup_block_enabled: true
app_setup_block: | app_setup_block: |
Access the webui at `http://<your-ip>:8443`. Access the webui at `http://<your-ip>:8443`.
For github integration, drop your ssh key in to `/config/.ssh`. For github integration, drop your ssh key in to `/config/.ssh`.
Then open a terminal from the top menu and set your github username and email via the following commands Then open a terminal from the top menu and set your github username and email via the following commands
```
```bash
git config --global user.name "username" git config --global user.name "username"
git config --global user.email "email address" git config --global user.email "email address"
``` ```
### Hashed code-server password
To create the [hashed password](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#can-i-store-my-password-hashed), use printf instead of echo as echo introduces newlines in the hash.
# changelog # changelog
changelogs: changelogs:
- { date: "04.02.20:", desc: "Allow setting gui password via hash using env var `HASHED_PASSWORD`." }
- { date: "23.12.20:", desc: "Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`." } - { date: "23.12.20:", desc: "Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`." }
- { date: "29.05.20:", desc: "Add --domain-proxy support." } - { date: "29.05.20:", desc: "Add --domain-proxy support." }
- { date: "21.05.20:", desc: "Shrink images, install via yarn, fix arm32v7 build." } - { date: "21.05.20:", desc: "Shrink images, install via yarn, fix arm32v7 build." }

View File

@ -1,6 +1,6 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
if [ -n "${PASSWORD}" ]; then if [ -n "${PASSWORD}" ] || [ -n "${HASHED_PASSWORD}" ]; then
AUTH="password" AUTH="password"
else else
AUTH="none" AUTH="none"
@ -9,7 +9,7 @@ fi
if [ -z ${PROXY_DOMAIN+x} ]; then if [ -z ${PROXY_DOMAIN+x} ]; then
PROXY_DOMAIN_ARG="" PROXY_DOMAIN_ARG=""
else else
PROXY_DOMAIN_ARG="--proxy-domain=${PROXY_DOMAIN}" PROXY_DOMAIN_ARG="--proxy-domain=${PROXY_DOMAIN}"
fi fi