Here is the vision.. I want to setup the http example.. and then connect to it using the ZitiMobileEdge app on my mobile.
What I am doing is to create a hypothesis of all the configurations that I believe I need before I execute it.. I have enough understanding now to start to be a bit more specific than when I first started
This way.. I can uncover what I don't understand in more detail... and reduce the chances of making a stupid mistake.. it also helps me improve the accuracy of what I am doing. It was pretty scattered initially..
I have already tested the installation of the controller with the reflect example.
Step 1. create a env file
I have setup the controller to use port 1280 and 6262
service_name=httpz
client_identity="${service_name}"Client
server_identity="${service_name}"Server
the_port=1280
Step 2 make the env file executable
I learnt this the hard way
chmod u+x httpz.env
then run the env file to load the variables into the bash profile
Step 3 delete exiting bind & dial policies
lots of pain here if you dont do this
ziti edge delete service-policy allbind
ziti edge delete service-policy alldial
Step 4 create new service and bind & dial policies
this is the config for the host
ziti edge create config "${service_name}"-host.v1 host.v1 '{"protocol":"tcp", "address":"localhost","port":'"${the_port}"', "listenOptions": {"bindUsingEdgeIdentity":true}}'
this is the config for the client
its interesting that there is a port range for the client.. it would be useful to further expand on this
ziti edge create config "${service_name}"-client-config intercept.v1 '{"protocols":["tcp"],"addresses":["'"${service_name}.ziti"'"], "portRanges":[{"low":'"${the_port}"', "high":'"${the_port}"'}]}'
this creates the service for the client and host
ziti edge create service "${service_name}" --configs "${service_name}"-client-config,"${service_name}"-host.v1
this creates the bind and dial policies
ziti edge create service-policy "${service_name}"-binding Bind --service-roles '@'"${service_name}" --identity-roles '#'"${service_name}"'ServerEndpoints'
ziti edge create service-policy "${service_name}"-dialing Dial --service-roles '@'"${service_name}" --identity-roles '#'"${service_name}"'ClientEndpoints'
Step 5 create and enroll server identities
ziti edge create identity device "${server_identity}" -a "${service_name}"ServerEndpoints -o "${server_identity}".jwt
ziti edge enroll "${server_identity}".jwt
Step 6 create and enroll clent identities
I left this last as you have 5 min to enrol..
ziti edge create identity device "${client_identity}" -a "${service_name}"ClientEndpoints -o "${client_identity}".jwt
copy jwt file to local machine
scp -i zzzz.key opc@......:/home/opc/go-demo/simple-http.go /local_user/files
Once created.. download the jwt to my machine, email it to my phone and paste into the ZitiMobileEdge application