### Install and Verify Docker Source: https://www.twingate.com/docs/connectors-on-linux Use the official convenience script to install Docker on any Linux platform and verify the installation. ```bash curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # Verify Docker is installed and running sudo docker run hello-world ``` -------------------------------- ### Verify Twingate CLI Installation Source: https://www.twingate.com/docs/introduction-to-the-python-cli Run this command to verify the CLI is correctly installed and configured. If it returns an empty list, the setup is successful. ```bash python3 ./tgcli.py auth list ``` ```text [''] ``` -------------------------------- ### Twingate Connector Setup Script Source: https://www.twingate.com/docs/terraform-gcp Bash script to install the Twingate connector using provided access and refresh tokens. ```bash #!/bin/bash curl "https://binaries.twingate.com/connector/setup.sh" | sudo TWINGATE_ACCESS_TOKEN="${accessToken}" TWINGATE_REFRESH_TOKEN="${refreshToken}" TWINGATE_URL="https://${tgnetwork}.twingate.com" bash ``` -------------------------------- ### Install Twingate via APT Source: https://www.twingate.com/docs/linux Use this to install the Twingate client on Debian-based distributions. Ensure curl, gpg, and ca-certificates are installed before running. ```bash # ensure that curl, gpg, and ca-certificates are installed curl -fsSL https://packages.twingate.com/apt/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/twingate-client-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/twingate-client-keyring.gpg] https://packages.twingate.com/apt/ * *" | sudo tee /etc/apt/sources.list.d/twingate.list apt update -yq apt install -yq twingate # or twingate-latest # After installation, configure the client by running: sudo twingate setup ``` -------------------------------- ### Install Node Modules Source: https://www.twingate.com/docs/pulumi-azure Install the required Pulumi providers for Azure and Twingate. ```bash npm install @pulumi/azure-native npm install @pulumi/azure npm install @twingate/pulumi-twingate ``` -------------------------------- ### Install Terraform on Ubuntu/Debian Source: https://www.twingate.com/docs/diy-vpn-setup-guide Install Terraform via HashiCorp repository. ```bash wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt update && sudo apt install terraform ``` -------------------------------- ### Install Minikube Prerequisites on Ubuntu/Debian Source: https://www.twingate.com/docs/diy-vpn-setup-guide Install Minikube, kubectl, and Helm on Ubuntu/Debian systems. ```bash # Install Minikube curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube # Install kubectl curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl # Install Helm curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash ``` -------------------------------- ### AccessPolicy and AccessPolicyInput Examples Source: https://www.twingate.com/docs/api Examples for AccessPolicy and its corresponding input object. ```json {"mode": "MANUAL", "durationSeconds": 12345} ``` ```json {"mode": "MANUAL", "durationSeconds": 12345} ``` -------------------------------- ### ProtocolInput Example Source: https://www.twingate.com/docs/api Example of ProtocolInput, specifying policy and ports. ```json {"policy": "ALLOW_ALL", "ports": [PortRangeInput]} ``` -------------------------------- ### Install Twingate Client Source: https://www.twingate.com/docs/k8s-cluster-access Executes the Twingate installation script on a Linux system. ```bash curl https://binaries.twingate.com/client/linux/install.sh | sudo bash ``` -------------------------------- ### Install doctl CLI Source: https://www.twingate.com/docs/diy-vpn-setup-guide Commands to download and install the DigitalOcean CLI on Linux. ```bash cd ~ wget https://github.com/digitalocean/doctl/releases/download/v1.104.0/doctl-1.104.0-linux-amd64.tar.gz tar xf doctl-1.104.0-linux-amd64.tar.gz sudo mv doctl /usr/local/bin ``` -------------------------------- ### Install Curl Source: https://www.twingate.com/docs/headless-iot-gateway Install the curl utility if it is not already present on the system. ```bash sudo apt install curl -y ``` -------------------------------- ### Install Smallstep CLI Source: https://www.twingate.com/docs/ssh-smallstep Commands to install the step CLI on various operating systems. ```bash brew install step ``` ```bash sudo wget https://dl.smallstep.com/cli/docs-cli-install/latest/step-cli_amd64.deb && sudo dpkg -i step-cli_amd64.deb ``` ```bash winget install Smallstep.step ``` -------------------------------- ### Execute Setup Script Source: https://www.twingate.com/docs/headless-iot-gateway Run the configuration script with the service key file and local network CIDR as arguments. ```bash sudo ./gateway_config.sh ./service_key.json 10.0.0.0/24 ``` -------------------------------- ### Gateway Startup Script Source: https://www.twingate.com/docs/idfw-ssh-terraform Initial setup script for the gateway node. ```bash #!/bin/bash set -e GATEWAY_DIR="/opt/gateway" ``` -------------------------------- ### Get List of Devices (from endCursor) Source: https://www.twingate.com/docs-assets/c7ebb3a/docs/1cd99880abffdbd0405a1c8a602a74b5/Twingate-API-Examples_August2024.postman_collection.json Retrieves a list of devices starting from a specific cursor, useful for fetching subsequent pages of results. ```APIDOC ## POST /api/graphql/ ### Description Retrieves a list of devices starting from a specific cursor, useful for fetching subsequent pages of results. ### Method POST ### Endpoint https://{{tenant_name}}.twingate.com/api/graphql/ ### Request Body #### GraphQL Query ```graphql query PM_GetListOfDevices { devices(after: "YXJyYXljb25uZWN0aW9uOjQ5") { edges { node { id name isTrusted osName osVersion hardwareModel hostname serialNumber deviceType hostname username manufacturerName } } pageInfo { endCursor hasNextPage } } } ``` ### Request Example ```json { "query": "query PM_GetListOfDevices { devices(after: \"YXJyYXljb25uZWN0aW9uOjQ5\") { edges { node { id name isTrusted osName osVersion hardwareModel hostname serialNumber deviceType hostname username manufacturerName } } pageInfo { endCursor hasNextPage } } }" } ``` ### Response #### Success Response (200) - **devices** (object) - Contains a list of devices and pagination information. - **edges** (array) - List of device nodes. - **node** (object) - Represents a single device with its properties. - **id** (string) - Unique identifier for the device. - **name** (string) - Name of the device. - **isTrusted** (boolean) - Indicates if the device is trusted. - **osName** (string) - Name of the operating system. - **osVersion** (string) - Version of the operating system. - **hardwareModel** (string) - Hardware model of the device. - **hostname** (string) - Hostname of the device. - **serialNumber** (string) - Serial number of the device. - **deviceType** (string) - Type of the device. - **username** (string) - Username associated with the device. - **manufacturerName** (string) - Manufacturer of the device. - **pageInfo** (object) - Pagination details. - **endCursor** (string) - Cursor for the last item in the current page. - **hasNextPage** (boolean) - Indicates if there are more pages. ``` ``` -------------------------------- ### Clone and Setup Minikube Repository Source: https://www.twingate.com/docs/diy-vpn-setup-guide Clone the DIY VPN repository and navigate to the Minikube directory. ```bash git clone https://github.com/Twingate-Community/diy-vpn.git cd diy-vpn/minikube ``` -------------------------------- ### Setup Twingate in Headless Mode Source: https://www.twingate.com/docs/k8s-cluster-access Initializes the Twingate client using a service key file. ```bash sudo twingate setup --headless /tmp/service_key.json ``` -------------------------------- ### Pull and Run Llama3 LLM with Ollama Source: https://www.twingate.com/docs/remote-llm-access After installing Ollama, use this command to download and start the Llama3 model. Ollama will listen on port 11434 by default. ```bash ollama run llama3 ``` -------------------------------- ### Configure Twingate in GitHub Actions Source: https://www.twingate.com/docs/example-cicd-configurations Demonstrates installing, starting, and using the Twingate headless client within a GitHub Actions workflow. Requires a TWINGATE_SERVICE_KEY secret to be configured in the repository. ```yaml name: Twingate on GitHub Actions Demo on: [push] jobs: Twingate-GitHub-Actions: runs-on: ubuntu-latest steps: - name: Install Twingate run: | echo "deb [trusted=yes] https://packages.twingate.com/apt/ /" | sudo tee /etc/apt/sources.list.d/twingate.list sudo apt update -yq sudo apt install -yq twingate - name: Setup and start Twingate env: TWINGATE_SERVICE_KEY: ${{ secrets.SERVICE_KEY }} run: | echo $TWINGATE_SERVICE_KEY | sudo twingate setup --headless=- sudo twingate start - name: (optional) Twingate status run: twingate status - name: (optional) Twingate logs run: journalctl -u twingate - name: Access a secure resource env: TEST_URL: http://business.prod.beamreachinc.int/ run: | echo Calling $TEST_URL 🚀 curl -v $TEST_URL - name: Access a public resource env: TEST_URL: https://www.twingate.com/ run: | echo Calling $TEST_URL 🚀 curl -v $TEST_URL - run: echo "SUCCESS!!! 🤩 This job's status is ${{ job.status }}." - name: Stop Twingate run: sudo twingate stop ``` -------------------------------- ### Initialize Project Directory Source: https://www.twingate.com/docs/openclaw-docker-compose Create the necessary directory structure for storing configuration and workspace data. ```bash # Create project directory mkdir -p ~/openclaw-docker cd ~/openclaw-docker # Create subdirectories for volumes mkdir -p config workspace ``` -------------------------------- ### PostgreSQL Connection Example Source: https://www.twingate.com/docs/database-access-gcp A practical example of connecting to a PostgreSQL instance and executing a query. ```bash # Example with PostgreSQL psql -h 10.82.0.3 -U postgres -d postgres Password for user postgres: psql (17.6, server 17.5) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: postgresql) Type "help" for help. postgres=> SELECT * FROM sample_table; id | name | age | city ----+---------+-----+------------- 1 | Alice | 30 | New York 2 | Bob | 25 | Los Angeles 3 | Charlie | 35 | Chicago 4 | David | 28 | Houston 5 | Eve | 32 | Phoenix (5 rows) postgres=> ``` -------------------------------- ### Get Help for Resource List Operation in Twingate CLI Source: https://www.twingate.com/docs/introduction-to-the-python-cli To understand the parameters for a specific operation, append the operation name and -h. This example shows the help for the 'list' operation on 'resource' objects. ```bash myhost % python3 ./tgcli.py resource list -h usage: tgcli.py resource list [-h] optional arguments: -h, --help show this help message and exit ``` -------------------------------- ### Twingate Connector Startup Script Source: https://www.twingate.com/docs/idfw-ssh-terraform This script automates the setup of a Twingate Connector by downloading and executing the official setup script with provided authentication tokens and Twingate URL. ```bash #!/bin/bash set -e curl "https://binaries.twingate.com/connector/setup.sh" | \ sudo TWINGATE_ACCESS_TOKEN="${access_token}" \ TWINGATE_REFRESH_TOKEN="${refresh_token}" \ TWINGATE_URL="${twingate_url}" \ bash ``` -------------------------------- ### Get Help for Resource Operations in Twingate CLI Source: https://www.twingate.com/docs/introduction-to-the-python-cli After identifying object types, use the object name followed by -h to see available operations for that object. This example shows operations for the 'resource' object. ```bash myhost % python3 ./tgcli.py resource -h usage: tgcli.py resource [-h] {list,show,create,delete} ... positional arguments: {list,show,create,delete} optional arguments: -h, --help show this help message and exit ``` -------------------------------- ### Pulumi Project Configuration Prompts Source: https://www.twingate.com/docs/pulumi-gcp Example values for the interactive Pulumi project initialization prompts. ```text project name: demo project description: (A minimal TypeScript Pulumi program) stack name: (dev) ``` -------------------------------- ### Twingate Connector Setup Script Source: https://www.twingate.com/docs/terraform-gcp A bash script to install the Twingate connector using provided access and refresh tokens and the Twingate network URL. This script is intended to be used within a Terraform template file. ```bash #!/bin/bash curl "https://binaries.twingate.com/connector/setup.sh" | sudo TWINGATE_ACCESS_TOKEN="${accessToken}" TWINGATE_REFRESH_TOKEN="${refreshToken}" TWINGATE_URL="https://${tgnetwork}.twingate.com" bash ``` -------------------------------- ### Example /etc/hosts Configuration Source: https://www.twingate.com/docs/introduction-to-dns A sample hosts file demonstrating local IP-to-hostname mappings, including multiple aliases for a single IP address. ```text 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 192.168.2.2 sql01 192.168.2.3 sql02 192.168.1.10 puppetmaster puppet pm01 ``` -------------------------------- ### Create Configuration File Source: https://www.twingate.com/docs/k8s-cluster-access Opens the nano editor to create the service key configuration file for the headless client. ```bash nano /tmp/service_key.json ``` -------------------------------- ### Install Twingate using Chocolatey Source: https://www.twingate.com/docs/windows-managed-devices Use this command to install Twingate if you have Chocolatey installed. Chocolatey packages may have delayed updates. ```bash choco install twingate ``` -------------------------------- ### Install and Configure Headless Linux Client Source: https://www.twingate.com/docs/linux-headless Use these commands to install the Twingate client and initialize it in headless mode using a service key. ```bash curl https://binaries.twingate.com/client/linux/install.sh | sudo bash sudo twingate setup --headless /path/to/service_key.json ``` -------------------------------- ### PrincipleTypeFilterOperatorInput Example Source: https://www.twingate.com/docs/api Example of filtering by PrincipalType. ```json {"in": ["GROUP"]} ``` -------------------------------- ### Run OpenClaw Onboarding Wizard Source: https://www.twingate.com/docs/openclaw-docker-compose Initializes the OpenClaw configuration by running the interactive onboarding CLI command. ```bash # Run interactive onboarding wizard docker compose run --rm openclaw-cli onboard ``` -------------------------------- ### RemoteNetwork Example Source: https://www.twingate.com/docs/api Example of a RemoteNetwork object with its fields. ```json { "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-15T00:00:00.000Z", "name": "Example Name", "id": "YWJjMTIzeHl6Nzg5", "networkType": "REGULAR", "location": "AWS", "isActive": true, "resources": ResourceConnection, "connectors": ConnectorConnection, "gateways": GatewayConnection } ``` -------------------------------- ### PrivacyCategoryConfig Example Source: https://www.twingate.com/docs/api Example configuration for privacy categories. ```json { "blockAffiliate": true, "blockDisguisedTrackers": true, "blockAdsAndTrackers": true } ``` -------------------------------- ### Terraform Initialization Output Source: https://www.twingate.com/docs/terraform-aws Example output showing successful initialization of provider plugins. ```text Initializing the backend... Initializing provider plugins... - Finding hashicorp/aws versions matching "~> 4.0"... - Finding latest version of twingate/twingate... - Installing hashicorp/aws v4.29.0... - Installed hashicorp/aws v4.29.0 (signed by HashiCorp) - Installing twingate/twingate v0.2.0... - Installed twingate/twingate v0.2.0 (self-signed, key ID E8EBBE80BA0C9369) Partner and community providers are signed by their developers. If you'd like to know more about provider signing, you can read about it here: https://www.terraform.io/docs/cli/plugins/signing.html Terraform has created a lock file .terraform.lock.hcl to record the provider selections it made above. Include this file in your version control repository so that Terraform can guarantee to make the same selections by default when you run "terraform init" in the future. Terraform has been successfully initialized! ``` -------------------------------- ### BaseVerification Example Source: https://www.twingate.com/docs/api Example structure for a base verification. ```json {"isVerified": true} ``` -------------------------------- ### Start Minikube Cluster Source: https://www.twingate.com/docs/diy-vpn-setup-guide Initialize a Minikube cluster with specific resource allocations. ```bash minikube start --cpus=2 --memory=4096 --driver=docker ``` -------------------------------- ### AccessRequestStatusFilterOperatorInput Example Source: https://www.twingate.com/docs/api Example input for filtering by AccessRequestStatus. ```json {"in": ["PENDING"]} ``` -------------------------------- ### AccessRequestFilterInput Example Source: https://www.twingate.com/docs/api Example input for filtering AccessRequests. ```json { "userId": UserIdFilterOperationInput, "resourceId": ResourceIdFilterOperationInput, "status": AccessRequestStatusFilterOperatorInput } ``` -------------------------------- ### Define Web Server Startup Script Source: https://www.twingate.com/docs/pulumi-gcp Defines a bash script to install Nginx and create a custom index page for the test virtual machine. ```typescript const webserverScript = ` #!/bin/bash apt-get -y update apt-get -y install nginx echo "

