A Taste of OpenZiti
In this demo you will use an OpenZiti SDK to access a private instance of the swagger petstore API. This demo will cover:
- Initializing Context
2. Calling a Service
3. Reading a Response
Getting Started
Just choose your favorite programing language below, and paste the code into the terminal of your choice
Look at the Code
1. Loading an identity:
The Ziti SDK needs to be initialized with a strong identity. This is done via the Ziti.init method:
Ziti.init(identityFile, "".toCharArray(), false);
2. Calling a service:
Calling a service means asking the OpenZiti overlay network for a connection. The Java SDK can look at the domain name of network requests and automatically dial the service for you.
OpenZiti defines a service at the dns name “petstore.ziti”.
final Request httpRequest = new Builder()
.url(String.format("http://%s:%d%s", "petstore.ziti", 80, petstoreQuery))
.header("Accept", "/")
.get()
.build();
3. Reading the result:
This looks exactly the same as reading the result from any HTTP request in Java.
final Response response = client.newCall(httpRequest).execute());
String result = response.body().string();
Look at the Code
1. Loading an identity:
The Ziti SDK needs to be initialized with a strong identity. This is done via the ziti.NewContextFromFile method:
ctx, err := ziti.NewContextFromFile(identityFile)
2. Calling a service:
In GoLang, we replace the “DialContext” of the httpTransport with one that “Dials” the target address using OpenZiti. The address is just the name of the OpenZiti service:
service, _, err := net.SplitHostPort(addr)
ctx.Dial(service)
3. Reading the result:
This looks exactly the same as reading the result from any HTTP request in GoLang:
httpClient := buildZitiClient(ctxCollection)
response, err := httpClient.Get("http://PetstoreDemo" + opts["query"])
responseData, err := io.ReadAll(response.Body)
Look at the Code
1. Loading an identity:
The Ziti SDK needs to be initialized with a strong identity. This is done via the openziti.load method:
openziti.load(DEFAULT_IDENTITY_FILE)
2. Calling a service:
Calling a service means asking the OpenZiti overlay network for a connection. With the OpenZiti Python SDK, the easiest way to to do that is using Monkey Patching. Read more about it in the OpenZiti github documentation here.
with openziti.monkeypatch():
print('Querying petstore over openziti with query: ' + query_str)
3. Reading the result:
This looks exactly the same as reading the result from any other requests call:
r = requests.get("http://petstore.ziti" + query_str)
print(r.text)
TAKE A CLOSER LOOK
How does this demo work?





What You Get by Adopting an OpenZiti SDK
Strong Identity
You need to be confident all entities on your network are who they claim to be, and tightly control access to your network
Completely Dark
No open ports! Your application should be “dark”, meaning no inbound ports to your applications and services are available for direct attack
Segmented Access
Access to services on your network needs to follow a “least privileged access” model, allowing access only to exactly what is needed to help mitigate against lateral attacks
Continuous
Auth
Things change constantly. An auth event that is valid at one point in time may not still be valid in the face of changing event
End-to-End Encryption
Only your application and endpoints should be able to access private data.
What’s Next?