# Integrating OpenZiti with a Golang TLS server

**URL:** <https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414>\
**Category:** Building/Development\
**Created:** [April 18, 2022, 5:25am UTC](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414 "2022-04-18T05:25:14Z")\
**Posts on this page:** 6\
**Page:** 3

<div class="post-metadata">

**Author:** ![afzal442](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/afzal442/32/235_2.png) [@afzal442](https://openziti.discourse.group/u/afzal442)\
**Post date:** [April 26, 2022, 6:24am UTC](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414/41 "2022-04-26T06:24:06Z")

</div>

Sorry @markamind, I again fell into other issue here, causing like `panic: config file (“$HOME/golang.http.server.json”) is not found`  
Is `golang.http.server.json` already specified ? Thanks

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [April 26, 2022, 6:48am UTC](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414/42 "2022-04-26T06:48:01Z")

</div>

all ok.. it took me ages to work through things. I still have a few gaps.. 🙂

In this specific example.. which I will write up about soon.."golang.http.server" is an identity that I enrolled on a server.

When you create an identity.. Open Ziti generates a jtw token that you use for enrolling the identity.

In this case.. as the identity is used to represent the http service... I moved it onto the server.. and used the ziti edge enroll to enroll the identity..

> this creates the json file in the same directory that you run it from

When you inspect the contents of the json file.. you will noticed that it has the chain of certificates required for mutual TLS... ie.. after the server has confirmed that it is how it is from the certificate issued by the certificate authority.. the client then confirms it is the real client .. using this chain of certificates in the json file

> As I am more of an app developer than security admin technician.. I have found this quite a bit to chew on for a while... but as you work through it all... it does all start to work together nicely..

I think in this specific example, I would encourage you to start really small.

Here is a download of my journey before I tackled a reverse proxy... which I am still working through because those certificates need to be setup correctly.. (which has taken me days to work through)

> [@Summary of my learnings.. starting at ground zero](https://openziti.discourse.group/t/summary-of-my-learnings-starting-at-ground-zero/401):
>
> Purpose I thought to document a few things to help people get started.. especially if they like myself.. have a lot to learn to get started. Scope I have not gone deep into the commands re how to create the identities, policies and configurations etc.. as you can find them quite readily in the discourse posts and YouTube videos. What I wanted to do was to share a few things that took me quite some time to work through... and hope that by sharing them.. you won't get as stuck for as long as I …

---

<div class="post-metadata">

**Author:** ![afzal442](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/afzal442/32/235_2.png) [@afzal442](https://openziti.discourse.group/u/afzal442)\
**Post date:** [April 26, 2022, 7:12am UTC](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414/43 "2022-04-26T07:12:04Z")

</div>

That's great though. I wondered how you did generate that `json` file. Did you try with `ziti edge` cmd?  
Also in your summary you mentioned like

> [@Summary of my learnings.. starting at ground zero](https://openziti.discourse.group/t/summary-of-my-learnings-starting-at-ground-zero/401/1):
>
> go run main.go server -i reflectServer.json -s reflect

So, where I can find that file.

In the readme file, I grabbed this below [GitHub - openziti/sdk-golang: Ziti SDK for Golang](https://github.com/openziti/sdk-golang#readme)

```auto
Prerequisite: Ziti Enrollment token in JWT format (e.g. device.jwt)

Run enrollment process to generate SDK configuration file -- device.json

```

I again confused here, do I need to setup those before I take step ahead to run the application? If so, how I can generate those. Any links plz?

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [April 26, 2022, 7:23am UTC](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414/44 "2022-04-26T07:23:29Z")

</div>

the json file is created when you run the ziti edge enrol command

> when you do this, you need to pass in the jwt file  
> the jwt file is created when you create an identity

To create an identity.. you have two options

1. via ziti command
2. via ziti admin controller

Either are ok:)

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [April 26, 2022, 7:24am UTC](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414/45 "2022-04-26T07:24:08Z")

</div>

I you are getting stuck… find some time to watch the videos on youtube… they are very helpful

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [April 26, 2022, 1:00pm UTC](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414/46 "2022-04-26T13:00:40Z")

</div>

Hi @afzal442. Welcome to the community!

@markamind has done a great job of giving you a ton of good info. Thanks @markamind !

An overlay network embracing zero trust principles, like OpenZiti, will be predicated on having a **strong identity**. You get that strong identity through a [process called “enrollment”.](https://openziti.github.io/ziti/identities/enrolling.html#enrolling-an-identity) The output of that process is often (not **always** ) a json file that represents your strong identity. That’s the piece you’re missing.

You’ll also probably want to have TWO identities. One for your ‘client’, one for your ‘server’.

I’d suggest looking at the code in [sdk-golang/exercises/http at main · openziti/sdk-golang · GitHub](https://github.com/openziti/sdk-golang/tree/main/exercises/http) as @markamind references. It shows you examples of ‘before’ ziti and ‘after’ ziti. It doesn’t tell you how to get that json file though. For that you want to make an identity (or two) and enroll it. The enrollment doc should hopefully help you there.

Keep going - you’ll get it in now time!

[Previous page](https://openziti.discourse.group/t/integrating-openziti-with-a-golang-tls-server/414.md?page=2)
