Hi @shikumar,
I understand better what you’re trying to do now, thanks. If you are only interested in the lwip bits you could start by removing code that’s in your path that deals with DNS and exclusively use IP addresses.
Ziti itself focuses on providing a truly zero trust paradigm and this particular project is trying to be a “tunneling app” in that paradigm so it’s doing a fair amount of other stuff you may not be interested in. In short it will:
- use an enrolled identity to validate the client is authorized to use the ziti network
- query the controller for all the services assigned to this identity
- provide the ‘intercept’ capabilities you’re looking for both for IP and DNS (in conjunction with dnsmasq)
Personally, I always find it easier to learn/debug unfamiliar code with a client that’s operational. That’s where I was heading with the controller. If you have the controller up and running you at least setup and use an identity and then use the existing ziti-edge-tunnel code to ‘step through’ and see what’s going on, when and how but I can see that you might not need or want that.
I honestly think starting a controller and enrolling an identity will be easier for you. So here’s a quick set of steps that will get you to a ‘working controller and enrolled identity’. you should then be able to use that identity and debug the app. These steps should take you no more than five or ten total minutes.
Make a directory under HOME and setup some variables:
mkdir -p ~/ziti-tunneler-sdk-c-demo
cd ~/ziti-tunneler-sdk-c-demo
demodir=$(pwd)
zitidir=${demodir}/ziti
clone the repo to get some setup scripts:
git clone git@github.com:openziti/ziti.git ${demodir}/ziti
cd ${demodir}/ziti
git checkout update-local-quickstart
download a set of binaries to get you going:
wget https://netfoundry.jfrog.io/netfoundry/ziti-release/ziti-all/0.17.5/ziti-all.0.17.5.tar.gz
tar xvf ziti-all.0.17.5.tar.gz
setup some fake hostnames to allow the scripts to succeed:
echo "127.0.0.1 local-ziti-controller local-ziti-edge-controller local-ziti-zac local-ziti-edge-router local-ziti-edge-wss-router local-ziti-fabric-router-br local-ziti-fabric-router-blue local-ziti-fabric-router-red" | sudo tee -a /etc/hosts
startup a local ziti-controller and ziti-routers
${zitidir}/quickstart/local/init.sh ${zitidir}/amd64/linux/ local-ziti
enroll a ziti identity so that you can have the existing code run without too much effort
ziti-tunnel enroll test_identity.jwt
setup an ip intercepted service that intercepts 11.11.11.11:2222 and sends to eth0.me [edited]
SVC_NAME=iphost
SVC_HOST=11.11.11.11
SVC_PORT=2222
TCP_HOST_PORT=tcp:eth0.me:80
ziti edge controller create config "${SVC_NAME}svcconfig" ziti-tunneler-client.v1 '{ "hostname" : "'"${SVC_HOST}"'", "port" : '"${SVC_PORT}"' }'
ziti edge controller create service "${SVC_NAME}svc" --configs "${SVC_NAME}svcconfig"
ziti edge controller create terminator "${SVC_NAME}svc" "${ZITI_EDGE_ROUTER_NAME}" $TCP_HOST_PORT
clone the ziti-tunnel-sdk-c repo and build it (i expect you can skip these steps)
git clone git@github.com:openziti/ziti-tunnel-sdk-c.git
tunnelsdkcdir=${zitidir}/ziti-tunnel-sdk-c
cmake -S ${tunnelsdkcdir} -B ${tunnelsdkcdir}/build
cmake --build ${tunnelsdkcdir}/build
run the built executable or run from the IDE debugger:
~/ziti-tunneler-sdk-c-demo/ziti/ziti-tunnel-sdk-c/build/programs/ziti-edge-tunnel/ziti-edge-tunnel run ./test_identity.json
At this point you should be able to curl 11.11.11.11:2222 and see intercepted traffic…
when you’re done, cleanup this folder if you want - it contains the environment you just setup…
- rm -rf ~/.ziti/quickstart/local-ziti/
I know it seems like a lot of steps but they all should be copy/paste for you so shouldn’t take too long. Let me know if you get this far or if i’ve scared you off! 