Skip to content

Brittle behavior when starting subsequent tsnsrv instances. #62

@efarrer

Description

@efarrer

When a user runs tsnsrv as follows:

TS_AUTHKEY=... tsnsrv --name first http://localhost:9090

Then everything works wonderfully.

However if I try and start a second instance.

TS_AUTHKEY=... tsnsrv --name second http://localhost:9090

Then the second instance will fail and the tailscale console will report the error: "Duplicate node key" under the Machine tab.

The conflict is caused by the tsnsrv alwasys using the .config/tsnet-tsnsrv directory (on Linux) to store configuration. This behavior can be avoided by using the -stateDir or TS_STATE_DIR for the second instance however the failure is surprising and will likely lead to confusion. A better solution would be to use a unique directory name (based on the --name parameter) for each tsnsrv instance such as .config/tsnet-tsnsrv-. This would eliminate the surprises and confusion for users.

The cost of this proposal is that it is a backwards incompatible change and that existing users would need to recreate their instances (use a new key). If desired tsnsrv could warn users of the incompatibility by warning all users that have a .config/tsnet-tsnsrv directory that they should delete this directory and recreate their instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions