### Execute ShellHub Setup Script Source: https://docs.shellhub.io/self-hosted/deploying Runs the setup script to finalize the installation and create an initial user. This script generates a signed URL to complete the setup process. ```bash ./bin/setup ``` -------------------------------- ### Run ShellHub Setup Commands (Make) Source: https://docs.shellhub.io/self-hosted/deploying Executes the necessary make commands to generate keys and start the ShellHub services. This is part of the initial setup process after cloning the repository. ```bash make keygen make start ``` -------------------------------- ### Reload Systemd Daemon and Start ShellHub Agent Service Source: https://docs.shellhub.io/developers/agent/installing After creating the Podman Quadlet configuration file, these commands are used to reload the systemd daemon to recognize the new service and then to start the ShellHub agent service. ```bash systemctl daemon-reload ``` ```bash systemctl start shellhub-agent ``` -------------------------------- ### Clone Buildroot and ShellHub Repositories Source: https://docs.shellhub.io/overview/supported-platforms/buildroot Clones the necessary Git repositories for Buildroot and the ShellHub external tree. Ensure you have Git installed to use these commands. ```shell git clone git://git.buildroot.net/buildroot ``` ```shell git clone https://github.com/shellhub-io/buildroot.git shellhub ``` -------------------------------- ### Example: Set Tenant ID and Server Address Source: https://docs.shellhub.io/overview/supported-platforms/snap Configures the ShellHub Agent with a specific tenant ID and a custom server address. These commands require superuser privileges and the actual tenant ID and server address. ```shell sudo snap set shellhub tenant-id= sudo snap set shellhub server-address= ``` -------------------------------- ### Install ShellHub Agent with Automatic Script Source: https://docs.shellhub.io/developers/agent/installing This command installs the ShellHub Agent using an automatic one-line script. It requires Docker or Podman to be installed and set up. Optional parameters like `keepalive_interval` and `preferred_hostname` can be appended. ```bash sh <(curl -Ss http:///install.sh?tenant_id=) ``` -------------------------------- ### ShellHub WSL Installation Command Source: https://docs.shellhub.io/overview/supported-platforms/wsl This command installs ShellHub on WSL. It fetches an installation script from a provided URL and executes it with specific tenant and server address configurations. Ensure you replace the placeholder TENANT_ID with your actual tenant ID. ```bash curl -sSf https://cloud.shellhub.io/install.sh | TENANT_ID=00000000-0000-4000-0000-000000000000 SERVER_ADDRESS=https://cloud.shellhub.io sh ``` -------------------------------- ### Start ShellHub Instance Source: https://docs.shellhub.io/self-hosted/upgrading Starts the ShellHub instance. This command is used after fetching changes and checking out a new version to bring the upgraded instance online. ```shell make start ``` -------------------------------- ### Install ShellHub Agent using Snap Source: https://docs.shellhub.io/overview/supported-platforms/snap Installs the ShellHub Agent as a classic snap package. This command requires superuser privileges. ```shell sudo snap install --classic shellhub ``` -------------------------------- ### GET /info Source: https://docs.shellhub.io/developers/openapi/cloud Retrieves information about the ShellHub instance, including its version, API endpoints, setup status, and authentication methods. ```APIDOC ## Get info ### Description Retrieves information about the ShellHub instance, including its version, API endpoints, setup status, and authentication methods. ### Method GET ### Endpoint /info ### Parameters #### Query Parameters - **agent_version** (string) - Optional - Specifies the agent version for which to retrieve information. ### Request Example None ### Response #### Success Response (200) - **version** (string) - The version of the ShellHub instance. - **endpoints** (object) - Contains information about the SSH and API endpoints. - **ssh** (string) - The address of the SSH endpoint. - **api** (string) - The address of the API endpoint. - **setup** (boolean) - Indicates if the instance has been set up. - **authentication** (object) - Details about available authentication methods. - **local** (boolean) - Indicates if local authentication is enabled. - **saml** (boolean) - Indicates if SAML authentication is enabled. #### Response Example ```json { "version": "v0.19.0", "endpoints": { "ssh": "localhost:2222", "api": "localhost:8080" }, "setup": true, "authentication": { "local": true, "saml": false } } ``` #### Error Responses - **500** - Internal error ``` -------------------------------- ### Configure ShellHub in Yocto local.conf Source: https://docs.shellhub.io/developers/agent/installing These lines are added to the Yocto Project's `local.conf` file to install the ShellHub agent and set the tenant ID. `CORE_IMAGE_EXTRA_INSTALL` ensures the runtime package is installed, and `SHELLHUB_TENANT_ID` is set to your specific tenant ID. ```bash CORE_IMAGE_EXTRA_INSTALL += "packagegroup-shellhub-runtime" SHELLHUB_TENANT_ID = "" ``` -------------------------------- ### Get Firewall Rules List Sample (JSON) Source: https://docs.shellhub.io/developers/openapi/cloud Example JSON response for retrieving a list of firewall rules. This demonstrates the structure of the response when fetching multiple rules, where each rule is an object within a JSON array. ```json [ { "id": "507f1f77bcf86cd799439011", "tenant_id": "3dd0d1f8-8246-4519-b11a-a3dd33717f65", "action": "allow", "active": true, "filter": { "hostname": ".*" }, "priority": 1, "source_ip": ".*", "username": ".*" } ] ``` -------------------------------- ### Clone ShellHub Agent Source Code Source: https://docs.shellhub.io/developers/agent/installing This command clones the latest stable version of the ShellHub source code from GitHub. This is the first step for installing the agent from source. ```bash git clone -b v0.20.1 https://github.com/shellhub-io/shellhub.git shellhub ``` -------------------------------- ### Get Firewall Rule Sample (JSON) Source: https://docs.shellhub.io/developers/openapi/cloud Example JSON response for retrieving a single firewall rule. This shows the structure of a rule, including its ID, tenant ID, action, status, filter criteria, priority, source IP, and username. ```json { "id": "507f1f77bcf86cd799439011", "tenant_id": "3dd0d1f8-8246-4519-b11a-a3dd33717f65", "action": "allow", "active": true, "filter": { "hostname": ".*" }, "priority": 1, "source_ip": ".*", "username": ".*" } ``` -------------------------------- ### Start ShellHub Agent Service (Shell) Source: https://docs.shellhub.io/overview/supported-platforms/freebsd Starts the ShellHub Agent service on the FreeBSD system. The agent will then connect to the configured ShellHub server in the background. ```shell service shellhub start ``` -------------------------------- ### Build and Install ShellHub Agent (Shell) Source: https://docs.shellhub.io/overview/supported-platforms/freebsd Compiles and installs the ShellHub Agent on the FreeBSD system using the `make` utility. This command should be run from the agent's port directory. ```shell make install clean ``` -------------------------------- ### Get ShellHub Instance Info Response (JSON) Source: https://docs.shellhub.io/developers/openapi/community This JSON response provides details about the ShellHub instance, including its version, SSH and API endpoints, setup status, and authentication methods. ```json { "version": "v0.19.0", "endpoints": { "ssh": "localhost:2222", "api": "localhost:8080" }, "setup": true, "authentication": { "local": true, "saml": false } } ``` -------------------------------- ### Example JSON Payload for Add Tag Source: https://docs.shellhub.io/developers/openapi/community Example JSON payload for adding a tag to a public key. ```JSON { "tag": "tag" } ``` -------------------------------- ### Example SAML Assertion Query Parameter - ShellHub Source: https://docs.shellhub.io/admin-guides/authentication/saml/mapping This example shows how a SAML assertion might appear in a URL query parameter when attributes are missing. It helps in identifying which attributes failed during the authentication process. ```text ?missing_assertions=emailaddress,displayname ``` -------------------------------- ### GET /info Source: https://docs.shellhub.io/developers/openapi/community Retrieves information about the ShellHub instance, including version and endpoint details. ```APIDOC ## Get System Info ### Description Retrieves information about the ShellHub instance, such as its version, setup status, and API/SSH endpoints. ### Method GET ### Endpoint /info ### Parameters #### Query Parameters - **agent_version** (string) - Optional - Filters information based on the agent's version. ### Response #### Success Response (200) - **version** (string) - The version of the ShellHub instance. - **endpoints** (object) - Contains the addresses for SSH and API endpoints. - **ssh** (string) - The SSH endpoint address. - **api** (string) - The API endpoint address. - **setup** (boolean) - Indicates if the initial setup has been completed. - **authentication** (object) - Details about authentication methods. - **local** (boolean) - Whether local authentication is enabled. - **saml** (boolean) - Whether SAML authentication is enabled. #### Response Example ```json { "version": "v0.19.0", "endpoints": { "ssh": "localhost:2222", "api": "localhost:8080" }, "setup": true, "authentication": { "local": true, "saml": false } } ``` ``` -------------------------------- ### Download Latest ShellHub Version (Git) Source: https://docs.shellhub.io/self-hosted/deploying Clones the latest stable version of ShellHub (v0.20.1) from the official GitHub repository. This is the first step to setting up a self-hosted instance. ```bash git clone -b v0.20.1 https://github.com/shellhub-io/shellhub.git ``` -------------------------------- ### POST /api/setup Source: https://docs.shellhub.io/developers/openapi/community Initializes the ShellHub instance by setting up the first user and their namespace. ```APIDOC ## User Setup ### Description Registers the initial user and creates a namespace with the same name as the username. This is typically used for the first-time setup of a ShellHub instance. ### Method POST ### Endpoint /api/setup ### Parameters #### Query Parameters - **signrequired** (string) - Required - A signature generated by the `./bin/setup` script to validate the request origin. #### Request Body - **name** (string) - Required - [3-20 characters] The user's full name. - **email** (string) - Required - The user's email address. - **username** (string) - Required - [3-30 characters] The user's desired username. - **password** (string) - Required - [5-30 characters] The user's password. ### Request Example ```json { "name": "example", "email": "example@example.com", "username": "example", "password": "example" } ``` ### Response #### Success Response (200) Indicates successful user registration and namespace creation. #### Response Example (Error) ```json { "message": "Internal Server Error" } ``` ``` -------------------------------- ### Build ShellHub Agent from Source Source: https://docs.shellhub.io/developers/agent/installing These commands navigate to the agent directory within the cloned ShellHub repository and then build the ShellHub Agent executable using Go. It requires Go 1.18 or later. ```bash cd shellhub/agent ``` ```bash go build -ldflags "-X main.AgentVersion=v0.20.1" ``` -------------------------------- ### GET /api/user/mfa/generate Source: https://docs.shellhub.io/developers/openapi/cloud Generates MFA credentials for a user, including a setup link and recovery codes. Users are advised to securely store the provided recovery codes. ```APIDOC ## Generate MFA Credentials Generate the credentials to enable a user's MFA. The user must save the recovery codes a secure manner. ### Method GET ### Endpoint /api/user/mfa/generate ### Authorization - JWT ### Response #### Success Response (200) - **link** (string) - A `otpauth` URI for setting up an MFA authenticator app. - **secret** (string) - The secret key for MFA setup. - **recovery_codes** (array) - An array of recovery codes. #### Response Example ```json { "link": "otpauth://totp/shellhub-enterprise:662ba312616a7bdb5a2b608d?issuer=shellhub-enterprise&secret=TWBIH44WRHW44B773HJSG3RNZXH4KWSD", "secret": "TWBIH44WRHW44B773HJSG3RNZXH4KWSD", "recovery_codes": [ [ "MLNSPOB2L2ZRO2D5", "35QBUON4JAA4V6KP", "UYH34OY5RNDRRSUS", "IBWGL3IN42LTS3PP", "6DIGYYGM3JM7GXC4", "6UIHAIN3CYUEFY5X" ] ] } ``` ``` -------------------------------- ### Run Buildroot System with QEMU Source: https://docs.shellhub.io/overview/supported-platforms/buildroot Launches the built Buildroot system using QEMU for testing purposes. This command requires the kernel and rootfs images generated in the previous step and configures networking for remote access. ```shell qemu-system-x86_64 \ -kernel output/images/bzImage \ -drive file=output/images/rootfs.ext2,format=raw \ -append "root=/dev/sda console=ttyS0" \ -m 512M \ -nographic \ -netdev user,id=n0,hostfwd=tcp::2222-:22 \ -device virtio-net-pci,netdev=n0 ``` -------------------------------- ### Stop and Disable Apache2 Service Source: https://docs.shellhub.io/self-hosted/troubleshooting These commands are used to stop the Apache2 service if it is conflicting with ShellHub's port usage and to prevent it from automatically starting on boot. This is a common solution when port 80 is already in use. ```shell sudo systemctl stop apache2 ``` ```shell sudo update-rc.d apache2 disable ``` -------------------------------- ### View ShellHub Agent Configuration Source: https://docs.shellhub.io/overview/supported-platforms/snap Retrieves and displays the current configuration settings for the ShellHub Agent snap package. This includes details like the private key path, server address, and tenant ID. ```shell snap get shellhub ``` -------------------------------- ### POST /api/setup Source: https://docs.shellhub.io/developers/openapi/cloud Registers a new user and creates a namespace with the same name as the username. Requires a signature for validation. ```APIDOC ## User setup ### Description Registers a new user and creates a namespace with the same name as the username. Requires a signature for validation. ### Method POST ### Endpoint /api/setup ### Parameters #### Query Parameters - **sign** (string) - Required - Signature used to validate request origin, generated by running the `./bin/setup` script. #### Request Body - **name** (string) - Required - User's full name. Must be between 3 and 20 characters. - **email** (string) - Required - User's email address. - **username** (string) - Required - User's username. Must be between 3 and 30 characters and follow the pattern `^[a-zA-Z0-9-_.@]{3,30}$`. - **password** (string) - Required - User's password. Must be between 5 and 30 characters. ### Request Example ```json { "name": "example", "email": "example@example.com", "username": "example", "password": "example" } ``` ### Response #### Success Response (200) - Success message indicating the user was registered. #### Response Example (No specific success response body example provided, but typically a confirmation message would be returned). #### Error Responses - **400** - Bad request - **409** - Conflict - **500** - Internal error ``` -------------------------------- ### Get Firewall Rule API Response Sample Source: https://docs.shellhub.io/developers/openapi/cloud Example JSON response when successfully retrieving a firewall rule. It includes rule details such as ID, tenant ID, action, active status, filter criteria, priority, source IP, and username. ```json [ { "id": "507f1f77bcf86cd799439011", "tenant_id": "3dd0d1f8-8246-4519-b11a-a3dd33717f65", "action": "allow", "active": true, "filter": { "hostname": ".*" }, "priority": 1, "source_ip": ".*", "username": ".*" } ] ``` -------------------------------- ### GET /api/auth/user - Get User Info Source: https://docs.shellhub.io/developers/openapi/community Retrieves information about the authenticated user. ```APIDOC ## GET /api/auth/user ### Description Get user info. ### Method GET ### Endpoint /api/auth/user ### Authorization - jwt - api-key ### Response #### Success Response (200) - **token** (string) - JWT token for the session. - **id** (string) - User's unique identifier. - **origin** (string) - Origin of the user (e.g., "local"). - **user** (string) - Username. - **name** (string) - User's display name. - **email** (string) - User's email address. - **recovery_email** (string) - User's recovery email address. - **tenant** (string) - Tenant ID. - **role** (string) - User's role. - **mfa** (boolean) - Indicates if Multi-Factor Authentication is enabled. - **max_namespaces** (integer) - Maximum number of namespaces allowed for the user. #### Response Example (200) ```json { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJleGFtcGxlIiwibmFtZSI6ImV4YW1wbGUiLCJpYXQiOjE1MTYyMzkwMjJ9.zqCt70KspnNnitZlv89hDbFZ5iGMMRUn0wFEmmlY-to", "id": "507f1f77bcf86cd799439011", "origin": "local", "user": "example", "name": "example", "email": "example@example.com", "recovery_email": "user@example.com", "tenant": "3dd0d1f8-8246-4519-b11a-a3dd33717f65", "role": "administrator", "mfa": false, "max_namespaces": 3 } ``` #### Error Responses - **400** Bad request - **401** Unauthorized - **500** Internal error ``` -------------------------------- ### Build Buildroot System with ShellHub Source: https://docs.shellhub.io/overview/supported-platforms/buildroot Builds the root filesystem and kernel for the Buildroot system, incorporating the ShellHub integration. This command generates the necessary system images. ```shell make BR2_EXTERNAL=../shellhub rootfs-ext2 ``` -------------------------------- ### GET /api/sessions - Get Sessions Source: https://docs.shellhub.io/developers/openapi/cloud Retrieves a list of sessions with pagination options. ```APIDOC ## GET /api/sessions ### Description Retrieves a list of sessions with pagination options. ### Method GET ### Endpoint /api/sessions #### Query Parameters - **page** (integer) - Optional - Page number. Minimum value is 1. Defaults to 1. - **per_page** (integer) - Optional - Items per page. Must be between 1 and 100. Defaults to 10. ``` -------------------------------- ### Configure MongoDB Persistent Volume (Docker Compose) Source: https://docs.shellhub.io/self-hosted/deploying Sets up a persistent volume for the MongoDB container in `docker-compose.override.yml`, mounting a host directory to `/data/db` for persistent storage. ```yaml version: '3.7' services: mongo: volumes: - /usr/local/mongo/data:/data/db ``` -------------------------------- ### GET /api/token/{tenant} - Get Token by Tenant Source: https://docs.shellhub.io/developers/openapi/community Retrieves a token associated with a specific tenant. ```APIDOC ## GET /api/token/{tenant} ### Description Get a token from its tenant. ### Method GET ### Endpoint /api/token/{tenant} #### Path Parameters - **tenant** (string) - Required - The tenant ID for which to retrieve the token. ### Authorization - jwt ### Response #### Success Response (200) - **token** (string) - JWT token for the session. - **id** (string) - User's unique identifier. - **origin** (string) - Origin of the user (e.g., "local"). - **user** (string) - Username. - **name** (string) - User's display name. - **email** (string) - User's email address. - **recovery_email** (string) - User's recovery email address. - **tenant** (string) - Tenant ID. - **role** (string) - User's role. - **mfa** (boolean) - Indicates if Multi-Factor Authentication is enabled. - **max_namespaces** (integer) - Maximum number of namespaces allowed for the user. #### Response Example (200) ```json { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJleGFtcGxlIiwibmFtZSI6ImV4YW1wbGUiLCJpYXQiOjE1MTYyMzkwMjJ9.zqCt70KspnNnitZlv89hDbFZ5iGMMRUn0wFEmmlY-to", "id": "507f1f77bcf86cd799439011", "origin": "local", "user": "example", "name": "example", "email": "example@example.com", "recovery_email": "user@example.com", "tenant": "3dd0d1f8-8246-4519-b11a-a3dd33717f65", "role": "administrator", "mfa": false, "max_namespaces": 3 } ``` #### Error Responses - **401** Unauthorized - **500** Internal error ``` -------------------------------- ### GET /api/publickeys - Get Public Keys Source: https://docs.shellhub.io/developers/openapi/cloud Retrieves a list of all public keys accessible by the authenticated user. ```APIDOC ## GET /api/publickeys ### Description Retrieves a list of all public keys accessible by the authenticated user. ### Method GET ### Endpoint /api/publickeys ### Parameters None ### Request Example (No request body for GET requests) ### Response (Response structure for this endpoint is not detailed in the provided text. Typically returns a list of public key objects.) #### Success Response (200) - **keys** (array) - A list of public key objects. - **(object)** - Contains details of a public key (e.g., fingerprint, owner, creation date). #### Response Example ```json { "keys": [ { "fingerprint": "48:6e:fc:94:01:01:74:57:eb:57:49:91:15:e4:9c:7a", "owner": "user@example.com", "created_at": "2023-01-01T12:00:00Z" } ] } ``` ``` -------------------------------- ### Set ShellHub Agent Configuration Options Source: https://docs.shellhub.io/overview/supported-platforms/snap Sets or updates configuration options for the ShellHub Agent snap package. Replace `` and `` with the desired configuration parameter and its value. Requires superuser privileges. ```shell sudo snap set shellhub = ``` -------------------------------- ### GET /api/sessions/{uid}/records/{seat} - Get Session Record Source: https://docs.shellhub.io/developers/openapi/cloud Retrieves a session record based on its UID and seat. ```APIDOC ## GET /api/sessions/{uid}/records/{seat} ### Description Retrieves a session record based on its UID and seat. ### Method GET ### Endpoint /api/sessions/{uid}/records/{seat} #### Path Parameters - **uid** (string) - Required - Session's UID (e.g., `13b0c8ea878e61ff849db69461795006a9594c8f6a6390ce0000100b0c9d7d0a`) - **seat** (integer) - Required - Record's seat ### Response #### Success Response (200) - Success to play a session's record. - **uid** (string) - Session record UID. - **seat** (integer) - Record's seat. - **message** (string) - Session data. - **tenant_id** (string) - Namespace's tenant ID. - **time** (string) - Timestamp of the record. - **width** (integer) - Session's pty width. - **height** (integer) - Session's pty height. #### Error Responses - **400** - Bad request - **404** - Not found - **500** - Internal error #### Response Example (200) ```json [ { "uid": "50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c", "seat": 0, "message": "string", "tenant_id": "3dd0d1f8-8246-4519-b11a-a3dd33717f65", "time": "2020-05-01T00:00:00.000Z", "width": 24, "height": 111 } ] ``` ``` -------------------------------- ### Add meta-shellhub Layer to Yocto Project Source: https://docs.shellhub.io/developers/agent/installing This command clones the meta-shellhub layer, which is necessary for integrating ShellHub into an existing Yocto Project image. After cloning, specific configurations need to be added to the `local.conf` file. ```bash git clone git@github.com:shellhub-io/meta-shellhub.git ``` -------------------------------- ### Customize ShellHub Agent Configuration Source: https://docs.shellhub.io/overview/supported-platforms/buildroot Creates and edits the ShellHub agent configuration file using nano. This step allows setting the server address, tenant ID, and private key path. Replace placeholder values with your specific information. ```shell nano ../shellhub/rootfs_overlay/etc/default/shellhub-agent ``` ```properties SERVER_ADDRESS="https://cloud.shellhub.io" TENANT_ID="" PRIVATE_KEY="/etc/shellhub-agent.key" ``` -------------------------------- ### User Setup Internal Server Error Response (JSON) Source: https://docs.shellhub.io/developers/openapi/community This JSON response indicates an internal server error occurred during the user setup process. ```json { "message": "Internal Server Error" } ``` -------------------------------- ### Define ShellHub Agent as Podman Quadlet Systemd Service Source: https://docs.shellhub.io/developers/agent/installing This configuration file defines the ShellHub agent as a systemd service using Podman Quadlet. It specifies environment variables, the container image, necessary volumes, and service restart policies. This allows the agent to run persistently and be managed by systemd. ```ini [Unit] Description=shellhub agent container After=network-online.target [Container] ContainerName=shellhub-agent Environment=SHELLHUB_SERVER_ADDRESS= SHELLHUB_TENANT_ID= SHELLHUB_PRIVATE_KEY=/host/etc/shellhub.key Image=docker.io/shellhubio/agent: PodmanArgs=--pid host --privileged SecurityLabelDisable=true Volume=/:/host Volume=/dev:/dev Volume=/var/run/podman/podman.sock:/var/run/docker.sock Volume=/etc/passwd:/etc/passwd Volume=/etc/group:/etc/group Volume=/proc:/proc Volume=/var/run:/var/run Volume=/var/log:/var/log Volume=/tmp:/tmp [Service] Restart=always TimeoutStopSec=120 [Install] WantedBy=multi-user.target default.target ``` -------------------------------- ### Create API Key API Example Source: https://docs.shellhub.io/developers/openapi/cloud This snippet shows how to create an API key for a namespace. It includes parameters for the key's name, expiration, and role, and the created key details in the response. ```Shell POST /api/namespaces/api-key ``` ```JSON { "name": "dev", "expires_at": 30, "role": "owner", "key": "c629572a-b643-4301-90fe-4572b00d007e" } ``` -------------------------------- ### View ShellHub Agent Logs Source: https://docs.shellhub.io/overview/supported-platforms/snap Accesses the logs for the ShellHub Agent snap package to check for detailed error messages and debugging information. Requires superuser privileges. ```shell sudo snap logs shellhub ``` -------------------------------- ### Configure ShellHub Integration in Buildroot Source: https://docs.shellhub.io/overview/supported-platforms/buildroot Sets the default configuration for ShellHub within the Buildroot environment and launches the menuconfig interface for further customization. Requires navigating to the Buildroot directory. ```shell cd buildroot make BR2_EXTERNAL=../shellhub qemu_x86_64_defconfig ``` ```shell make BR2_EXTERNAL=../shellhub menuconfig ``` -------------------------------- ### Example Filter: Resource with confirmed=true (JSON) Source: https://docs.shellhub.io/developers/openapi/cloud An example JSON structure demonstrating how to filter resources where the 'confirmed' property is true. This uses a 'property' type filter with a 'bool' operator. ```json [ { "type": "property", "params": { "name": "confirmed", "operator": "bool", "value": "true" } } ] ``` -------------------------------- ### Get All Tags (GET /api/tags) Source: https://docs.shellhub.io/developers/openapi/cloud Retrieves a list of all available tags. Supports JWT or API key authorization. Returns a JSON array of tag names or appropriate error codes. ```json [ "tag1", "tag2", "tag3", "tag4" ] ``` -------------------------------- ### List API Keys API Example Source: https://docs.shellhub.io/developers/openapi/cloud This snippet demonstrates how to list API keys associated with a namespace. It supports pagination and sorting parameters for retrieving the keys. ```Shell GET /api/namespaces/api-key ``` -------------------------------- ### Configure NGINX for Websocket Traffic Source: https://docs.shellhub.io/self-hosted/deploying Provides NGINX configuration blocks to properly handle WebSocket traffic for ShellHub, essential when using NGINX as an SSL terminator. ```nginx location / { proxy_pass http://:; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; proxy_set_header Host $host; } location /ws/ { proxy_pass http://:; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; } location /ssh/ { proxy_pass http://:; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; } ``` -------------------------------- ### Get a Single Announcement (GET /api/announcements/{uuid}) Source: https://docs.shellhub.io/developers/openapi/cloud Retrieves a specific announcement by its UUID. Expected responses include success (200) with the announcement details and error codes (404, 500). ```shell curl -X GET \ https://cloud.shellhub.io/api/announcements/3dd0d1f8-8246-4519-b11a-a3dd33717f65 \ -H 'Accept: application/json' ``` -------------------------------- ### User Setup Request Payload (JSON) Source: https://docs.shellhub.io/developers/openapi/community This JSON payload is used for registering a new user and creating a namespace. It includes the user's name, email, username, and password. ```json { "name": "example", "email": "example@example.com", "username": "example", "password": "example" } ``` -------------------------------- ### Get Customer Details - API Source: https://docs.shellhub.io/developers/openapi/cloud Endpoint to retrieve customer information. It uses a GET request and requires authentication. The response includes customer details such as ID, name, email, and payment methods. ```http GET /api/billing/customer Host: localhost ``` -------------------------------- ### Configure ShellHub Agent Settings (Shell) Source: https://docs.shellhub.io/overview/supported-platforms/freebsd Configures the ShellHub Agent by adding necessary settings to the `/etc/rc.conf` file. This includes enabling the agent, setting the server address, and specifying the tenant ID. ```shell # Enable ShellHub Agent shellhub_enable="YES" # Set the ShellHub Server Address shellhub_server_address="https://cloud.shellhub.io" # Set the Tenant ID shellhub_tenant_id="00000000-0000-0000-0000-000000000000" ``` -------------------------------- ### Get ShellHub Instance Stats (GET) Source: https://docs.shellhub.io/developers/openapi/community Retrieves statistics for the ShellHub instance, including counts of registered, online, pending, rejected devices, and active sessions. Requires JWT or API key authorization. ```JSON { "registered_devices": 0, "online_devices": 0, "pending_devices": 0, "rejected_devices": 0, "active_sessions": 0 } ``` -------------------------------- ### Container Filter Interface Example (TypeScript) Source: https://docs.shellhub.io/developers/openapi/community This example demonstrates the TypeScript interface for constructing filter parameters when querying containers. It defines the structure for property-based filters and logical operators like 'and' or 'or'. ```TypeScript interface ParamProperty { name: string; operator: "contains" | "eq" | "bool" | "gt" | "lt"; value: string; } interface ParamOperator { name: "and" | "or"; } interface Filter { type: "property" | "operator"; param: ParamOperator | ParamProperty; } interface FilterList { Filters: Array; } ``` -------------------------------- ### Get Subscription Details - API Source: https://docs.shellhub.io/developers/openapi/cloud Endpoint to retrieve subscription details. It uses a GET request and requires authentication. The response includes subscription information like ID, status, end date, and associated invoices. ```http GET /api/billing/subscription Host: localhost ```