Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preauthkeys: Allow specifying key material #1855

Open
lorenzleutgeb opened this issue Apr 5, 2024 · 1 comment
Open

preauthkeys: Allow specifying key material #1855

lorenzleutgeb opened this issue Apr 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@lorenzleutgeb
Copy link

lorenzleutgeb commented Apr 5, 2024

Why

I deploy multiple machines (both machines that run the Tailscale client, but also a machine that runs the Headscale control server). I want to automate the registration of clients to the control server as much as possible.

At the moment, I have to run headscale preauthkeys create which will randomly generate a 24 byte key and store it (along with additional metadata, such as expiry, user, etc.) in the SQLite database.

This means that in order to deploy a client, I first need to run a command on the control server to change its state, take the output, and use that to include it in the state to deploy to the client. Thus, I end up maintaining a list of preauth keys for my clients.

I would prefer to use the same list to also declaratively control the state of the control server. That is, I would like to set the list of preauth keys for the server (or at least add to the list), at the time I deploy it. This way I would be able to generate images for all clients and the control server, and deploy them "in one go", without having to first deploy the control server, executing headscale preauthkyes create and only then deploying clients.

Description

I would like to be able to specify keys that I have securely generate myself when I execute headscale preauthkeys create, for example:

headscale preauthkeys create --key da39a3ee5e6b4b0d3255bfef95601890afd80709ad001730 [...]

A workaround is to use the SQLite database directly, bypassing headscale preauthkeys, but I'd like to avoid that.

The implementation would be rather straightforward, adding another optional argument to pass the key, and if it is not specified call generateKey as it is done unconditionally at the moment.

@lorenzleutgeb lorenzleutgeb added the enhancement New feature or request label Apr 5, 2024
@ohdearaugustin
Copy link
Collaborator

You can refer to this old discussion about such keys: #662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants