Bug 274660

Summary: net/zerotier API/controller not working properly
Product: Ports & Packages Reporter: wired2network
Component: Individual Port(s)Assignee: Dave Cottlehuber <dch>
Status: Closed Not A Bug    
Severity: Affects Many People Flags: bugzilla: maintainer-feedback? (dch)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 277735    
Bug Blocks:    

Description wired2network 2023-10-22 22:09:59 UTC
Team,

I am trying to get zerotier on OPNsense's FreeBSD to operate as a controller. I attempted to use the API commands to elevate to a controller but get illegal variable using X-ZT1-Auth.

CONTROLLER_ID=$(zerotier-cli info | cut -d' ' -f 3)
curl -X POST \
 -H "X-ZT1-Auth: $(cat /var/lib/zerotier-one/authtoken.secret)" \
 -d '{"name":"love death and robots"}' \
 "http://localhost:9993/controller/network/${CONTROLLER_ID}______"

perhaps since I am using the wrong variable or API commands to perform this operation? I did attempt to force the files into the appropriate controller.d folder to create a controller, which built out the associated folder housing the members. When I attempted to add nodes to this controller, the controller received  the member files for authenticated, but everytime I change the status to authorized: true, the system tends to revert it back to false. I also attempted to adjust the zerotier-one file to state true for the controller, but this also resulted in not being able to authorize nodes. Can you please help point me in the right direction?

"controller": true,
"apiVersion": %d,
"clock": %llu
"databaseReady": %s
Comment 1 Dave Cottlehuber freebsd_committer freebsd_triage 2024-01-04 23:49:02 UTC
I'm guessing this is more of a user issue, best dealt with on ZT forums.

- the token lives in /var/db/zerotier-one/authtoken.secret on FreeBSD at least
- due to https://github.com/zerotier/ZeroTierOne/issues/2151 you may need to
  add this to /var/db/zerotier-one/local.conf

```json
{
  "settings": {
    "allowManagementFrom": ["::"],
   ...
```