[PR #130] [CLOSED] Allow preauthkeys to specify a subnet for machine to join #1277

Closed
opened 2025-12-29 02:29:32 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/130
Author: @jccit
Created: 10/1/2021
Status: Closed

Base: mainHead: auth-subnet


📝 Commits (10+)

  • 137b327 Preauthkey can assign machine to subnet
  • a10013d Show subnet in key list
  • 32f0c32 Removed leftover temp code
  • a2a86af Merge branch 'main' into auth-subnet
  • 42b5185 Merge branch 'main' into auth-subnet
  • 02bf4b0 Merge branch 'main' into auth-subnet
  • 2014946 Add IP param for non-reusable keys
  • 23c490a Merge branch 'main' into auth-subnet
  • 6258771 Merge branch 'main' into auth-subnet
  • 5f3c6a4 Merge remote-tracking branch 'upstream/main' into auth-subnet

📊 Changes

9 files changed (+155 additions, -19 deletions)

View changed files

📝 api.go (+25 -1)
📝 cmd/headscale/cli/preauthkeys.go (+34 -1)
📝 gen/go/headscale/v1/preauthkey.pb.go (+32 -13)
📝 gen/openapiv2/headscale/v1/headscale.swagger.json (+6 -0)
📝 grpcv1.go (+3 -2)
📝 preauth_keys.go (+25 -1)
📝 preauth_keys_test.go (+25 -0)
📝 proto/headscale/v1/preauthkey.proto (+2 -0)
📝 utils.go (+3 -1)

📄 Description

This PR updates the preauthkey create command with a new subnet argument. If a machine joins the network using this authkey it will be assigned the next IP in the subnet provided.

I've found this quite useful for organising IP addresses of nodes, hopefully someone else will too

Update 2021-10-08: There is also an IP option which can be used for non-reusable keys. This accepts an IP address, converts it into CIDR format and passes it into the create key function. This allows you to pre-assign an IP address for a single node


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/130 **Author:** [@jccit](https://github.com/jccit) **Created:** 10/1/2021 **Status:** ❌ Closed **Base:** `main` ← **Head:** `auth-subnet` --- ### 📝 Commits (10+) - [`137b327`](https://github.com/juanfont/headscale/commit/137b327795ada70918ce934c5475e2d7dc7da46c) Preauthkey can assign machine to subnet - [`a10013d`](https://github.com/juanfont/headscale/commit/a10013d80bbbbd25daa5f74ebf5d2bb273a76a83) Show subnet in key list - [`32f0c32`](https://github.com/juanfont/headscale/commit/32f0c32d688100dcad388b1e5c572c5cc43153ae) Removed leftover temp code - [`a2a86af`](https://github.com/juanfont/headscale/commit/a2a86af03fcfdeadc7782c2a05c3f2e531e94fe1) Merge branch 'main' into auth-subnet - [`42b5185`](https://github.com/juanfont/headscale/commit/42b5185669268156557a85ffe763d247efaaf7f6) Merge branch 'main' into auth-subnet - [`02bf4b0`](https://github.com/juanfont/headscale/commit/02bf4b09ab9d8cc04161274f5d7c10e810466aa0) Merge branch 'main' into auth-subnet - [`2014946`](https://github.com/juanfont/headscale/commit/2014946cd99cc0a513a211cf5b29a88df5a08201) Add IP param for non-reusable keys - [`23c490a`](https://github.com/juanfont/headscale/commit/23c490ac6c7b67a1b16c549aba4c23dac69ed093) Merge branch 'main' into auth-subnet - [`6258771`](https://github.com/juanfont/headscale/commit/6258771194d7f4d1301c36182f08c00c838d57ec) Merge branch 'main' into auth-subnet - [`5f3c6a4`](https://github.com/juanfont/headscale/commit/5f3c6a46a06825df6afa8f86b35fbf1246e1c501) Merge remote-tracking branch 'upstream/main' into auth-subnet ### 📊 Changes **9 files changed** (+155 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `api.go` (+25 -1) 📝 `cmd/headscale/cli/preauthkeys.go` (+34 -1) 📝 `gen/go/headscale/v1/preauthkey.pb.go` (+32 -13) 📝 `gen/openapiv2/headscale/v1/headscale.swagger.json` (+6 -0) 📝 `grpcv1.go` (+3 -2) 📝 `preauth_keys.go` (+25 -1) 📝 `preauth_keys_test.go` (+25 -0) 📝 `proto/headscale/v1/preauthkey.proto` (+2 -0) 📝 `utils.go` (+3 -1) </details> ### 📄 Description This PR updates the preauthkey create command with a new subnet argument. If a machine joins the network using this authkey it will be assigned the next IP in the subnet provided. I've found this quite useful for organising IP addresses of nodes, hopefully someone else will too Update 2021-10-08: There is also an IP option which can be used for non-reusable keys. This accepts an IP address, converts it into CIDR format and passes it into the create key function. This allows you to pre-assign an IP address for a single node --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 02:29:32 +01:00
adam closed this issue 2025-12-29 02:29:32 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1277