Private socks share as a systemd service

I have tried to run zrok as a systemd service:
systemctl enable zrok-share.service
systemctl start zrok-share.service

Unfortunately, it was unsuccessful. Because there is no target for the socks share. So I have modified zrok-share.service file.

Q1: Is there a working version for socks service somewhere?

Q2: I am curious about the ZROK_INSTANCE variable. How I could set it in the zrok-share.service script?

Here is my configuration:
/opt/openziti/etc/zrok/zrok-share.env :

ZROK_ENABLE_TOKEN="alphanums"
ZROK_ENVIRONMENT_NAME="hostname"
ZROK_BACKEND_MODE="socks"
ZROK_TARGET=""
ZROK_UNIQUE_NAME="xyz"
ZROK_FRONTENDS="private"
ZROK_FRONTEND_MODE="reserved-private"

Here is my modifications, diff -u /opt/openziti/bin/zrok-share.bash /opt/openziti/bin/zrok-socks5.bash :

 exec_share_reserved(){
     local token="$1"
-    local target="$2"
-    shift 2
+    shift 1
     local opts="${*:-}"
-    local zrok_cmd="share reserved ${token} ${opts} --override-endpoint ${target}"
+    local zrok_cmd="share reserved ${token} ${opts}"
     exec_with_common_opts ${zrok_cmd}
 }
 
@@ -49,12 +48,9 @@
   fi
 done
 
-ZROK_RESERVATION_FILE="${HOME}/.zrok/reserved${ZROK_INSTANCE:+@${ZROK_INSTANCE}}.json"
+#ZROK_RESERVATION_FILE="${HOME}/.zrok/reserved${ZROK_INSTANCE:+@${ZROK_INSTANCE}}.json"
+ZROK_RESERVATION_FILE="${HOME}/.zrok/reserved-socks5.json"
 
-[[ -n "${ZROK_TARGET:-}" ]] || {
-  echo "ERROR: ZROK_TARGET is not defined." >&2
-  exit 1
-}

Hi @Rantanplan, We've just released a new zrok-agent.service as a Linux package: Linux Agent Service | zrok

You can still use the older zrok-share.service and that is currently the only way to use VPN mode as a Linux service, but the zrok-agent.service will work better for everything else, I expect.

You're correct the value of ZROK_TARGET is empty with socks mode, and I have tested socks mode successfully with the zrok-share.service. Can you enclose your paste with ``` fences to escape them from Markdown rendering?

Thank you.

What you think about the ZROK_INSTANCE variable. Is it possible to set it in the zrok-share.service script?

the idea is to have several reserved-xx.json files.

The ZROK_INSTANCE variable is used internally by the zrok-share.bash script. It's set and used when you define a "user service" according to these deprecated instructions: Linux User Share | zrok

That will be much easier with the new package "zrok-agent" that provides the zrok-agent.service!

1 Like