Skip to content

Commit 37fd58d

Browse files
authored
Merge pull request #52 from linuxserver/master-hashed-password
Add note regarding hashed code password
2 parents a3cf023 + eaed61f commit 37fd58d

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ services:
9191
- PGID=1000
9292
- TZ=Europe/London
9393
- PASSWORD=password #optional
94+
- HASHED_PASSWORD= #optional
9495
- SUDO_PASSWORD=password #optional
9596
- SUDO_PASSWORD_HASH= #optional
9697
- PROXY_DOMAIN=code-server.my.domain #optional
@@ -110,6 +111,7 @@ docker run -d \
110111
-e PGID=1000 \
111112
-e TZ=Europe/London \
112113
-e PASSWORD=password `#optional` \
114+
-e HASHED_PASSWORD= `#optional` \
113115
-e SUDO_PASSWORD=password `#optional` \
114116
-e SUDO_PASSWORD_HASH= `#optional` \
115117
-e PROXY_DOMAIN=code-server.my.domain `#optional` \
@@ -130,7 +132,8 @@ Container images are configured using parameters passed at runtime (such as thos
130132
| `-e PUID=1000` | for UserID - see below for explanation |
131133
| `-e PGID=1000` | for GroupID - see below for explanation |
132134
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London |
133-
| `-e PASSWORD=password` | Optional web gui password, if not provided, there will be no auth. |
135+
| `-e PASSWORD=password` | Optional web gui password, if `PASSWORD` or `HASHED_PASSWORD` is not provided, there will be no auth. |
136+
| `-e HASHED_PASSWORD=` | Optional web gui password, overrides `PASSWORD`, instructions on how to create it is below. |
134137
| `-e SUDO_PASSWORD=password` | If this optional variable is set, user will have sudo access in the code-server terminal with the specified password. |
135138
| `-e SUDO_PASSWORD_HASH=` | Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`. |
136139
| `-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
170173
 
171174
## Application Setup
172175

173-
Access the webui at `http://<your-ip>:8443`.
174-
For github integration, drop your ssh key in to `/config/.ssh`.
175-
Then open a terminal from the top menu and set your github username and email via the following commands
176-
```
176+
Access the webui at `http://<your-ip>:8443`.
177+
For github integration, drop your ssh key in to `/config/.ssh`.
178+
Then open a terminal from the top menu and set your github username and email via the following commands
179+
180+
```bash
177181
git config --global user.name "username"
178182
git config --global user.email "email address"
179183
```
180184

185+
### Hashed code-server password
186+
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.
187+
181188

182189
## Docker Mods
183190
[![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
250257

251258
## Versions
252259

260+
* **04.02.20:** - Allow setting gui password via hash using env var `HASHED_PASSWORD`.
253261
* **23.12.20:** - Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`.
254262
* **29.05.20:** - Add --domain-proxy support.
255263
* **21.05.20:** - Shrink images, install via yarn, fix arm32v7 build.

readme-vars.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project_name: code-server
55
project_url: "https://coder.com"
66
project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/code-server-banner.png"
77
project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is VS Code running on a remote server, accessible through the browser.
8-
8+
99
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
1010
1111
- If you have a Windows or Mac workstation, more easily develop for Linux.
@@ -47,7 +47,8 @@ param_env_vars:
4747
# optional container parameters
4848
opt_param_usage_include_env: true
4949
opt_param_env_vars:
50-
- { env_var: "PASSWORD", env_value: "password", desc: "Optional web gui password, if not provided, there will be no auth." }
50+
- { env_var: "PASSWORD", env_value: "password", desc: "Optional web gui password, if `PASSWORD` or `HASHED_PASSWORD` is not provided, there will be no auth." }
51+
- { env_var: "HASHED_PASSWORD", env_value: "", desc: "Optional web gui password, overrides `PASSWORD`, instructions on how to create it is below." }
5152
- { 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." }
5253
- { 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`." }
5354
- { 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: ""
5859
# application setup block
5960
app_setup_block_enabled: true
6061
app_setup_block: |
61-
Access the webui at `http://<your-ip>:8443`.
62-
For github integration, drop your ssh key in to `/config/.ssh`.
63-
Then open a terminal from the top menu and set your github username and email via the following commands
64-
```
62+
Access the webui at `http://<your-ip>:8443`.
63+
For github integration, drop your ssh key in to `/config/.ssh`.
64+
Then open a terminal from the top menu and set your github username and email via the following commands
65+
66+
```bash
6567
git config --global user.name "username"
6668
git config --global user.email "email address"
6769
```
6870
71+
### Hashed code-server password
72+
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.
73+
6974
7075
# changelog
7176
changelogs:
77+
- { date: "04.02.20:", desc: "Allow setting gui password via hash using env var `HASHED_PASSWORD`." }
7278
- { date: "23.12.20:", desc: "Allow setting sudo password via hash using env var `SUDO_PASSWORD_HASH`." }
7379
- { date: "29.05.20:", desc: "Add --domain-proxy support." }
7480
- { date: "21.05.20:", desc: "Shrink images, install via yarn, fix arm32v7 build." }

root/etc/services.d/code-server/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/with-contenv bash
22

3-
if [ -n "${PASSWORD}" ]; then
3+
if [ -n "${PASSWORD}" ] || [ -n "${HASHED_PASSWORD}" ]; then
44
AUTH="password"
55
else
66
AUTH="none"
@@ -9,7 +9,7 @@ fi
99

1010
if [ -z ${PROXY_DOMAIN+x} ]; then
1111
PROXY_DOMAIN_ARG=""
12-
else
12+
else
1313
PROXY_DOMAIN_ARG="--proxy-domain=${PROXY_DOMAIN}"
1414
fi
1515

0 commit comments

Comments
 (0)