Token and password
There are two separate locks. Do not mix them up.
Token
The token limits who may connect an agent to the control port. The server and the agent carry the same value.
aditd --token bir-belirtec
tunl http 3000 --token bir-belirtec
The environment variable is ADIT_TOKEN. In the file the field name is token. A flag and an environment variable override the file.
The command line and the environment can be visible to other users on the same machine. On the server, read the token from a file: aditd --token-file /run/secrets/adit_token (environment: ADIT_TOKEN_FILE). Whitespace and a trailing newline at the ends of the file are discarded. A Docker secret is mounted this way. It is not given together with --token.
The bir-belirtec on this page is only an example. On a server that will be reached from anywhere other than this machine, use a random value of at least 16 characters. If the control or panel address is open to the outside and the token is shorter than 16 characters, aditd prints a warning at startup (it does not refuse, because a short token is not a problem for a setup used only from this machine). To generate one:
openssl rand -hex 24
In Windows PowerShell:
$b = New-Object byte[] 24; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b); -join ($b | ForEach-Object { $_.ToString('x2') })
Opening the control port to everyone while there is no token means anyone who can reach that port can open a tunnel to local ports. The default bind is 127.0.0.1.
A client that tries the wrong token is left without an answer after 10 attempts in a minute; the right token does not help that client during that minute either. The client is the address the connection came from; behind a reverse proxy they all look like one address, so see Behind a reverse proxy. A connection that connects and says nothing is dropped after 20 seconds. At most 128 such connections are waited on at once, and one address can hold at most 8 of them; that way one machine cannot fill every socket and leave new agents outside. Open tunnels are not affected.
Encrypt the control connection
By default the control connection is not encrypted and the token passes in the clear. If the agent and the server are on the same machine, that is not a problem. If they are on separate machines, the agent refuses a clear connection. It prints kontrol bağlantısı şifresiz and says the server is not on this machine. Turn TLS on:
aditd --control 0.0.0.0:7000 --control-tls --domain tunnel.example.com --acme-email [email protected] --token-file token.txt
tunl http 3000 --server tls://tunnel.example.com:7000 --token bir-belirtec
The certificate comes from the same place as the HTTPS endpoint: Let's Encrypt, a --tls-cert and --tls-key file, or a self-signed one. On a certificate from a trusted CA the agent writes nothing extra; it is verified with the system's root certificates. With Let's Encrypt the agent must connect by the domain name, not by IP.
With a self-signed certificate the server prints the fingerprint at startup. You give that to the agent; like SSH's known host, only that certificate is accepted:
tunl http 3000 --server tls://203.0.113.5:7000 --fingerprint sha256:ab12...
The fingerprint is taken once, by a path you trust. The colon-separated form from openssl x509 -fingerprint -sha256 is read too. In the file the field name is fingerprint, and the environment variable is ADIT_FINGERPRINT. If the fingerprint does not match, or the certificate cannot be verified, the agent does not retry and it stops without sending the token. The fingerprint is used only with a tls:// address.
The pair the server generates itself (adit-cert.pem and adit-key.pem) is valid for 825 days. If less than 30 days remain when the server starts, or it has already expired, the server generates a new one and writes the old and new fingerprints to the log; agents that pin a fingerprint must use the new value. A certificate you passed with --tls-cert is not touched, only warned about when expiry is near. The check runs only at startup; if the server stays up for months, restart it from time to time.
If a clear connection is really required (for example inside a trusted private network or a tunnel), pass --allow-plain; the environment variable is ADIT_ALLOW_PLAIN=1, and in the file allow_plain: true. The agent writes this to stderr as a warning when it starts. This permission is only for a clear connection to another machine; 127.0.0.1, localhost, and ::1 are never asked.
A browser, or another client that asks for h2 and http/1.1, that arrives at this port with TLS is turned away during the handshake. The accepted protocol is adit/1.
Panel session
While a token is set, the panel API asks for the token. The only exception is a request that comes from this machine, and only when all three of these are true together: the request comes from a loopback address (127.0.0.1, ::1), the Host header is localhost or a loopback address, and the request carries no X-Forwarded-*, Forwarded, or X-Real-IP header. The first one alone is not enough: a web page can point its own domain name at 127.0.0.1 and call the panel from your browser (DNS rebinding), and a reverse proxy on the same machine can also forward a request from the world from a loopback address.
If you open the panel behind a reverse proxy (nginx, Caddy), pass aditd --no-loopback-admin: a request from this machine asks for the token too. Environment: ADIT_NO_LOOPBACK_ADMIN=1.
Signing in is sending the token with POST /api/session. The server generates a random session id and writes it to the adit_session cookie. The cookie does not contain the token itself: if it is stolen, it can at most enter the panel, not connect an agent. The session cookie is HttpOnly and SameSite=Lax. It is Secure on HTTPS, or when the proxy says X-Forwarded-Proto: https. It is valid for 12 hours, and on sign-out (DELETE /api/session) it is revoked on the server too. A restart does not drop the session: sessions live in adit-sessions.json next to the data file, and only their hashes are stored there, not the cookie itself. If you change the token, all of them become invalid. If the file is deleted, everyone signs in again. An older version's adit_token cookie is not read; it is deleted from the browser at sign-in.
The panel and the Status page show only the sign-in screen when there is no session. After sign-in, "Signed in" is written under the left menu and the Sign out button closes the session on the server too. If you entered from this machine without a token, it says "This machine" there and the sign-out button is hidden, because there is no session to close. The page learns this with GET /api/session: the answer is {"login":"session"} or {"login":"local"}, or 401 if you are not signed in.
The browser reports what another site sent with Sec-Fetch-Site and Origin; the panel API rejects such a request with 403. A tunnel's own page cannot reach the panel even when it is under the same domain. After 10 wrong sign-ins in a minute, 429 is returned.
If the panel is opened from outside this machine, pass aditd --ui-tls so the token and the session cookie do not travel in the clear; the address becomes https://. The home page, the download list, the health endpoint, and the install script do not ask for a token. The live tunnel list and the event stream do; the home page does not show them to a visitor without a token, and gives that visitor a "Sign in" link.
Behind a reverse proxy
If nginx or Caddy is in front of you, the server sees every request as coming from the proxy's address. The sign-in attempt limit, the per-minute request limit, and the IP allow and deny lists then count every visitor as one person: one person's wrong attempts lock everyone, and a permission given to one person is enough for everyone. Tell the server the proxy's address:
aditd --trusted-proxy 127.0.0.1,10.0.0.0/8
The value is addresses or CIDR blocks separated by commas (environment: ADIT_TRUSTED_PROXY). X-Forwarded-For is read only on connections that come from these addresses; one that comes from another address is plain text. The chain is read from the right end, trusted addresses are skipped, and the first address that is not trusted is the visitor. A value the visitor wrote at the left end of the header cannot jump ahead of the entry the proxy itself appended. If the header is missing, X-Real-IP is read. The same address is written as the visitor in the inspector record.
The proxy must append the address it saw to the end of the header: in nginx, proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;, and in Caddy the default behavior. If you write nothing in the list, the header is not looked at and is not forwarded to the local application either: the application sees only the address that connected. Writing 0.0.0.0/0 or ::/0 makes everyone trusted; then anyone can impersonate someone else with the header, and the server warns about that at startup. Write only the address of the proxy in front of you.
How reserved names store the token
adit-data.json does not store the token itself. To recognize later the agent that took a name, it writes a salted Argon2id hash ($argon2id$...); someone who reads the file can test each guess only by spending memory and time. Verification is computed once per hash and remembered for as long as the server runs; only one verification runs at a time, so about 64 MB of memory is needed at once. If you run the server in a very small container, account for that.
Plain SHA-256 hashes from before version 0.3 are still read. Ones that match the current token are converted at server startup, and ones saved with the previous token are converted to the new form the first time their owner connects. An older aditd cannot verify a converted record: that name looks locked, and the agent gets the error ad kayıtlı. The record is kept as it is in the file (an older aditd rewrites the file when it adds its own names, and does not change converted records) and the name works again when you return to 0.3. The server does not keep a backup of the old hash for this, because the backup would keep storing the weak hash. If you want to use that name on the old version, delete the record from the file while aditd is stopped; the name opens for the next agent. If you are going back to the old version, still take a backup of adit-data.json first and delete it when you are done.
Changing the token
A reserved name is bound to the token of the agent that took it. If you give the server a new token, names taken with the old token stay locked and the agent gets the error ad kayıtlı. Pass the old one once with --previous-token.
aditd --token new-token --previous-token old-token
Names saved with the old token move to the new token the first time their owner connects. You can remove the flag after that. The old token is not accepted for agent login; it is read only for this hand-off. The environment variable is ADIT_PREVIOUS_TOKEN.
Public endpoint password
tunl http 3000 --auth user:password
--auth asks the HTTP client for a user name and a password. In the file the field name is auth. This field does not apply on a TCP tunnel.
The panel shows Authorization and cookie values, and password-like fields in the query and the body, as ***, and these are not written to disk. Replay uses the real value in the server's memory, not the stars on the screen. The detail and the limits are on the inspector page.
What this lock is not
There is no session with Google or any other account. There is no team, no SSO, and no role. The password is the single pair you provided.