I am having issues getting the tunneler application to start on my debial12 systems. Here are the errors I get. I am not finding anything helpful in the logs. My ZAC is working.
root@macbian:~# sudo systemctl start ziti-edge-tunnel.service
Job for ziti-edge-tunnel.service failed because the control process exited with error code.
See "systemctl status ziti-edge-tunnel.service" and "journalctl -xeu ziti-edge-tunnel.service" for details.
root@macbian:~# systemctl status ziti-edge-tunnel.service
β ziti-edge-tunnel.service - Ziti Edge Tunnel
Loaded: loaded (/etc/systemd/system/ziti-edge-tunnel.service; enabled; preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2023-07-25 01:26:05 AKDT; 2s >
Process: 38292 ExecStartPre=/opt/openziti/bin/ziti-edge-tunnel.sh (code=exited, status=1/FAILU>
CPU: 8ms
and here is the logs
root@macbian:~# journalctl -xeu ziti-edge-tunnel.service
ββ Subject: Unit process exited
ββ Defined-By: systemd
ββ Support: https://www.debian.org/support
ββ
ββ An ExecStartPre= process belonging to unit ziti-edge-tunnel.service has exited.
ββ
ββ The process' exit code is 'exited' and its exit status is 1.
Jul 25 01:27:42 macbian systemd[1]: ziti-edge-tunnel.service: Failed with result 'exit-code'.
ββ Subject: Unit failed
ββ Defined-By: systemd
ββ Support: https://www.debian.org/support
ββ
ββ The unit ziti-edge-tunnel.service has entered the 'failed' state with result 'exit-code'.
Jul 25 01:27:42 macbian systemd[1]: Failed to start ziti-edge-tunnel.service - Ziti Edge Tunnel.
ββ Subject: A start job for unit ziti-edge-tunnel.service has failed
ββ Defined-By: systemd
ββ Support: https://www.debian.org/support
ββ
sometimes there is a .json file (that is empty) in that folder below. sometimes not. I probably delete the contents and recopy the jwt file. (I would REALLY rather cp it and set permissions that do that super hokey pasting of the contents).
The JWT file is a "one-time use token." If a JWT is present, ziti-edge-tunnel attempts to enroll the identity and create a JSON file for use on all subsequent runs. Attempts to re-use the JWT will fail. I'm not sure if this is what's happening for you, but your note about copying the JWT files makes me think you might be trying to use one that has already been used.
You can isolate the enrollment itself and view the output like this. Iβve saved a fresh token in /tmp to illustate.
$ sudo -u ziti /opt/openziti/bin/ziti-edge-tunnel version
v0.21.5-local
$ sudo -u ziti /opt/openziti/bin/ziti-edge-tunnel enroll --jwt /tmp/myclient1.jwt --identity /opt/openziti/etc/identities/myclient.json
(919554)[ 0.000] INFO ziti-sdk:utils.c:188 ziti_log_set_level() set log level: root=3/INFO
(919554)[ 0.000] INFO ziti-sdk:utils.c:188 ziti_log_set_level() set log level: root=3/INFO
(919554)[ 0.000] INFO ziti-sdk:ziti_enroll.c:90 ziti_enroll() Ziti C SDK version 0.32.8 @d7f329f(HEAD) starting enrollment at (2023-07-25T13:51:13.642)
$ sudo -u ziti jq '.ztAPI' /opt/openziti/etc/identities/myclient.json
"https://7ce7e424-6a92-4ff2-9459-ebbba32346fa.production.netfoundry.io:443"
Could the problem be the client API URL used for enrolling wasnβt reachable? You can see which URL is embedded in the token with a Python one-liner, or by pasting it in https://jwt.io.
Thanks for all the replies, that certainly helps explain the process.
I am pretty sure the root of the problem is a missing external DNS (I have a separate thread on that).
I am pretty sure that I was, indeed, attempting to enroll an single jwt token more than once. Does an unsuccessful enrollment invalidate that key? I kind of wouldnβt think so, because it would the the controller that would reject itβs reuseβ¦ so this puts be back to the DNS issue.
Seeing the underlying command that is running to enroll the token is immensely helpful!
Does the name of the token matter? Or does any .jwt file get picked up?
No, the token is valid until it expires or is used for enrollment. Anything else is unexpected by me and probably a bug.
Good! Both ziti edge enroll and ziti-edge-tunnel enroll CLIs can perform enrollment with the controller's client API.
The default behavior is to generate a private key and exchange the one-time token for a long-lived client certificate issued by the controller's edge enrollment signer CA. There's also the option to use an existing private key on disk or in a hardware module.
The Linux installer packages provide a systemd service startup script that looks for any readable file named like *.jwt in the identities directory. If enrollment succeeds then it deletes the token file and a file with the same basename and *.json suffix remains containing the enrolled identity configuration.