diff --git a/README.md b/README.md index 54d6f69..f12672c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Multi-connection SSH client that runs in your browser with JWT authentication. - **SFTP File Manager**: Built-in file manager with upload/download capabilities - **Terminal emulator**: Uses xterm.js for a full terminal experience - **Connection management**: Sidebar with connection list, status indicators, and quick actions +- **Version updates**: Displays the running version and checks for a newer stable release every 24 hours, caching the response in the browser - **Remote load monitoring**: Active SSH connections display the remote Linux 1/5/15-minute load average - **Session Recording**: Automatic recording of SSH sessions in asciinema format with playback and configurable retention - **Dark theme**: Modern dark UI design @@ -27,22 +28,35 @@ docker-compose -f deployment/docker-compose.yml up -d --build Open http://localhost:8080 in your browser. The application is served via a Caddy reverse proxy. -### 3. Login +### 3. Create the Administrator -Default credentials: -- Username: `admin` -- Password: `admin` +On first start, create the administrator account in the browser. Use a password with at least 12 characters. ## Configuration ### Users -Set users via environment variable in `deployment/docker-compose.yml`: +On a fresh installation, open the application to create the first administrator. +For an existing installation, users configured with `WEBSSH_USERS` are imported into the database once. +The first imported user becomes an administrator, the remaining imported users have the `user` role, and +each imported user must change their password at their next login. Remove `WEBSSH_USERS` after migration: +future user accounts are stored in the database. + +To import legacy users via the environment variable in `deployment/docker-compose.yml`: ```yaml environment: - WEBSSH_USERS=user1:pass1,user2:pass2 ``` +New passwords must contain at least 12 characters. Passwords are stored as salted PBKDF2-HMAC-SHA256 hashes. +Administrators can create and delete accounts from **Manage Users**; new users must replace their temporary password at first login. + +To reset an account password from a running Docker container, run the command interactively: +```bash +docker exec -it webssh-backend password-reset +``` +The tool asks for the username (or accepts it as `password-reset username`), prompts for the new password without echoing it, invalidates existing sessions for that account, and requires the user to change the temporary password at their next login. + ### JWT Secret Set custom JWT secret: @@ -203,7 +217,7 @@ Pre-built multi-arch images available: ```bash docker pull danaildr/webssh:latest -docker pull danaildr/webssh:0.5.1 +docker pull danaildr/webssh:0.6.0 ``` Supported architectures: `linux/amd64`, `linux/arm64`, `linux/arm/v7` @@ -211,7 +225,7 @@ Supported architectures: `linux/amd64`, `linux/arm64`, `linux/arm/v7` ## Security Notes - Always use HTTPS in production (configure reverse proxy with SSL) -- Change default credentials +- Create a strong administrator password during first-run setup - Set a strong JWT_SECRET - The backend uses `AutoAddPolicy()` for SSH host keys (testing only - change for production) - Token expiry: 8 hours diff --git a/deployment/Dockerfile b/deployment/Dockerfile index 8480334..df72b3d 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -71,12 +71,13 @@ WORKDIR /app/src # Copy application and static files (owned by webssh in one layer, no separate chown pass) COPY --chown=webssh:webssh src/ /app/src/ COPY deployment/docker-entrypoint.sh /usr/local/bin/ +COPY deployment/scripts/password-reset /usr/local/bin/password-reset # Create .ssh directory for host keys RUN mkdir -p /app/src/.ssh && chown webssh:webssh /app/src/.ssh # Copy entrypoint -RUN chmod +x /usr/local/bin/docker-entrypoint.sh +RUN chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/password-reset # Copy the Caddy binary from the official image COPY --from=caddy /usr/bin/caddy /usr/local/bin/caddy diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 1dd4739..ec10161 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -12,8 +12,8 @@ services: - TZ=Europe/Sofia - PYTHONUNBUFFERED=1 - LOG_LEVEL=INFO - # Configure users: format is username:password,username2:password2 - - WEBSSH_USERS=admin:admin + # For a one-time import from a legacy installation, configure user:password pairs: + # - WEBSSH_USERS=user1:pass1,user2:pass2 # Max upload size, enforced by both Caddy and the backend (e.g. "30MB", "512KB") - MAX_UPLOAD_SIZE=30MB # Session Recording Configuration diff --git a/deployment/scripts/docker-build-and-push.sh b/deployment/scripts/docker-build-and-push.sh index 4f11c56..51efba6 100755 --- a/deployment/scripts/docker-build-and-push.sh +++ b/deployment/scripts/docker-build-and-push.sh @@ -7,7 +7,7 @@ set -e # Configuration IMAGE_NAME="danaildr/webssh" -VERSION="0.5.1" +VERSION="0.6.0" PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7" # Colors diff --git a/deployment/scripts/password-reset b/deployment/scripts/password-reset new file mode 100644 index 0000000..ecf1d87 --- /dev/null +++ b/deployment/scripts/password-reset @@ -0,0 +1,8 @@ +#!/bin/sh +set -eu + +if [ "$(id -u)" -eq 0 ]; then + exec gosu webssh python /app/src/password_reset.py "$@" +fi + +exec python /app/src/password_reset.py "$@" diff --git a/docker-hub-overview.md b/docker-hub-overview.md index 80f04b5..e9b996a 100644 --- a/docker-hub-overview.md +++ b/docker-hub-overview.md @@ -26,7 +26,6 @@ Multi-connection SSH client that runs entirely in your browser with JWT authenti ```bash docker run -d \ -p 8080:8080 \ - -e WEBSSH_USERS=admin:admin \ -e MAX_UPLOAD_SIZE=100M \ --name webssh \ --restart unless-stopped \ @@ -34,14 +33,13 @@ docker run -d \ ``` Then open http://localhost:8080 in your browser. -**Default credentials:** `admin` / `admin` +On first start, create the administrator account in the browser. Use a password with at least 12 characters. ### With Persistent Data & Auto-Lock ```bash docker run -d \ -p 8080:8080 \ -v webssh_data:/data \ - -e WEBSSH_USERS=user1:pass1,user2:pass2 \ -e JWT_SECRET=your-256-bit-secret-here \ -e MAX_UPLOAD_SIZE=500M \ -e RECORDING_ENABLED=true \ @@ -51,13 +49,19 @@ docker run -d \ danaildr/webssh:latest ``` +For a one-time import of legacy accounts, optionally set `WEBSSH_USERS=user1:pass1,user2:pass2`. +The first imported user becomes an administrator, other accounts have the `user` role, and all +imported users must change their password at first login. +Administrators can create and delete users from the application. +To reset an account password in a running container, use `docker exec -it webssh password-reset`. + **Note:** Auto-lock and auto-disconnect settings are configured per connection in the connection settings modal. ## Environment Variables | Variable | Description | Default | Required | |----------|-------------|---------|----------| -| `WEBSSH_USERS` | Comma-separated user:pass pairs | `admin:admin` | No | +| `WEBSSH_USERS` | Optional one-time import of legacy user:pass pairs; imported accounts must change their passwords | None | No | | `JWT_SECRET` | Secret for token signing | Auto-generated | Recommended | | `MAX_UPLOAD_SIZE` | Max file upload (e.g., `10M`, `1G`) | `100M` | No | | `RECORDING_ENABLED` | Enable session recording | `true` | No | @@ -97,6 +101,7 @@ services: ports: - "8080:8080" environment: + # Optional one-time import of legacy users: - WEBSSH_USERS=user1:pass1,user2:pass2 - JWT_SECRET=your-secret-key-here - MAX_UPLOAD_SIZE=100M @@ -105,7 +110,7 @@ services: ## Security Notes ⚠️ **Important for Production:** -- **Change default credentials** - Set strong passwords via `WEBSSH_USERS` +- **Create strong user passwords** - The first user is created during setup; imported users are prompted to replace legacy passwords - **Set a strong `JWT_SECRET`** - Use at least 32 random characters - **Use HTTPS** - Configure reverse proxy with SSL/TLS (container handles HTTP internally) - **SSH host keys** - Uses `AutoAddPolicy()` by default; configure strict host key checking for production diff --git a/src/help.html b/src/help.html index 16a67b9..7dad8be 100644 --- a/src/help.html +++ b/src/help.html @@ -330,7 +330,9 @@
"500K" - 500 kilobytesWEBSSH_USERS: Users in format username:password,username2:password2
WEBSSH_USERS: Optional one-time import in format username:password,username2:password2. The first imported user becomes an administrator, the rest have the user role, and all imported users must change their password at first login. Remove this variable after the import.
On a fresh installation without imported users, use the first-start form to create the administrator. New passwords must contain at least 12 characters.
+Administrators can create and delete accounts using Manage Users. New accounts must change their temporary password at first login.
JWT_SECRET: Secret key for JWT tokens (auto-generated if not set)
@@ -390,7 +392,7 @@📖 Project page: danaildr/webssh
🐳 Docker Hub: danaildr/webssh
📧 Support: See the project documentation for setup, env vars, and reverse proxy config.
-🔄 Version: WebSSH Multi-Connection Terminal v0.5.1
+🔄 Version: WebSSH Multi-Connection Terminal v0.6.0
⚡ Technologies: Python, Paramiko, WebSockets, HTML5, CSS3, JavaScript