openziti / ziti-tunnel-sdk-c

Apache License 2.0
43 stars 17 forks source link

ZET creates empty config file if enroll fails #554

Open qrkourier opened 1 year ago

qrkourier commented 1 year ago

An empty config outfile prevents subsequent attempts to enroll from succeeding. This burdens the operator or script with first noticing that the outfile exists and is empty and removing the empty outfile before re-attempting to enroll. Conditions that may cause enrollment to fail include controller unavailable and invalid OTT.

❯ /opt/openziti/bin/ziti-edge-tunnel version
v0.20.9-local

❯ /opt/openziti/bin/ziti-edge-tunnel enroll --jwt /dev/null --identity /tmp/empty.json
(721628)[        0.000]    INFO ziti_log_set_level set log level: root=3
(721628)[        0.000]    INFO ziti-sdk:ziti_enroll.c:92 ziti_enroll() Ziti C SDK version 0.30.8 @ecfee7b(HEAD) starting enrollment at (2022-11-15T23:45:17.403)
(721628)[        0.000]   ERROR ziti-sdk:jwt.c:31 parse_jwt_content() jwt input lacks a dot
(721628)[        0.000]   ERROR ziti-sdk:ziti_enroll.c:131 ziti_enroll() /github/workspace/build/_deps/ziti-sdk-c-src/library/ziti_enroll.c:110 - load_jwt(opts->jwt, ecfg, &ecfg->zejh, &ecfg->zej) => -4 (JWT has invalid format)
(721628)[        0.000]   ERROR ziti-edge-tunnel:ziti-edge-tunnel.c:2007 enroll_cb() enrollment failed: enroll failed(-4)

❯ file /tmp/empty.json
/tmp/empty.json: empty
NicFragale commented 1 year ago

This has affected my operations a few times as well. Upvote to get it addressed...

qrkourier commented 1 year ago

stale

qrkourier commented 10 months ago

observed again today

qrkourier commented 4 months ago

Observed by a forum user: https://openziti.discourse.group/t/missing-or-invalid-csr/2492/11?u=qrkourier