Closed flantel closed 6 years ago
@flantel thanks for the positive feedback and the code contribution.
ztncui does not expose the entire controller API. Plus, you would need to authenticate to ztncui anyway, so surely it would be better to just expose port 9993 and access the ZT API directly with the authtoken?
Yes, I'll look at exposing 9993. Just have to figure out where to set it so it listens on more than just localhost.
Right, I'll close this issue then.
"ztncui does not expose the entire controller API. Plus, you would need to authenticate to ztncui anyway, so surely it would be better to just expose port 9993 and access the ZT API directly with the authtoken?"
Question. If I accessed the ZT API directly to authorize and label a peer and assign ip addresses, would that not add inconsistency in the ztncui GUI ? Is there a cli way to authenticate with ztncui and programmatically label/authorize a peer to join the network while still keeping the ztncui GUI consistent ?
ztncui just interfaces with the ZT API, so it should show you the state of changes that you made directly with the ZT API. You probably just need to refresh the browser page in ztncui.
Perfect. Thanks for the clarification
By using the ZT API directly, I was able to toggle authorize to true and assign an ip address but was unable to assign a member name "gadget"
TOKEN=sudo cat /var/lib/zerotier-one/authtoken.secret
curl -X POST -H "x-zt1-auth: $TOKEN" -H "accept: application/json" -H "content-type: application/json" -H "Host: localhost:9993" http://localhost:9993/controller/network/86ff16655e6455ed/member/41497f5d48 -d '{"authorized":"true","ipAssignments":["10.199.0.2"],"name":"gadget"}'
Is there a separate API to set the member name so it is reflected in ztncui ?
That's right - I forgot that the name is one thing that is external to ZT API - it is stored in /opt/key-networks/ztncui/etc/storage using https://www.npmjs.com/package/node-persist .
You could write some code to do a similar thing. The relevant code is in https://github.com/key-networks/ztncui/blob/master/src/controllers/networkController.js as well as https://github.com/key-networks/ztncui/blob/master/src/views/members.pug
Hi,
First off, thanks, ztcui looks very promising.
Is it possible to access the controller API via the ztcui? I want to be able to authorise members from an Ansible playbook. I presume I could expose port 9993 ( I am using the Docker version) and allow access to the necessary host but would rather not have to use the controller authtoken for this.