### OIDC Troubleshooting Guide Source: https://docs.termix.site/oidc Common issues encountered during OIDC integration and their solutions. ```APIDOC ## Troubleshooting OIDC Integration ### Common Issues 1. **"Invalid redirect URI" error** * **Solution**: Ensure the redirect URI in your OIDC provider matches exactly. Check for trailing slashes or protocol mismatches. 2. **"Client authentication failed" error** * **Solution**: Verify your Client ID and Client Secret are correct. Ensure the Client Secret hasn't expired or been regenerated. 3. **"Invalid scope" error** * **Solution**: Check that all requested scopes are supported by your provider. Ensure the `openid` scope is always included. 4. **"Invalid issuer" error** * **Solution**: Verify the Issuer URL matches your provider's issuer identifier. Check for protocol mismatches (http vs https). 5. **"Failed to get user information" error** * **Solution**: Use the `Override User Info URL` field in OIDC configs within Termix. You can find this URL within your providers' config. ``` -------------------------------- ### Okta OIDC Provider Details Source: https://docs.termix.site/oidc Provides the specific URLs and scopes required to configure Okta as an OpenID Connect provider. ```APIDOC ## Okta OIDC Provider Configuration ### Description Details for configuring Okta as an OpenID Connect (OIDC) provider. ### Method N/A (Configuration Details) ### Endpoint N/A (Configuration Details) ### Parameters #### Configuration Values - **Authorization URL** (string) - The URL for initiating the OAuth 2.0 authorization flow. - **Token URL** (string) - The URL for exchanging authorization codes for access tokens. - **Issuer URL** (string) - The base URL identifying the OIDC provider. - **Scopes** (string) - The requested scopes for the authentication request. ### Request Example ```json { "domain": "{your-domain}.okta.com", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" } ``` ### Response #### Configuration Parameters - **Authorization URL** (string) - `https://{your-domain}.okta.com/oauth2/v1/authorize` - **Token URL** (string) - `https://{your-domain}.okta.com/oauth2/v1/token` - **Issuer URL** (string) - `https://{your-domain}.okta.com/oauth2/default` - **Scopes** (string) - `openid email profile` ``` -------------------------------- ### Auth0 OIDC Provider Details Source: https://docs.termix.site/oidc Provides the specific URLs and scopes required to configure Auth0 as an OpenID Connect provider. ```APIDOC ## Auth0 OIDC Provider Configuration ### Description Details for configuring Auth0 as an OpenID Connect (OIDC) provider. ### Method N/A (Configuration Details) ### Endpoint N/A (Configuration Details) ### Parameters #### Configuration Values - **Authorization URL** (string) - The URL for initiating the OAuth 2.0 authorization flow. - **Token URL** (string) - The URL for exchanging authorization codes for access tokens. - **Issuer URL** (string) - The base URL identifying the OIDC provider. - **Scopes** (string) - The requested scopes for the authentication request. ### Request Example ```json { "domain": "{your-domain}.auth0.com", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" } ``` ### Response #### Configuration Parameters - **Authorization URL** (string) - `https://{your-domain}.auth0.com/authorize` - **Token URL** (string) - `https://{your-domain}.auth0.com/oauth/token` - **Issuer URL** (string) - `https://{your-domain}.auth0.com/` - **Scopes** (string) - `openid email profile` ``` -------------------------------- ### Installing sshpass Package Source: https://docs.termix.site/tunnels Commands to install the `sshpass` utility on various Linux distributions and macOS, which is necessary for password-based SSH authentication. ```bash # Debian/Ubuntu: sudo apt install sshpass # CentOS/RHEL/Fedora: sudo yum install sshpass # or sudo dnf install sshpass # macOS: brew install hudochenkov/sshpass/sshpass ``` -------------------------------- ### Google OIDC Provider Configuration Source: https://docs.termix.site/oidc Configuration details for integrating Google as an OpenID Connect provider. Includes Authorization URL, Token URL, Issuer URL, and default Scopes. ```text Authorization URL: https://accounts.google.com/o/oauth2/v2/auth Token URL: https://oauth2.googleapis.com/token Issuer URL: https://accounts.google.com Scopes: openid email profile ``` -------------------------------- ### Get Pinned Files for Host (JavaScript) Source: https://docs.termix.site/operations/getFileManagerPinned Example using JavaScript's Fetch API to get pinned files from the Termix API. Includes setting the Authorization header. ```javascript fetch('http://localhost:8081/ssh/file_manager/pinned', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Setup TOTP Authentication Source: https://docs.termix.site/operations/setupTOTP Initiates the setup process for Time-based One-Time Password (TOTP) authentication. This endpoint requires bearer token authorization. Upon successful execution, it returns a JSON object containing the secret key and a QR code for authenticator app configuration. ```curl curl http://localhost:8081/users/totp/setup \ --request POST \ --header 'Authorization: Token' ``` ```javascript fetch('http://localhost:8081/users/totp/setup', { method: 'POST', headers: { Authorization: 'Token' } }) ``` ```php $ch = curl_init("http://localhost:8081/users/totp/setup"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ``` ```python requests.post("http://localhost:8081/users/totp/setup", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Get File Shortcuts - PHP Source: https://docs.termix.site/operations/getFileManagerShortcuts Provides a PHP example for getting file shortcuts from an SSH host. It utilizes cURL functions to send a GET request with the necessary Authorization header. ```php $ch = curl_init("http://localhost:8081/ssh/file_manager/shortcuts"); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ``` -------------------------------- ### Microsoft Azure AD OIDC Provider Configuration Source: https://docs.termix.site/oidc Configuration details for integrating Microsoft Azure Active Directory as an OpenID Connect provider. Requires a tenant-ID placeholder and specifies URLs and default Scopes. ```text Authorization URL: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize Token URL: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token Issuer URL: https://login.microsoftonline.com/{tenant-id}/v2.0 Scopes: openid email profile ``` -------------------------------- ### Get All System Alerts (Python) Source: https://docs.termix.site/operations/getAllAlerts This snippet provides a Python example using the requests library to fetch system alerts from the Termix API. It demonstrates how to include the Authorization header in the request. ```Python requests.get("http://localhost:8081/alerts", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Install Project Dependencies Source: https://docs.termix.site/contributing After cloning the repository, this command installs all necessary Node.js dependencies required to run and develop Termix. ```sh npm install ``` -------------------------------- ### Get Pinned Files for Host (Python) Source: https://docs.termix.site/operations/getFileManagerPinned Example using Python's requests library to fetch pinned files from the Termix API. Shows how to include the Authorization header. ```python requests.get( "http://localhost:8081/ssh/file_manager/pinned", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Get File Shortcuts - cURL Source: https://docs.termix.site/operations/getFileManagerShortcuts Example of fetching file shortcuts for an SSH host using cURL. It sends a GET request to the /ssh/file_manager/shortcuts endpoint with an Authorization header. ```bash curl http://localhost:8081/ssh/file_manager/shortcuts \ --header 'Authorization: Token' ``` -------------------------------- ### Fetch Releases (Python) Source: https://docs.termix.site/operations/getReleasesRSS Example of fetching releases in RSS format using Python's requests library. The Authorization header is included in the request. ```Python requests.get("http://localhost:8081/releases/rss", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Example SSH Host Import JSON - Termix Source: https://docs.termix.site/json-import This JSON structure demonstrates how to import multiple SSH hosts with various authentication methods and configurations, including tunnels. It shows required fields, optional fields, and nested tunnel configurations. ```json { "hosts": [ { "name": "Web Server - Production", "ip": "192.168.1.100", "port": 22, "username": "admin", "authType": "password", "password": "your_secure_password_here", "folder": "Production", "tags": ["web", "production", "nginx"], "pin": true, "enableTerminal": true, "enableTunnel": false, "enableFileManager": true, "defaultPath": "/var/www" }, { "name": "Database Server", "ip": "192.168.1.101", "port": 22, "username": "dbadmin", "authType": "key", "key": "-----BEGIN OPENSSH PRIVATE KEY-----\nYour SSH private key content here\n-----END OPENSSH PRIVATE KEY-----", "keyPassword": "optional_key_passphrase", "keyType": "ssh-ed25519", "folder": "Production", "tags": ["database", "production", "postgresql"], "pin": false, "enableTerminal": true, "enableTunnel": true, "enableFileManager": false, "tunnelConnections": [ { "sourcePort": 5432, "endpointPort": 5432, "endpointHost": "Web Server - Production", "maxRetries": 3, "retryInterval": 10, "autoStart": true } ] }, { "name": "Development Server", "ip": "192.168.1.102", "port": 2222, "username": "developer", "authType": "credential", "credentialId": 1, "folder": "Development", "tags": ["dev", "testing"], "pin": false, "enableTerminal": true, "enableTunnel": false, "enableFileManager": true, "defaultPath": "/home/developer" } ] } ``` -------------------------------- ### Get Pinned Files for Host (PHP) Source: https://docs.termix.site/operations/getFileManagerPinned Example using PHP and cURL to request pinned files from the Termix API. Demonstrates setting the Authorization header. ```php $ch = curl_init("http://localhost:8081/ssh/file_manager/pinned"); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ``` -------------------------------- ### Fetch Releases (JavaScript) Source: https://docs.termix.site/operations/getReleasesRSS Example of fetching releases in RSS format using JavaScript's fetch API. Includes bearer token authorization in the request headers. ```JavaScript fetch('http://localhost:8081/releases/rss', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Get Pinned Files for Host (cURL) Source: https://docs.termix.site/operations/getFileManagerPinned Example using cURL to make a GET request to the Termix API to retrieve pinned files for a host. It requires an Authorization header. ```curl curl http://localhost:8081/ssh/file_manager/pinned \ --header 'Authorization: Token' ``` -------------------------------- ### Fetch Releases (cURL) Source: https://docs.termix.site/operations/getReleasesRSS Example of fetching releases in RSS format using cURL. Requires a bearer token for authorization. ```cURL curl http://localhost:8081/releases/rss \ --header 'Authorization: Token' ``` -------------------------------- ### Fetch Releases (PHP) Source: https://docs.termix.site/operations/getReleasesRSS Example of fetching releases in RSS format using PHP with cURL. It sets the Authorization header with a bearer token. ```PHP $ch = curl_init("http://localhost:8081/releases/rss"); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ``` -------------------------------- ### Get File Shortcuts - Python Source: https://docs.termix.site/operations/getFileManagerShortcuts Illustrates how to fetch file shortcuts for an SSH host using Python's requests library. The code sends a GET request with the Authorization header set. ```python requests.get( "http://localhost:8081/ssh/file_manager/shortcuts", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Run Termix Development Server Source: https://docs.termix.site/contributing These commands start both the backend and frontend development servers for Termix. The frontend runs on Vite. ```sh npm run dev npm run dev:backend ``` -------------------------------- ### Get Alerts by User ID (JavaScript) Source: https://docs.termix.site/operations/getUserAlerts Demonstrates fetching alerts for a specific user using JavaScript's fetch API. This example shows how to make a GET request to the endpoint and include the Authorization header. ```JavaScript fetch('http://localhost:8081/alerts/user/{userId}', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Get SSH Host Folders (JavaScript) Source: https://docs.termix.site/operations/getSSHFolders Provides a JavaScript example using the Fetch API to retrieve SSH host folders. An Authorization header with a bearer token is necessary. ```javascript fetch('http://localhost:8081/ssh/db/folders', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Get Recent Files for SSH Host (Python) Source: https://docs.termix.site/operations/getFileManagerRecent This Python example demonstrates how to fetch recent files for an SSH host using the `requests` library, including the authorization header. ```python requests.get( "http://localhost:8081/ssh/file_manager/recent", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Get File Shortcuts - JavaScript Source: https://docs.termix.site/operations/getFileManagerShortcuts Demonstrates how to retrieve file shortcuts for an SSH host using JavaScript's Fetch API. It makes a GET request to the specified endpoint, including the Authorization header. ```javascript fetch('http://localhost:8081/ssh/file_manager/shortcuts', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Clone Termix Repository Source: https://docs.termix.site/contributing This command clones the Termix project from GitHub to your local machine, allowing you to start contributing. ```sh git clone https://github.com/LukeGus/Termix ``` -------------------------------- ### List SSH Files - cURL Source: https://docs.termix.site/operations/listSSHFiles Example of how to list files in an SSH directory using cURL. It sends a GET request to the specified endpoint with an authorization header. ```cURL curl http://localhost:8081/ssh/file_manager/ssh/listFiles \ --header 'Authorization: Token' ``` -------------------------------- ### GET /releases/rss Source: https://docs.termix.site/operations/getReleasesRSS Retrieves a list of project releases in RSS format. Supports pagination and filtering via query parameters. ```APIDOC ## GET /releases/rss ### Description Retrieves releases in RSS format from the Termix project. ### Method GET ### Endpoint /releases/rss ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number for pagination. Defaults to `1`. - **per_page** (integer) - Optional - The number of items per page. Defaults to `20`, with a maximum of `100`. ### Request Example ```json { "Authorization": "Token" } ``` ### Response #### Success Response (200) - **feed** (object) - Contains feed metadata like title, description, link, and updated time. - **items** (array) - An array of release items, each with id, title, description, link, pubDate, version, isPrerelease, isDraft, and assets. - **total_count** (integer) - The total number of releases available. - **cached** (boolean) - Indicates if the response is from cache. - **cache_age** (integer) - The age of the cached response in seconds. #### Response Example ```json { "feed": { "title": "string", "description": "string", "link": "string", "updated": "string" }, "items": [ { "id": 0, "title": "string", "description": "string", "link": "string", "pubDate": "string", "version": "string", "isPrerelease": true, "isDraft": true, "assets": [ { "name": "string", "size": 0, "download_count": 0, "download_url": "string" } ] } ], "total_count": 0, "cached": true, "cache_age": 0 } ``` ``` -------------------------------- ### Get Alerts by User ID (Python) Source: https://docs.termix.site/operations/getUserAlerts Illustrates how to get alerts for a specific user in Python using the requests library. The code demonstrates a GET request with the Authorization header set. ```Python requests.get( "http://localhost:8081/alerts/user/{userId}", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Create User Account (cURL) Source: https://docs.termix.site/operations/createUser Example of creating a new user account using cURL. It sends a POST request to the /users/create endpoint with JSON payload and authorization headers. ```cURL curl http://localhost:8081/users/create \ --request POST \ --header 'Authorization: Token' \ --header 'Content-Type: application/json' \ --data '{ "username": "string", "password": "string" }' ``` -------------------------------- ### GET /ssh/file_manager/shortcuts Source: https://docs.termix.site/operations/getFileManagerShortcuts Retrieves a list of file shortcuts for a given host. This endpoint requires the host ID as a query parameter and bearer token authorization. ```APIDOC ## GET /ssh/file_manager/shortcuts ### Description Get file shortcuts for a host. ### Method GET ### Endpoint /ssh/file_manager/shortcuts ### Parameters #### Query Parameters - **hostId** (integer) - Required - The ID of the SSH host ### Request Example ```json { "hostId": 123 } ``` ### Response #### Success Response (200) - **name** (string) - The name of the shortcut. - **path** (string) - The path associated with the shortcut. #### Response Example ```json [ { "name": "Documents", "path": "/home/user/documents" } ] ``` ``` -------------------------------- ### Get SSH Host Folders (PHP) Source: https://docs.termix.site/operations/getSSHFolders Illustrates how to get SSH host folders using PHP with cURL. This includes setting the Authorization header for bearer token authentication. ```php $ch = curl_init("http://localhost:8081/ssh/db/folders"); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ``` -------------------------------- ### Get Server Status by ID (Python) Source: https://docs.termix.site/operations/getServerStatusById Makes a GET request to retrieve server status by ID using Python's requests library. Includes an Authorization header. ```Python requests.get("http://localhost:8081/status/{id}", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Get All System Alerts (cURL) Source: https://docs.termix.site/operations/getAllAlerts This snippet demonstrates how to retrieve all system alerts from the Termix API using cURL. It requires the server address and an authorization token. ```cURL curl http://localhost:8081/alerts \ --header 'Authorization: Token' ``` -------------------------------- ### Get All SSH Hosts (Python) Source: https://docs.termix.site/operations/getSSHHosts Makes a GET request to retrieve all configured SSH hosts using Python's requests library. The request includes an Authorization header with a token. ```python requests.get("http://localhost:8081/ssh/db/host", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Get SSH Host Folders (cURL) Source: https://docs.termix.site/operations/getSSHFolders Demonstrates how to fetch all SSH host folders using cURL. It requires a bearer token for authorization. ```shell curl http://localhost:8081/ssh/db/folders \ --header 'Authorization: Token' ``` -------------------------------- ### POST /users/totp/setup Source: https://docs.termix.site/operations/setupTOTP Sets up Time-based One-Time Password (TOTP) authentication for the user. This endpoint generates a secret key and a QR code that the user can use to configure their authenticator app. ```APIDOC ## POST /users/totp/setup ### Description Sets up Time-based One-Time Password (TOTP) authentication for the user. This endpoint generates a secret key and a QR code that the user can use to configure their authenticator app. ### Method POST ### Endpoint /users/totp/setup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **secret** (string) - The secret key for TOTP authentication. - **qr_code** (string) - The QR code representing the TOTP configuration, typically a data URI. #### Response Example ```json { "secret": "string", "qr_code": "string" } ``` #### Error Response (401) Indicates that the request is unauthorized, likely due to missing or invalid authentication credentials. ``` -------------------------------- ### GET /status Source: https://docs.termix.site/operations/getAllServerStatuses Retrieves the status of all servers. This endpoint requires bearer token authorization. ```APIDOC ## GET /status ### Description Get all server statuses. ### Method GET ### Endpoint /status ### Parameters #### Query Parameters None #### Request Body None ### Request Example (No request body for GET requests) ### Response #### Success Response (200) Content-Type: application/json Schema: JSON ```json { "additionalProperties": {} } ``` #### Response Example ```json { "additionalProperties": {} } ``` ### Authorization bearerAuth (HTTP Bearer Token) ``` -------------------------------- ### GET /version Source: https://docs.termix.site/operations/getVersion Retrieves the current version information of the service and checks if a newer version is available. ```APIDOC ## GET /version ### Description Retrieves the current version information and checks for updates. ### Method GET ### Endpoint /version ### Parameters #### Query Parameters None #### Request Body None ### Request Example ``` curl http://localhost:8081/version \ --header 'Authorization: Token' ``` ### Response #### Success Response (200) - **status** (string) - The status of the version check. - **version** (string) - The current version of the software. - **latest_release** (object) - Information about the latest release: - **tag_name** (string) - The tag name of the latest release. - **name** (string) - The name of the latest release. - **published_at** (string) - The publication date of the latest release. - **html_url** (string) - The URL to the latest release on the hosting platform. - **cached** (boolean) - Indicates if the information was retrieved from cache. - **cache_age** (integer) - The age of the cached information in seconds. #### Response Example ```json { "status": "string", "version": "string", "latest_release": { "tag_name": "string", "name": "string", "published_at": "string", "html_url": "string" }, "cached": true, "cache_age": 0 } ``` ``` -------------------------------- ### Fetch Server Metrics (Python) Source: https://docs.termix.site/operations/getServerMetricsById Python script using the requests library to obtain server metrics by ID. Demonstrates how to include the Authorization header in the request. ```python requests.get("http://localhost:8081/metrics/{id}", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Verify Port Availability Source: https://docs.termix.site/tunnels Checks if a specific port is currently being used by any running process on the system. This helps in identifying conflicts if a desired port is already occupied. ```bash netstat -tlnp | grep :port ``` -------------------------------- ### Check SSH Connectivity Source: https://docs.termix.site/tunnels Verifies if you can establish an SSH connection to the specified endpoint host. This is a fundamental step to ensure basic network communication and authentication are working. ```bash ssh username@endpoint-host ``` -------------------------------- ### Create User Account (JavaScript) Source: https://docs.termix.site/operations/createUser Example of creating a new user account using JavaScript's fetch API. It makes a POST request to the /users/create endpoint with specified headers and a JSON body. ```JavaScript fetch('http://localhost:8081/users/create', { method: 'POST', headers: { Authorization: 'Token', 'Content-Type': 'application/json' }, body: JSON.stringify({ username: 'string', password: 'string' }) }) ``` -------------------------------- ### Get Alerts by User ID (cURL) Source: https://docs.termix.site/operations/getUserAlerts Example of how to retrieve alerts for a specific user using cURL. It specifies the GET request to the /alerts/user/{userId} endpoint and includes the necessary Authorization header. ```cURL curl 'http://localhost:8081/alerts/user/{userId}' \ --header 'Authorization: Token' ``` -------------------------------- ### Create User Account (Python) Source: https://docs.termix.site/operations/createUser Example of creating a new user account using Python's requests library. It sends a POST request to the /users/create endpoint with appropriate headers and a JSON body. ```Python requests.post("http://localhost:8081/users/create", headers={ "Authorization": "Token", "Content-Type": "application/json" }, json={ "username": "string", "password": "string" } ) ``` -------------------------------- ### Get Termix Version Information (JavaScript) Source: https://docs.termix.site/operations/getVersion Fetches version information and checks for updates from the Termix server using JavaScript's Fetch API. Requires an Authorization header. ```javascript fetch('http://localhost:8081/version', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Get All Server Statuses (cURL, JavaScript, PHP, Python) Source: https://docs.termix.site/operations/getAllServerStatuses Fetches the status of all servers from the Termix API. Requires bearer token authorization. The endpoint is accessible at http://localhost:8081/status. ```cURL curl http://localhost:8081/status \ --header 'Authorization: Token' ``` ```JavaScript fetch('http://localhost:8081/status', { headers: { Authorization: 'Token' } }) ``` ```PHP $ch = curl_init("http://localhost:8081/status"); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ``` ```Python requests.get("http://localhost:8081/status", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Create User Account (PHP) Source: https://docs.termix.site/operations/createUser Example of creating a new user account using PHP with cURL. It configures a POST request to the /users/create endpoint, setting headers and the JSON payload. ```PHP $ch = curl_init("http://localhost:8081/users/create"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'username' => 'string', 'password' => 'string' ])); curl_exec($ch); curl_close($ch); ``` -------------------------------- ### User Login API Endpoint Examples Source: https://docs.termix.site/operations/loginUser Provides code samples for authenticating users via the /users/login endpoint. It demonstrates how to send a POST request with authentication headers and a JSON payload containing username and password. Supported languages include cURL, JavaScript, PHP, and Python. ```cURL curl http://localhost:8081/users/login \ --request POST \ --header 'Authorization: Token' \ --header 'Content-Type: application/json' \ --data '{ "username": "string", "password": "string" }' ``` ```JavaScript fetch('http://localhost:8081/users/login', { method: 'POST', headers: { Authorization: 'Token', 'Content-Type': 'application/json' }, body: JSON.stringify({ username: 'string', password: 'string' }) }) ``` ```PHP $ch = curl_init("http://localhost:8081/users/login"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'username' => 'string', 'password' => 'string' ])); curl_exec($ch); curl_close($ch); ``` ```Python requests.post("http://localhost:8081/users/login", headers={ "Authorization": "Token", "Content-Type": "application/json" }, json={ "username": "string", "password": "string" } ) ``` -------------------------------- ### Bulk Import SSH Hosts (JavaScript) Source: https://docs.termix.site/operations/bulkImportSSHHosts Example of how to use the Fetch API in JavaScript to send a POST request to the /ssh/bulk-import endpoint. It demonstrates setting headers and sending a JSON payload for bulk SSH host import. ```JavaScript fetch('http://localhost:8081/ssh/bulk-import', { method: 'POST', headers: { Authorization: 'Token', 'Content-Type': 'application/json' }, body: JSON.stringify({ hosts: [{ name: 'string', ip: 'string', port: 0, username: 'string', folder: 'string', tags: ['string'], pin: true, authType: 'string', password: 'string', key: 'string', keyPassword: 'string', keyType: 'string', enableTerminal: true, enableTunnel: true, enableFileManager: true, defaultPath: 'string', tunnelConnections: [{ }] }] }) }) ``` -------------------------------- ### Get All System Alerts (JavaScript) Source: https://docs.termix.site/operations/getAllAlerts This snippet shows how to fetch all system alerts from the Termix API using JavaScript's fetch API. It includes setting the Authorization header. ```JavaScript fetch('http://localhost:8081/alerts', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Create SSH Host (JavaScript) Source: https://docs.termix.site/operations/createSSHHost Demonstrates creating a new SSH host using JavaScript's fetch API. It makes a POST request to the /ssh/db/host endpoint with appropriate headers for authorization and content type. ```JavaScript fetch('http://localhost:8081/ssh/db/host', { method: 'POST', headers: { Authorization: 'Token', 'Content-Type': 'multipart/form-data' }, body: undefined }) ``` -------------------------------- ### Get SSH Tunnel Status (JavaScript) Source: https://docs.termix.site/operations/getTunnelStatusByName JavaScript code using the Fetch API to get the status of an SSH tunnel. It makes a GET request to the specified endpoint and includes an Authorization header. ```javascript fetch('http://localhost:8081/ssh/tunnel/status/{tunnelName}', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Create New SSH Folder Request Samples (cURL, JavaScript, PHP, Python) Source: https://docs.termix.site/operations/createSSHFolder Demonstrates how to create a new SSH folder by sending a POST request to the /ssh/file_manager/ssh/createFolder endpoint. Includes request body schema and sample implementations in cURL, JavaScript, PHP, and Python. ```curl curl http://localhost:8081/ssh/file_manager/ssh/createFolder \ --request POST \ --header 'Authorization: Token' \ --header 'Content-Type: application/json' \ --data '{ "sessionId": "string", "path": "string", "folderName": "string" }' ``` ```javascript fetch('http://localhost:8081/ssh/file_manager/ssh/createFolder', { method: 'POST', headers: { Authorization: 'Token', 'Content-Type': 'application/json' }, body: JSON.stringify({ sessionId: 'string', path: 'string', folderName: 'string' }) }) ``` ```php $ch = curl_init("http://localhost:8081/ssh/file_manager/ssh/createFolder"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token', 'Content-Type: application/json']); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'sessionId' => 'string', 'path' => 'string', 'folderName' => 'string' ])); curl_exec($ch); curl_close($ch); ``` ```python requests.post( "http://localhost:8081/ssh/file_manager/ssh/createFolder", headers={ "Authorization": "Token", "Content-Type": "application/json" }, json={ "sessionId": "string", "path": "string", "folderName": "string" } ) ``` -------------------------------- ### Verify Password Reset Code using Python (requests) Source: https://docs.termix.site/operations/verifyPasswordResetCode This Python example demonstrates how to use the requests library to send a POST request to the /users/verify-reset-code endpoint, providing authorization and a JSON body. ```Python requests.post( "http://localhost:8081/users/verify-reset-code", headers={ "Authorization": "Token", "Content-Type": "application/json" }, json={ "username": "string", "resetCode": "string" } ) ``` -------------------------------- ### POST /ssh/file_manager/ssh/connect Source: https://docs.termix.site/operations/connectSSH Establishes a connection to an SSH server. Requires server details and authentication credentials. ```APIDOC ## POST /ssh/file_manager/ssh/connect ### Description Connect to SSH server. ### Method POST ### Endpoint /ssh/file_manager/ssh/connect ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **sessionId** (string) - Required - The session identifier. - **ip** (string) - Required - The IP address of the SSH server. - **port** (integer) - Required - The port number of the SSH server. - **username** (string) - Required - The username for SSH authentication. - **password** (string) - Optional - The password for SSH authentication. - **sshKey** (string) - Optional - The SSH private key for authentication. - **keyPassword** (string) - Optional - The password for the SSH private key. ### Request Example ```json { "sessionId": "string", "ip": "string", "port": 0, "username": "string", "password": "string", "sshKey": "string", "keyPassword": "string" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the connection status. #### Response Example ```json { "message": "string" } ``` ``` -------------------------------- ### Get SSH Tunnel Status (Python) Source: https://docs.termix.site/operations/getTunnelStatusByName Python code utilizing the requests library to retrieve the status of an SSH tunnel. It sends a GET request with the necessary Authorization header. ```python requests.get( "http://localhost:8081/ssh/tunnel/status/{tunnelName}", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Get Recent Files for SSH Host (JavaScript) Source: https://docs.termix.site/operations/getFileManagerRecent This JavaScript code uses the `fetch` API to get recent files for an SSH host. It includes the necessary authorization header. ```javascript fetch('http://localhost:8081/ssh/file_manager/recent', { headers: { Authorization: 'Token' } }) ``` -------------------------------- ### Bulk Import SSH Hosts (Python) Source: https://docs.termix.site/operations/bulkImportSSHHosts Example of how to use the `requests` library in Python to send a POST request to the /ssh/bulk-import endpoint. It demonstrates setting authorization headers and sending a JSON payload for bulk SSH host import. ```Python requests.post("http://localhost:8081/ssh/bulk-import", headers={ "Authorization": "Token", "Content-Type": "application/json" }, json={ "hosts": [ { "name": "string", "ip": "string", "port": 0, "username": "string", "folder": "string", "tags": [ "string" ], "pin": true, "authType": "string", "password": "string", "key": "string", "keyPassword": "string", "keyType": "string", "enableTerminal": true, "enableTunnel": true, "enableFileManager": true, "defaultPath": "string", "tunnelConnections": [ {} ] } ] } ) ``` -------------------------------- ### GET /ssh/tunnel/status Source: https://docs.termix.site/operations/getTunnelStatuses Retrieves the status of all SSH tunnels. Requires bearer token authorization. ```APIDOC ## GET /ssh/tunnel/status ### Description Get all tunnel statuses. ### Method GET ### Endpoint /ssh/tunnel/status ### Parameters #### Query Parameters None #### Request Body None ### Authorization Bearer Token ### Request Example ``` GET /ssh/tunnel/status Authorization: Bearer ``` ### Response #### Success Response (200) Content-Type: application/json ```json { "additionalProperties": {} } ``` #### Response Example ```json { "tunnel1": { "status": "active", "port": 8080 }, "tunnel2": { "status": "inactive" } } ``` ``` -------------------------------- ### Push Changes to Fork Source: https://docs.termix.site/contributing Once your changes are committed, push them to your forked repository on GitHub using this command. ```sh git push origin feature/my-my-feature-request ``` -------------------------------- ### Get All Tunnel Statuses (cURL, JavaScript, PHP, Python) Source: https://docs.termix.site/operations/getTunnelStatuses Demonstrates how to retrieve the status of all SSH tunnels using different programming languages and tools. It shows how to make a GET request to the /ssh/tunnel/status endpoint and include the necessary Authorization header. ```cURL curl http://localhost:8081/ssh/tunnel/status \ --header 'Authorization: Token' ``` ```JavaScript fetch('http://localhost:8081/ssh/tunnel/status', { headers: { Authorization: 'Token' } }) ``` ```PHP $ch = curl_init("http://localhost:8081/ssh/tunnel/status"); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ``` ```Python requests.get("http://localhost:8081/ssh/tunnel/status", headers={ "Authorization": "Token" } ) ``` -------------------------------- ### Get All System Alerts (PHP) Source: https://docs.termix.site/operations/getAllAlerts This snippet illustrates how to retrieve system alerts using PHP with cURL. It sets up a cURL request to the Termix API, including the necessary Authorization header. ```PHP $ch = curl_init("http://localhost:8081/alerts"); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token']); curl_exec($ch); curl_close($ch); ```