[Bug]: Hashed passwords not being read correctly
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
OS/Web Information
- Web Browser: Firefox, Firefox Developer Edition, Chrome, IE Edge
- Local OS: Windows 10
- Remote OS: Ubuntu 20.04
- Remote Architecture: Digital Ocean Droplet
code-server --version
: latest
Steps to Reproduce
- Install code-server
- Set HASHED_PASSWORD and/or SUDO_PASSWORD_HASH (https://github.com/coder/code-server/blob/main/docs/FAQ.md#can-i-store-my-password-hashed)
- Run the docker container
- Warnings are displayed like the following
WARNING: The argon2i variable is not set. Defaulting to a blank string.
WARNING: The v variable is not set. Defaulting to a blank string.
WARNING: The m variable is not set. Defaulting to a blank string.
WARNING: The rRBsKJu8akBfOupQuihUlQ variable is not set. Defaulting to a blank string.
WARNING: The IDoHiwt0tAGJp variable is not set. Defaulting to a blank string.
WARNING: The Q4rHboVE1c9KB8Wrk7fNpA variable is not set. Defaulting to a blank string.
WARNING: The Rz4mNzjAAORIasm5tuP2N0jD8oAAiZtyFUu88OvWCCU variable is not set. Defaulting to a blank string.
- Navigate to code server URL
Expected
Docker container should start setting HASHED passwords with no warnings
Actual
An unexpected error occurred that requires a reload of this page. The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
Logs
[s6-init] making user provided files available at /var/run/s6/etc…exited 0. [s6-init] ensuring user provided files have correct perms…exited 0. [fix-attrs.d] applying ownership & permissions fixes… [fix-attrs.d] done. [cont-init.d] executing container initialization scripts… [cont-init.d] 01-envfile: executing… [cont-init.d] 01-envfile: exited 0. [cont-init.d] 01-migrations: executing… [migrations] started [migrations] no migrations found [cont-init.d] 01-migrations: exited 0. [cont-init.d] 02-tamper-check: executing… [cont-init.d] 02-tamper-check: exited 0. [cont-init.d] 10-adduser: executing…
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/
Brought to you by linuxserver.io
To support LSIO projects visit: https://www.linuxserver.io/donate/
GID/UID
User uid: 1000 User gid: 1000
[cont-init.d] 10-adduser: exited 0. [cont-init.d] 30-config: executing… setting up sudo access adding abc to sudoers setting sudo password using sudo password hash setting permissions::configuration setting permissions::workspace [cont-init.d] 30-config: exited 0. [cont-init.d] 90-custom-folders: executing… [cont-init.d] 90-custom-folders: exited 0. [cont-init.d] 99-custom-scripts: executing… [custom-init] no custom files found exiting… [cont-init.d] 99-custom-scripts: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [2022-04-24T21:02:19.849Z] info code-server 4.3.0 09bc30027a7fbba170f907a527eaa9f7219fe739 [2022-04-24T21:02:19.853Z] info Using user-data-dir ~/data [2022-04-24T21:02:19.877Z] info Using config file ~/.config/code-server/config.yaml [2022-04-24T21:02:19.878Z] info HTTP server listening on http://0.0.0.0:8443/ [2022-04-24T21:02:19.878Z] info - Authentication is enabled [2022-04-24T21:02:19.878Z] info - Using password from $HASHED_PASSWORD [2022-04-24T21:02:19.879Z] info - Not serving HTTPS [2022-04-24T21:02:19.879Z] info - Proxying the following domain: [2022-04-24T21:02:19.880Z] info - *.code.ripac.me
Screenshot/Video
Does this issue happen in VS Code?
- I cannot reproduce this in VS Code.
Are you accessing code-server over HTTPS?
- I am using HTTPS.
Notes
I’ve added the double quotes to my environment variable per instruction. I’ve also tried with single quotes as well as changing the environment block from - HASHED_PASSWORD=
to HASHED_PASSWORD:
which produces the same issue.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
I just noticed that this bug is being reported under coder/code-server. I was actually running linuxserver/code-server but the documentation for hashing sent me to this repo WHICH IS INCORRECT for their version. I’ll inquire with them on this as that is very deceiving.
In any case I was able to get past the issue by eliminating the quotes completely and using double dollar signs ($$) in the environment variable. This allowed docker to see this value as an actual $ as opposed to seeing it as a variable.
Can I ask you show an example? I am trying this and the variable sets, but doesn’t work then when I try to use sudo. (changed characters below)
SUDO_PASSWORD_HASH= $$argon2i$$v=15$$m=4096,t=3,p=1$$7rcJ0t7ioQ5+AAups91G5A$$TMT5hsptPwDqCOdpdpwdtYC6TuTDIXohBMdNZ9p5pfH