Describe where TeamSpeak keeps identities
Both official clients store identities in a `ProtobufItems` table of their `settings.db`, not in the settings rows: one protobuf item per object, the item type in field 6 selecting which payload field carries the body, and type 1 (field 17) holding the TeamSpeak 3 export string plus a nickname. Working that out is the prerequisite for importing, so write it down before the code. The myTeamSpeak account record sits in the same database and is easy to mistake for an identity store; note that it carries no key pair and that the account service stays out of scope, so the question is not reopened. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f19a340f7
commit
840d9ce366
2 files changed
+245
No files matched your search
@@ -0,0 +1,184 @@
|
||||
# Identities
|
||||
|
||||
A TeamSpeak identity is an ECC P-256 key pair. The public key gives the client
|
||||
its unique id, which is how every server recognises it; the private key proves
|
||||
ownership. Losing it means losing every server group, every permission and
|
||||
every friend entry tied to that id — and anyone who copies it can impersonate
|
||||
its owner on every server. **An identity file is a secret. Treat it like an SSH
|
||||
private key.**
|
||||
|
||||
Voelin can import identities from the official clients so that switching does
|
||||
not mean starting over, and export them back so they are never trapped here.
|
||||
|
||||
## The unique ids
|
||||
|
||||
Both generations derive the unique id from `omega`, the base64 of the DER
|
||||
("tomcrypt") encoding of the *public* key:
|
||||
|
||||
| Server | Unique id |
|
||||
| --- | --- |
|
||||
| TeamSpeak 3 | `base64(SHA1(omega))`, 28 characters |
|
||||
| TeamSpeak 6 | `base64(SHA256(omega))`, 44 characters |
|
||||
|
||||
The same key therefore has two ids. `voelinctl identity show` prints both
|
||||
(`uid` and `uid6`); the store keys identities by the TeamSpeak 3 id, which is
|
||||
the shorter and older of the two.
|
||||
|
||||
The *security level* is hash cash over `omega`: the number of trailing zero
|
||||
bits of `SHA1(omega || decimal counter)`, counted from the first byte. The
|
||||
counter is stored next to the key; raising it raises the level, which is why
|
||||
the counter travels with every export. Servers commonly require level 8.
|
||||
|
||||
## The export string
|
||||
|
||||
Every format below ultimately holds the same string:
|
||||
|
||||
```
|
||||
<counter>V<obfuscated base64>
|
||||
```
|
||||
|
||||
- `<counter>` is the hash cash counter in decimal.
|
||||
- `V` separates it (the obfuscated part is base64, which never contains `V`
|
||||
before the first `V` here because the counter is digits only).
|
||||
- The obfuscated part is `base64(obfuscate(base64(DER key pair)))`, where the
|
||||
DER is tomcrypt's `SEQUENCE { BIT STRING, INTEGER 32, INTEGER x, INTEGER y,
|
||||
INTEGER private }` (109–117 bytes in practice, so 152 base64 characters, so
|
||||
204 characters after the second base64).
|
||||
- `obfuscate` XORs the first 100 bytes with a fixed 128-byte table and the
|
||||
first 20 bytes with `SHA1` of the bytes from offset 20 up to the first zero
|
||||
byte. It is not encryption; it stops nothing. The algorithm lives in
|
||||
`tsproto_types::crypto::EccKeyPrivP256::{from,to}_ts_obfuscated`.
|
||||
|
||||
`tsproto`'s `Identity::new_from_ts_str` parses this string, so every importer
|
||||
below only has to find it.
|
||||
|
||||
## Where the clients keep it
|
||||
|
||||
### TeamSpeak 3 and TeamSpeak 6: the `ProtobufItems` table
|
||||
|
||||
Both clients store identities in a table of the same shape, in their
|
||||
`settings.db` (SQLite):
|
||||
|
||||
```sql
|
||||
CREATE TABLE ProtobufItems (
|
||||
timestamp integer unsigned NOT NULL,
|
||||
key varchar NOT NULL UNIQUE,
|
||||
value varchar -- protobuf bytes, despite the column type
|
||||
)
|
||||
```
|
||||
|
||||
`key` is `"1"`, `"2"`, … for the items plus one row `"Checksum"`. Each item
|
||||
`value` is a protobuf message with a common header and one payload field:
|
||||
|
||||
| Field | Wire type | Meaning |
|
||||
| --- | --- | --- |
|
||||
| 2 | bytes | the item's own UUID (36 characters, with dashes) |
|
||||
| 3 | bytes | a second UUID; present in TeamSpeak 6 rows, absent in TeamSpeak 3 rows |
|
||||
| 4 | varint | small enum, 1 or 3 observed |
|
||||
| 5 | bytes | optional UUID |
|
||||
| 6 | varint | **item type**, 0–5 |
|
||||
| 7, 8 | bytes | optional UUIDs, usually empty |
|
||||
| 9 | varint | Unix timestamp in seconds |
|
||||
| 16 + type | bytes | the payload, one field per item type |
|
||||
|
||||
The payload field number is `16 + type`, so the type in field 6 says which
|
||||
field carries the body. **Type 1, payload field 17, is an identity:**
|
||||
|
||||
| Field | Wire type | Meaning |
|
||||
| --- | --- | --- |
|
||||
| 1 | bytes | the export string `<counter>V<obfuscated base64>` (207–213 characters) |
|
||||
| 2 | bytes | the nickname, UTF-8 |
|
||||
| 3 | bytes | an 8-character alphanumeric token, identical for every identity in one install — an account or device identifier, not part of the key |
|
||||
| 4 | bytes | empty in every row seen |
|
||||
| 5 | varint | 1 on exactly one identity: the selected one |
|
||||
|
||||
Voelin reads field 1 and field 2 and ignores the rest. The other item types
|
||||
(0, 2, 3, 4, 5 — connection profiles, bookmarks, server lists and such) are
|
||||
**not** decoded; they are skipped by their type, not by guessing at their
|
||||
contents.
|
||||
|
||||
The `Checksum` row is `SHA1` over the concatenation of the other rows' `value`
|
||||
blobs in ascending numeric `key` order — 20 bytes, no key, no length prefixes.
|
||||
It is an integrity check the client writes, verified here only as a warning:
|
||||
Voelin never writes these files, so it cannot invalidate one, and a
|
||||
user-edited database with a stale checksum is still worth importing from.
|
||||
|
||||
`AccountData/Account` in the TeamSpeak 6 database is the myTeamSpeak account
|
||||
record, not an identity — see [research/myteamspeak.md](research/myteamspeak.md).
|
||||
It contains no ASN.1 key pair.
|
||||
|
||||
### TeamSpeak 3: `.ini` export
|
||||
|
||||
"Export identity" in the TeamSpeak 3 client writes:
|
||||
|
||||
```ini
|
||||
[Identity]
|
||||
id=friendly name
|
||||
identity="<counter>V<obfuscated base64>"
|
||||
nickname=Nickname
|
||||
```
|
||||
|
||||
The quotes around `identity` are optional in files seen in the wild, so both
|
||||
forms are accepted. Keys are matched case-insensitively and the section header
|
||||
is not required.
|
||||
|
||||
### TeamSpeak 3: older `Profiles` rows
|
||||
|
||||
Client versions before the protobuf tables kept identities in the `Profiles`
|
||||
table of `settings.db` as `Identities/<n>/identity` and
|
||||
`Identities/<n>/nickname` rows. Voelin reads those too when they are present.
|
||||
A current 3.6 install has only `Capture/…` and `Playback/…` rows there.
|
||||
|
||||
### `ts3clientui_qt.secrets.conf`
|
||||
|
||||
Some TeamSpeak 3 builds keep an obfuscated copy of the identity list in this
|
||||
Qt config file next to `settings.db`. Voelin scans it for `identity=` lines
|
||||
in the `.ini` form above and ignores the rest. It is **not** supported beyond
|
||||
that: the file's own container format is not decoded.
|
||||
|
||||
## Default locations
|
||||
|
||||
Voelin looks in these places with `--auto`; each is opened read-only and none
|
||||
is ever written.
|
||||
|
||||
| Client | Linux | Windows | macOS |
|
||||
| --- | --- | --- | --- |
|
||||
| TeamSpeak 3 | `~/.ts3client/settings.db` | `%APPDATA%\TS3Client\settings.db` | `~/Library/Application Support/TeamSpeak 3/settings.db` |
|
||||
| TeamSpeak 6 | `~/.config/TeamSpeak/Default/settings.db` | `%APPDATA%\TeamSpeak\Default\settings.db` | `~/Library/Application Support/TeamSpeak/Default/settings.db` |
|
||||
| TeamSpeak 6, Flatpak | `~/.var/app/com.teamspeak.TeamSpeak/config/TeamSpeak/Default/settings.db` | — | — |
|
||||
| TeamSpeak 3, Flatpak | `~/.var/app/com.teamspeak.TeamSpeak3/.ts3client/settings.db` | — | — |
|
||||
|
||||
`$XDG_CONFIG_HOME` is honoured on Linux where the client honours it. Portable
|
||||
installs keep `settings.db` next to the executable; point `--from` at it.
|
||||
|
||||
## What Voelin does
|
||||
|
||||
```
|
||||
voelinctl identity import --auto [--dry-run]
|
||||
voelinctl identity import --from <path> [--dry-run]
|
||||
voelinctl identity export <id> <path>
|
||||
```
|
||||
|
||||
- **Import** lists what it found as nickname, unique id and security level,
|
||||
and stores each one through `voelin-store` under its nickname. An identity
|
||||
whose TeamSpeak 3 unique id is already in the store is reported as a
|
||||
duplicate and not added twice. `--dry-run` lists and stores nothing.
|
||||
- The source file is opened read-only (`SQLITE_OPEN_READ_ONLY`, and the
|
||||
`immutable` URI flag so a database the client currently has open is never
|
||||
locked or recovered) and never written, moved or copied.
|
||||
- **Export** writes the TeamSpeak 3 `.ini` form, which the official client and
|
||||
every other tool read. The file is created with mode `0600` on Unix.
|
||||
|
||||
## Not supported
|
||||
|
||||
- **Encrypted identity exports.** The TeamSpeak 3 client can password-protect
|
||||
an `.ini` export; that container is not decoded. Export without a password
|
||||
and import that.
|
||||
- **The other `ProtobufItems` item types.** Bookmarks, connection profiles and
|
||||
server lists are not imported. Only identities are.
|
||||
- **myTeamSpeak sign-in.** There is no public API and the terms forbid the
|
||||
non-public ones, so identities synchronised only to a myTeamSpeak account and
|
||||
not present locally cannot be fetched. Sign in with the official client once
|
||||
so it writes them to `settings.db`, then import from there.
|
||||
- **Writing back to the official clients.** Voelin only reads them. Use the
|
||||
`.ini` export and the client's own import.
|
||||
@@ -0,0 +1,61 @@
|
||||
# myTeamSpeak
|
||||
|
||||
## Conclusion: out of scope
|
||||
|
||||
myTeamSpeak is TeamSpeak's account service: it holds the user's identities,
|
||||
bookmarks and settings server-side so the official clients can synchronise
|
||||
them. Voelin does **not** sign in to it.
|
||||
|
||||
There is no public API for it. The endpoints the official client uses are not
|
||||
documented for third parties, and TeamSpeak's terms of service do not permit
|
||||
using non-public ones. So there is nothing to implement here that could be
|
||||
maintained, and nothing that would be allowed. This file exists so the question
|
||||
is not re-researched.
|
||||
|
||||
What the user gets instead: sign in with the official client once, so that it
|
||||
writes the synchronised identities into its local `settings.db`, then
|
||||
`voelinctl identity import` reads them from there. See
|
||||
[../identity.md](../identity.md).
|
||||
|
||||
## The local record, structurally
|
||||
|
||||
The TeamSpeak 6 client keeps its account state in its `settings.db` in the
|
||||
table `AccountData`, shape `(timestamp integer unsigned, key varchar unique,
|
||||
value varchar)`, with two rows: `Account` and `Checksum`. `Checksum` is 20
|
||||
bytes — `SHA1` of the other rows' values, the same rule as `ProtobufItems`
|
||||
(see [../identity.md](../identity.md)).
|
||||
|
||||
`Account` is a protobuf message, about 1.7 kB in the install examined. Its
|
||||
shape, field numbers and lengths only:
|
||||
|
||||
| Field | Wire type | Length | Looks like |
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | bytes | 18 | printable ASCII |
|
||||
| 2 | bytes | 64 | printable ASCII, base64 alphabet |
|
||||
| 3 | bytes | 36 | a UUID |
|
||||
| 4 | bytes | 8 | printable ASCII, base64 alphabet |
|
||||
| 5 | bytes | 32 | binary |
|
||||
| 10 | bytes | 36 | a UUID |
|
||||
| 50 | message | 38 | one nested field: a UUID |
|
||||
| 51 | message | 2–5 | repeated, nine times; one or two small fields each |
|
||||
| 52 | bytes | 61 | binary |
|
||||
| 54 | message | 375 | 32-byte and 33-byte binary fields, a varint, a nested 112-byte blob, a 176-byte blob |
|
||||
| 56 | message | 114 | one nested field: a 112-byte blob |
|
||||
| 57 | message | 178 | a nested 98-character ASCII string, a varint, a 64-byte blob |
|
||||
| 58 | bytes | 386 | printable ASCII |
|
||||
| 59 | message | 6 | one small field |
|
||||
| 61 | message | 241 | a 64-byte and a 112-byte blob |
|
||||
|
||||
The 386-character printable field and the 64-byte base64-alphabet field are the
|
||||
shape of a bearer token and an identifier; **they were not decoded, parsed or
|
||||
used, and no request was made to any TeamSpeak service.**
|
||||
|
||||
No field in `Account` parses as an ASN.1 `SEQUENCE`, so it carries **no
|
||||
identity key pair** in the tomcrypt DER form the identities use. Importing
|
||||
identities therefore never needs to touch this row, and Voelin's importer does
|
||||
not read it. The 112-byte blobs are the right size for a raw key or signature
|
||||
but are not DER; what they are was not investigated further, because nothing
|
||||
Voelin does needs them.
|
||||
|
||||
`avatar_cache_mytsid` (one row, `contacts`) and `RevocationList` (one row,
|
||||
`Cache`) are caches the account service fills. Neither is read either.
|
||||
Reference in new issue
Block a user