A powerful web-based interface for executing commands on local and remote Linux servers. Built with Go and React with Material-UI for a professional, modern user experience.
Main dashboard with feature cards for easy navigation
Main dashboard with feature cards for easy navigation
Execute commands on your local server with real-time output
Connect to remote servers via SSH and execute commands
Connect to remote servers via SSH and execute script
Full browser-based terminal with SSH key integration and server aliases
Manage SSH private keys for server authentication
Configure and manage remote servers
Save and reuse frequently-used command templates with type indicators
View complete execution history with output and timing
git clone https://github.com/pozgo/web-cli.git
cd web-cli
go mod download
cd frontend
npm install
cd ..
# Build the application
./build.sh
# Run the server
./web-cli
Access the application at http://localhost:7777
# Start the server
./manage.sh start
# Stop the server
./manage.sh stop
# Check status
./manage.sh status
ssh myserver (servers from Admin Panel)SSH Server Aliases: When you add servers in the Admin Panel, they become available as SSH aliases in the terminal:
# If you added a server named "prod" with IP 10.0.0.5 and user "deploy"
ssh prod # Automatically connects to [email protected]
Web CLI provides a comprehensive RESTful API for programmatic access to all features. Perfect for automation, CI/CD pipelines, and integration with other tools.
Base URL: http://localhost:7777/api
Example Request:
curl http://localhost:7777/api/health
# Response: {"status":"ok"}
| Category | Endpoints | Description |
|---|---|---|
| Health | 1 endpoint | Server health check |
| Terminal | 1 WebSocket | Interactive terminal sessions |
| SSH Keys | 5 endpoints | Manage SSH private keys |
| Servers | 5 endpoints | Manage remote servers |
| Local Users | 5 endpoints | Manage local user accounts |
| System Info | 1 endpoint | Get current system user |
| Commands | 1 endpoint | Execute local/remote commands |
| Saved Commands | 5 endpoints | Manage command templates |
| History | 2 endpoints | View execution history |
| Environment Variables | 5 endpoints | Manage encrypted env variables |
| Bash Scripts | 6 endpoints | Manage and execute scripts |
| Script Presets | 5 endpoints | Manage execution presets |
Total: 43 endpoints (42 REST + 1 WebSocket)
Interactive API documentation is available at /swagger/ when the server is running.
Access: http://localhost:7777/swagger/
For detailed API documentation including:
š See API.mdā for complete API reference
Note: If authentication is enabled, add -u username:password or -H "Authorization: Bearer token" to all requests.
Execute a local command:
curl -u admin:password -X POST http://localhost:7777/api/commands/execute \
-H "Content-Type: application/json" \
-d '{"command": "df -h", "user": "root"}'
Execute a remote command via SSH:
curl -u admin:password -X POST http://localhost:7777/api/commands/execute \
-H "Content-Type: application/json" \
-d '{
"command": "uptime",
"is_remote": true,
"server_id": 1,
"ssh_key_id": 2
}'
List command history:
curl -u admin:password "http://localhost:7777/api/history?limit=10&server=local"
Using Bearer Token:
curl -H "Authorization: Bearer your-api-token" \
-X POST http://localhost:7777/api/commands/execute \
-H "Content-Type: application/json" \
-d '{"command": "uptime", "user": "current"}'
./web-cli [options]
Options:
-port int Port to listen on (default: 7777)
-host string Host to bind to (default: 0.0.0.0)
-frontend string Path to frontend build files (default: ./frontend/dist)
-db string Path to database file (default: ./data/web-cli.db)
-encryption-key string Path to encryption key file (default: ./.encryption_key)
-tls-cert string Path to TLS certificate file (enables HTTPS)
-tls-key string Path to TLS private key file
-require-https Require HTTPS when auth is enabled (reject HTTP requests)
All configuration options can be set via environment variables:
# Standard environment variables
PORT=8080 HOST=localhost ./web-cli
# WEBCLI-prefixed variables (recommended)
WEBCLI_PORT=8080
WEBCLI_HOST=localhost
WEBCLI_DATABASE_PATH=/var/lib/web-cli/web-cli.db
WEBCLI_ENCRYPTION_KEY_PATH=/etc/web-cli/encryption.key
WEBCLI_TLS_CERT_PATH=/etc/ssl/certs/web-cli.crt
WEBCLI_TLS_KEY_PATH=/etc/ssl/private/web-cli.key
WEBCLI_REQUIRE_HTTPS=true
Web CLI supports configuration files in YAML, JSON, or TOML format. Configuration files are searched in the following locations (first found is used):
./config.yaml (current directory)./config/config.yaml (config subdirectory)/etc/web-cli/config.yaml (system config)~/.config/web-cli/config.yaml (user config)Example config.yaml:
port: 7777
host: "0.0.0.0"
frontend_path: "./assets/frontend"
database_path: "./data/web-cli.db"
encryption_key_path: "./.encryption_key"
tls_cert_path: "/etc/ssl/certs/web-cli.crt"
tls_key_path: "/etc/ssl/private/web-cli.key"
require_https: true
Important: Authentication is disabled by default for development convenience.
For production deployments, enable authentication:
# Enable authentication
export AUTH_ENABLED=true
# Option 1: HTTP Basic Authentication
export AUTH_USERNAME="admin"
export AUTH_PASSWORD="your-secure-password"
# Option 2: API Token (Bearer)
export AUTH_API_TOKEN="your-api-token-here"
Features:
Usage Examples:
# Basic Auth
curl -u admin:password http://localhost:7777/api/health
# Bearer Token
curl -H "Authorization: Bearer your-token" http://localhost:7777/api/health
Native TLS support for encrypted connections:
# Enable TLS with certificate and key
./web-cli -tls-cert /path/to/cert.pem -tls-key /path/to/key.pem
# Or via environment variables
WEBCLI_TLS_CERT_PATH=/path/to/cert.pem \
WEBCLI_TLS_KEY_PATH=/path/to/key.pem \
./web-cli
# Enforce HTTPS when authentication is enabled
./web-cli -tls-cert cert.pem -tls-key key.pem -require-https
Features:
Generate self-signed certificate for testing:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem \
-days 365 -nodes -subj "/CN=localhost"
Proper host key verification for secure SSH connections:
~/.ssh/known_hostsConfiguration:
All user inputs are validated before processing:
Server configured with proper timeouts:
ReadTimeout: 15 * time.Second // Prevents slowloris attacks
WriteTimeout: 15 * time.Second // Prevents slow writes
IdleTimeout: 60 * time.Second // Prevents idle connections
CORS Policy:
CORS_ALLOWED_ORIGINS environment variable# Single origin
export CORS_ALLOWED_ORIGINS="https://web-cli.example.com"
# Multiple origins (comma-separated)
export CORS_ALLOWED_ORIGINS="https://web-cli.example.com,https://admin.example.com"
All sensitive data is encrypted using AES-256-GCM:
.encryption_key with 600 permissionsImportant:
.encryption_key file - data cannot be recovered without itGenerate a new encryption key:
# macOS/Linux
openssl rand -base64 32
# Or using dd and base64
dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64
# Output example: 7xK9mP2vQ8nL4wR6tY5uE3sA1zD0cF8bG7hJ9kM6nP4=
Use the generated key:
# Option 1: Environment variable (recommended for production)
export ENCRYPTION_KEY="7xK9mP2vQ8nL4wR6tY5uE3sA1zD0cF8bG7hJ9kM6nP4="
./web-cli
# Option 2: Save to file (auto-generated on first run if not exists)
echo "7xK9mP2vQ8nL4wR6tY5uE3sA1zD0cF8bG7hJ9kM6nP4=" > .encryption_key
chmod 600 .encryption_key
./web-cli
Production Environment Variables:
# Authentication (REQUIRED for production)
AUTH_ENABLED=true
AUTH_USERNAME=admin
AUTH_PASSWORD=$(openssl rand -base64 32) # Or your secure password
# OR use API token
AUTH_API_TOKEN=$(openssl rand -base64 32)
# CORS Policy (REQUIRED for production)
CORS_ALLOWED_ORIGINS=https://web-cli.yourdomain.com
# Encryption (REQUIRED)
ENCRYPTION_KEY=$(openssl rand -base64 32)
# TLS/HTTPS (RECOMMENDED for production)
WEBCLI_TLS_CERT_PATH=/etc/ssl/certs/web-cli.crt
WEBCLI_TLS_KEY_PATH=/etc/ssl/private/web-cli.key
WEBCLI_REQUIRE_HTTPS=true
# Server Config (Optional)
WEBCLI_PORT=7777
WEBCLI_HOST=0.0.0.0
Testing Authentication:
# Should fail (no auth)
curl http://localhost:7777/api/health
# Should succeed with Basic Auth
curl -u admin:password http://localhost:7777/api/health
# Should succeed with Bearer token
curl -H "Authorization: Bearer your-token" http://localhost:7777/api/health
Web CLI is available as a Docker image for easy deployment.
Image Details:
polinux/web-cli)linux/amd64, linux/arm64Quick Start with Docker Compose:
# Clone the repository
git clone https://github.com/pozgo/web-cli.git
cd web-cli
# Start with default settings
docker compose up -d
# View logs
docker compose logs -f
Access: http://localhost:7777
Build Locally:
# Build the image
docker compose build
# Or build directly
docker build -t web-cli .
Run with Custom Configuration:
# Copy example environment file
cp .env.example .env
# Edit .env with your settings
nano .env
# Start with custom configuration
docker compose up -d
Production Deployment:
# Create .env with production settings
cat > .env << 'EOF'
AUTH_ENABLED=true
AUTH_USERNAME=admin
AUTH_PASSWORD=$(openssl rand -base64 24)
WEBCLI_PORT=7777
EOF
# Start the container
docker compose up -d
# Check credentials
cat .env | grep AUTH_
Docker Run (without Compose):
docker run -d \
--name web-cli \
-p 7777:7777 \
-v web-cli-data:/data \
-e AUTH_ENABLED=true \
-e AUTH_USERNAME=admin \
-e AUTH_PASSWORD=your-secure-password \
polinux/web-cli:latest
With TLS/HTTPS:
docker run -d \
--name web-cli \
-p 7777:7777 \
-v web-cli-data:/data \
-v ./certs:/certs:ro \
-e WEBCLI_TLS_CERT_PATH=/certs/cert.pem \
-e WEBCLI_TLS_KEY_PATH=/certs/key.pem \
-e AUTH_ENABLED=true \
-e AUTH_USERNAME=admin \
-e AUTH_PASSWORD=your-secure-password \
polinux/web-cli:latest
Docker Environment Variables:
| Variable | Default | Description |
|---|---|---|
WEBCLI_PORT | 7777 | Port to listen on |
WEBCLI_HOST | 0.0.0.0 | Host to bind to |
WEBCLI_DATABASE_PATH | /data/web-cli.db | Database file path |
WEBCLI_ENCRYPTION_KEY_PATH | /data/.encryption_key | Encryption key file path |
ENCRYPTION_KEY | (auto-generated) | Base64 encryption key |
AUTH_ENABLED | false | Enable authentication |
AUTH_USERNAME | admin | Basic auth username |
AUTH_PASSWORD | (none) | Basic auth password |
AUTH_API_TOKEN | (none) | Bearer token |
WEBCLI_TLS_CERT_PATH | (none) | TLS certificate path |
WEBCLI_TLS_KEY_PATH | (none) | TLS private key path |
WEBCLI_REQUIRE_HTTPS | false | Require HTTPS |
CORS_ALLOWED_ORIGINS | (localhost) | Allowed CORS origins |
Volumes:
| Path | Description |
|---|---|
/data | Persistent data (database, encryption key) |
/config | Configuration files (optional) |
/certs | TLS certificates (optional) |
web-cli/
āāā cmd/web-cli/ # Application entry point
āāā internal/ # Private application code
ā āāā config/ # Configuration management
ā āāā database/ # Database, migrations, encryption
ā āāā executor/ # Command execution (local & remote)
ā ā āāā hostkeys.go # SSH host key verification
ā āāā middleware/ # HTTP middleware (authentication)
ā āāā models/ # Data models
ā āāā repository/ # Data access layer
ā āāā server/ # HTTP server and handlers
ā āāā terminal/ # Interactive terminal (PTY + WebSocket)
ā āāā validation/ # Input validation functions
āāā frontend/ # React application
ā āāā src/
ā ā āāā components/ # React components
ā ā ā āāā Terminal.jsx # xterm.js terminal component
ā ā āāā theme/ # MUI theme configuration
ā ā āāā App.jsx # Main app with routing
ā āāā vite.config.js # Vite configuration
āāā build.sh # Build script (all platforms)
āāā manage.sh # Server management script
āāā API.md # Complete API documentation
āāā go.mod # Go dependencies
Content type
Image
Digest
sha256:41fd185e5ā¦
Size
59.9 MB
Last updated
8 months ago
docker pull polinux/web-cli