cmd/derper, derp, tailcfg: add admission controller URL option

So derpers can check an external URL for whether to permit access
to a certain public key.

Updates tailscale/corp#17693

Change-Id: I8594de58f54a08be3e2dbef8bcd1ff9b728ab297
Co-authored-by: Maisem Ali <maisem@tailscale.com>
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2024-02-21 16:44:11 -08:00
committed by Brad Fitzpatrick
parent 2988c1ec52
commit 10d130b845
3 changed files with 107 additions and 24 deletions

View File

@@ -3,7 +3,12 @@
package tailcfg
import "sort"
import (
"net/netip"
"sort"
"tailscale.com/types/key"
)
// DERPMap describes the set of DERP packet relay servers that are available.
type DERPMap struct {
@@ -176,3 +181,17 @@ type DERPNode struct {
// DotInvalid is a fake DNS TLD used in tests for an invalid hostname.
const DotInvalid = ".invalid"
// DERPAdmitClientRequest is the JSON request body of a POST to derper's
// --verify-client-url admission controller URL.
type DERPAdmitClientRequest struct {
NodePublic key.NodePublic // key to query for admission
Source netip.Addr // derp client's IP address
}
// DERPAdmitClientResponse is the response to a DERPAdmitClientRequest.
type DERPAdmitClientResponse struct {
Allow bool // whether to permit client
// TODO(bradfitz,maisem): bandwidth limits, etc?
}