Connect to offline environments
By default, the Lattice SDK validates TLS certificates against your operating system’s trusted Certificate Authority (CA) store.
When your Lattice environment is offline or air-gapped, it’s deployed on a local network without access to a public CA infrastructure. The environment presents a certificate signed by a private Anduril CA that isn’t in your system’s trust store, so your SDK client can’t validate it and the connection fails.
This guide describes two ways to connect:
- Use an Anduril-issued certificate because it lets the SDK trust your environment while keeping full TLS verification enabled. This is the recommended approach.
- Skip TLS verification with self-signed certificates because it lets you connect when an Anduril representative can’t issue a certificate. Use this approach only in development environments, because it disables the protections that TLS provides.
Before you begin
- Complete the steps in Set up to configure your environment variables:
LATTICE_ENDPOINT,LATTICE_CLIENT_ID, andLATTICE_CLIENT_SECRET.
gRPC authentication
If you are using gRPC with client credentials, set up the token refresh module before running the examples on this page.
Use an Anduril-issued certificate
This is the recommended approach because it keeps full TLS verification enabled. You obtain a CA certificate from Anduril, add it to your trust store, and configure the SDK to trust it as a root CA. The SDK still validates the certificate chain, hostname, and expiry date.
Before you configure your client, complete the following setup:
-
Contact your Anduril representative to obtain the CA certificate for your Lattice environment. The certificate is delivered as a PEM-encoded file. Because delivery mechanisms vary, follow the instructions your Anduril representative provides to retrieve it.
-
Add the certificate to your operating system’s trust store so that clients on your machine trust it:
-
Set a
LATTICE_CA_CERT_PATHenvironment variable that points to the certificate file:
The following examples load the CA certificate from LATTICE_CA_CERT_PATH and configure the Lattice client to
trust it as a root CA. Full TLS verification stays enabled, so the SDK still validates the certificate chain,
hostname, and expiry date.
Initialize the client
Import your environment variables and initialize the client. LATTICE_CA_CERT_PATH is the file path to the
PEM certificate you received from your Anduril representative. You can achieve the same result using a local
.env file:
Load the CA certificate
Configure the HTTP or gRPC client to trust the Anduril-issued certificate. The client loads the certificate from the PEM file and adds it to the trust pool, so the client verifies the server’s certificate against the Anduril CA during every TLS handshake:
Use the client
Use the client to call the Lattice API. This example uses GetEntity
to fetch an entity by its entityId:
After you add the CA certificate to your trust store and load it in your client, your integration can connect to an offline environment with full TLS verification enabled.
Skip TLS verification with self-signed certificates
Skipping TLS verification disables certificate validation, which exposes your connection to interception and tampering. Use this approach only in development environments where an Anduril representative can’t issue an Anduril-issued certificate. In production, use an Anduril-issued certificate instead.
If you can’t obtain an Anduril-issued certificate for a development environment, you can configure the SDK to skip TLS verification. The SDK then connects without validating the server’s certificate.
Before you configure your client, complete the following setup:
-
Set a
SKIP_TLS_VERIFYenvironment variable so the client knows to skip certificate validation:
The following examples read SKIP_TLS_VERIFY and configure a custom Lattice client that skips TLS verification.
Initialize the client
Import your environment variables and initialize the client. SKIP_TLS_VERIFY controls whether the client
validates the server’s certificate. You can achieve the same result using a local .env file:
Create a custom client
Configure a custom client that skips TLS verification. In Go, this uses the InsecureSkipVerify option; the
other languages provide an equivalent:
Use the client
Use the client to call the Lattice API. This example uses GetEntity
to fetch an entity by its entityId:
What’s next
- Learn how to publish entities to Lattice.
- Explore tasking to learn how you can task an agent in Lattice.
- Learn more about the Lattice OAuth 2.0 endpoint.