Pulumi 💙 TWINGATE

" > /var/www/html/index.html service nginx start sudo rm -f index.nginx-debian.html`; ``` -------------------------------- ### Install Terraform on macOS Source: https://www.twingate.com/docs/diy-vpn-setup-guide Install Terraform using Homebrew. ```bash brew install terraform ``` -------------------------------- ### RemoteNetworkType Enum Example Source: https://www.twingate.com/docs/api Example of a RemoteNetworkType enum value. ```json "REGULAR" ``` -------------------------------- ### Deployment Management Commands Source: https://www.twingate.com/docs/openclaw-docker-compose Standard commands for starting, stopping, and restarting services. ```bash # Start all services docker compose up -d # Stop all services docker compose down # Stop but keep volumes docker compose stop # Restart a specific service docker compose restart openclaw-gateway ``` -------------------------------- ### RemoteNetworkLocation Enum Example Source: https://www.twingate.com/docs/api Example of a RemoteNetworkLocation enum value. ```json "AWS" ``` -------------------------------- ### ProtocolPolicy Enum Example Source: https://www.twingate.com/docs/api Example of a ProtocolPolicy enum value. ```json "ALLOW_ALL" ``` -------------------------------- ### Create Web Server Virtual Machine Source: https://www.twingate.com/docs/pulumi-azure Provisions an Ubuntu 16.04 VM using the previously defined network interface and startup script. ```typescript const vm = new azure_native.compute.VirtualMachine("server-vm", { resourceGroupName, networkProfile: { networkInterfaces: [{ id: networkInterface_vm.id }], }, hardwareProfile: { vmSize: azure_native.compute.VirtualMachineSizeTypes.Standard_B1ms, }, osProfile: { computerName: "VM", customData: initScript.apply((x) => Buffer.from(x).toString("base64")), adminUsername: username, adminPassword: password, linuxConfiguration: { disablePasswordAuthentication: false, }, }, storageProfile: { osDisk: { createOption: azure_native.compute.DiskCreateOption.FromImage, name: "server-vm-myosdisk", deleteOption: "Delete", }, imageReference: { publisher: "canonical", offer: "UbuntuServer", sku: "16.04-LTS", version: "latest", }, }, }); ``` -------------------------------- ### Initialize Terraform Source: https://www.twingate.com/docs/idfw-ssh-terraform Command to download the configured providers. ```bash terraform init ``` -------------------------------- ### PrincipalType Enum Example Source: https://www.twingate.com/docs/api Example of a PrincipalType enum value. ```json "GROUP" ``` -------------------------------- ### Configure Twingate Account and API Key Source: https://www.twingate.com/docs/introduction-to-tg-cli-javascript This example demonstrates the interactive process of exporting data, where the CLI prompts for Twingate account and API key. It also shows the option to save these credentials for future use. ```bash # ./tg export ? Enter Twingate account: › exampleAccount ? Enter API key: › ************************************************************************************************************************************** ? Save account and API key to file? › Yes [INFO] Configuration file saved. [SUCCESS] Export to 'exampleAccount-2022-06-08_16-57-01.xlsx' completed. ``` -------------------------------- ### PostureStatus Enum Example Source: https://www.twingate.com/docs/api Example of a PostureStatus enum value. ```json "YES" ``` -------------------------------- ### Configure Connector Settings Source: https://www.twingate.com/docs/connectors-on-linux Example of the required environment variables in the /etc/twingate/connector.conf file. ```text TWINGATE_NETWORK=https://autoco.twingate.com TWINGATE_ACCESS_TOKEN=a948904f2f0f479b8f8197694b... TWINGATE_REFRESH_TOKEN=b64064fece69a4edc7ff87f86f... ``` -------------------------------- ### Configure Twingate Client Source: https://www.twingate.com/docs/linux Initializes the Twingate Client configuration. ```bash sudo twingate setup ``` -------------------------------- ### DeviceOsName Enum Example Source: https://www.twingate.com/docs/api Example value for the DeviceOsName enum. ```json "IPADOS" ``` -------------------------------- ### DeviceActiveState Enum Example Source: https://www.twingate.com/docs/api Example value for the DeviceActiveState enum. ```json "ACTIVE" ``` -------------------------------- ### Install Twingate Connector Helm Chart Source: https://www.twingate.com/docs/k8s-helm-chart Use this command to add the Twingate Helm repository and install the connector. Replace `[namespace]`, `[network]`, `[accessToken]`, and `[refreshToken]` with your specific values. ```bash helm repo add twingate https://twingate.github.io/helm-charts helm upgrade --install twingate-connector twingate/connector -n [namespace] \ --set connector.network=[network] \ --set connector.accessToken=[accessToken] \ --set connector.refreshToken=[refreshToken] ``` -------------------------------- ### Input Field Example Source: https://www.twingate.com/docs/api Example of an input field structure. ```APIDOC ## Input Field Example ### Description Example of an input field. ### Fields - **eq** (Boolean) - Equality filter. ### Example ```json { "eq": true } ``` ``` -------------------------------- ### BasePostureCheck Example Source: https://www.twingate.com/docs/api Example structure for a base posture check. ```json {"isSatisfied": "YES"} ``` -------------------------------- ### View Connector Help Source: https://www.twingate.com/docs/introduction-to-tg-cli-javascript Displays the help menu for the connector command, detailing options for listing and creating connectors. ```bash # ./tg connector --help ``` -------------------------------- ### AddressType Enum Example Source: https://www.twingate.com/docs/api Example value for the AddressType enumeration. ```json "IP" ```