User Identification

There’s a bit of a simpler way. Here’s a little python script that will dump all of the Tailscale IP addresses for the current machine:

#!/usr/bin/env python3

import json
import subprocess

status_data = subprocess.check_output(["tailscale", "status", "--json"]).decode("utf-8")
status_data = json.loads(status_data)

for ip in status_data["TailscaleIPs"]:
    print(ip)

As of today, here are all of the keys in the JSON response:

>>> info.keys()
dict_keys(['Version', 'BackendState', 'AuthURL', 'TailscaleIPs', 'Self', 'MagicDNSSuffix', 'CertDomains', 'Peer', 'User'])

I hope this can help! I’d be curious to see what other fun things you could do with this. There is a way to do this natively from Go (which is how the hello server works), however as of today we do not currently have this exposed to other applications. I’d suggest querying tailscale status and attaching the user information as a part of an on-server session store.

1 Like