ShellHub Documentation

repository·master·Indexed 24 days ago

https://github.com/shellhub-io/shellhub

A centralized SSH gateway for remote access and management of Linux servers, IoT devices, and Docker containers. Features include a lightweight ShellHub Agent for reverse SSH connections, a stateless Gateway for TLS termination and routing, and a comprehensive API for device admission, session management, and authentication. Supports native SSH/SCP/SFTP, session recording, and fine-grained access control.

Tokens
49.2K
Snippets
118
Records
306
Agent score
83%

What's inside ShellHub

  1. Overview of the ShellHub API Service

    master

    The API Service is the central component responsible for managing the core logic of the ShellHub platform. Its primary responsibilities include:

    • Device Admission: Managing how new devices are admitted into the network.
    • Session Management: Handling active user and device sessions.
    • Authentication: Managing identity for both users and devices.
    • Protocol Bridging: Bridging WebSocket connections to SSH, enabling web-based terminal access.
  2. Introduction to ShellHub

    master

    ShellHub is a centralized SSH gateway designed for remote access to Linux devices over the internet. It eliminates the need for public IPs, VPNs, or manual firewall changes by reversing the connection model.

    Core Connectivity Model

    Instead of opening inbound ports on devices, you install a lightweight agent on the target device. The agent initiates an outbound connection to the ShellHub server over HTTPS (port 443). This allows access through the ShellHub gateway even if the device is behind NAT, CGNAT, or strict corporate firewalls.

  3. Key capabilities of ShellHub

    master

    ShellHub provides several tools for managing and accessing remote Linux devices:

    • Web terminal: Access SSH sessions directly from a web browser.
    • Native SSH: Connect using standard clients like OpenSSH or PuTTY using a device's unique SSHID.
    • SCP and SFTP: Securely transfer files to and from remote devices.
    • Public key auth: Centralized management of SSH keys with per-device and per-user controls.
    • Firewall rules: Define access permissions based on users and source IPs.
    • Session recording: Record and replay terminal sessions for auditing purposes.
    • Device tagging: Organize and filter devices using labels/tags.
    • Multi-tenant: Isolate devices and teams into namespaces with role-based access control.
    • Container access: SSH directly into Docker containers running on the host devices.
    • MFA: Secure user authentication with multi-factor authentication.
  4. Core ShellHub features

    master

    ShellHub acts as a centralized SSH gateway for Linux servers and IoT devices. Key capabilities include:

    • Native SSH/SCP/SFTP Support: Use standard tools like OpenSSH Client, PuTTY, or SCP to manage devices without third-party apps.
    • SSH Port Forwarding: Securely forward TCP traffic to remote services or use SOCKS Proxy.
    • Security & Access Control: Supports public-key authentication, fine-grained SSH firewall rules, and audit logging for all connections.
    • Session Recording: Interactive SSH sessions are recorded and can be replayed via the ShellHub Web UI.
    • Container Remote Access: Seamless integration with Docker to securely connect to and manage containers.
  5. Core features of the ShellHub Agent

    master

    The ShellHub Agent provides several key capabilities for remote device management:

    • Secure Communication: Establishes encrypted connections between the device and the ShellHub server.
    • Device Registration: Automatically registers new devices with the ShellHub server upon installation, making them visible in the web interface.
    • Authentication and Access Control: Manages user authentication and enforces permissions defined by administrators.
    • Session Management: Handles SSH sessions initiated via the ShellHub web interface.
    • Heartbeat and Health Checks: Sends regular heartbeat signals to the ShellHub server to monitor device availability and health.
  6. Available ShellHub integrations

    master

    ShellHub supports several key integrations for managing and developing on your devices:

    • Ansible: Automate configuration management and deployments across your fleet.
    • Terraform: Provision infrastructure with the ShellHub agent pre-installed.
    • CI/CD Pipelines: Deploy, test, or provision devices from platforms like GitHub Actions or GitLab CI.
    • VS Code Remote SSH: Develop directly on remote devices using the VS Code Remote SSH extension.
  7. Compare ShellHub Editions

    master

    ShellHub is available in three editions: Community, Cloud, and Enterprise. All editions include core features like native SSH, web terminal, SCP/SFTP, public key authentication, namespaces, device tagging, and API access.

    Community Edition

    • Model: Self-hosted, open-source, and free.
    • Deployment: Deploy using Docker Compose on your own infrastructure.
    • Best for: Users who want full control over their infrastructure and do not require advanced security or management features.

    Cloud Edition

    • Model: Managed service hosted by the ShellHub team.
    • Deployment: No infrastructure to maintain; sign up at cloud.shellhub.io.
    • Key Features: Includes everything in Community plus Firewall rules, Session recording, Audit logging, MFA, HTTP tunnels, and Container access.
    • Best for: Users who want the fastest setup without managing servers or Docker.

    Enterprise Edition

    • Model: Advanced features with the choice of self-hosted or managed deployment.
    • Key Features: Includes everything in Cloud plus SAML/SSO authentication, advanced audit/compliance controls, and priority support.
    • Best for: Teams requiring identity provider integration (SAML/SSO) and high-level compliance/support.
  8. What is the ShellHub Agent?

    master
    The ShellHub Agent is a lightweight software component installed on a device to facilitate communication between that device and the ShellHub server. Its primary function is to maintain a reverse SSH connection to the ShellHub server, which enables users to establish SSH connections to the device even if it is located behind a firewall or NAT.
  9. Understand the ShellHub Gateway architecture

    master

    The gateway serves as ShellHub's entry point. Its primary responsibilities are terminating TLS and routing inbound HTTP requests and WebSocket connections to the server and the console.

    Key architectural details:

    • Routing Only: It does not handle authentication or subdomain resolution; those are managed by the API.
    • Embedded Caddy: The binary embeds Caddy as a library. It builds a Caddyfile from environment variables at startup, converts it to JSON, and loads it in memory. No configuration files are written to disk.
    • Stateless Configuration: Configuration is driven entirely by environment variables. A change in configuration requires a new container/process startup.
  10. Understand the SAML User Lifecycle

    master

    ShellHub manages user accounts automatically during the SSO flow based on whether the email in the SAML assertion matches an existing account:

    • First-time users: ShellHub automatically creates a new account using the email and name provided in the assertion. These accounts do not have a password and rely entirely on the IdP for authentication.
    • Existing users: ShellHub matches the assertion email to the existing account and enables SAML for that user. This preserves existing login methods (e.g., a user with a password can still use either their password or SSO).
    • IdP Migration: If you switch to a new IdP, existing SAML users are migrated automatically without requiring manual action.
  11. What are Namespaces in ShellHub

    master

    A namespace is an isolated workspace within ShellHub. It provides complete separation for resources, allowing you to manage different environments, projects, teams, or customers on a single ShellHub server.

    Everything in ShellHub is scoped to a namespace, including:

    • Devices: Each device belongs to exactly one namespace.
    • Sessions: Session history is isolated per namespace.
    • Public keys: SSH keys are scoped to the namespace.
    • Firewall rules: Rules apply only within the namespace.
    • Tags: Tags exist within a namespace.
    • Web endpoints: Endpoints are per namespace.
    • Team members: Members and their specific roles are scoped to the namespace.
    • Settings: Configuration for recording, announcements, and MFA is per namespace.
  12. Compare ShellHub vs. VPN for remote access

    master

    ShellHub is purpose-built for SSH access to specific devices rather than providing full network-level access like a VPN.

    FeatureShellHubVPN
    Setup per deviceInstall agent (1 command)Configure VPN client and server
    Network changesNone — outbound HTTPS onlyOften requires firewall and routing changes
    Access scopeSSH to specific devicesFull network access
    Works behind CGNATYesOften no
    Audit loggingBuilt-inRequires separate tooling

    Note: ShellHub is not a replacement for a VPN if your use case requires full network-level connectivity.