diff options
| author | Denton Gentry <dgentry@tailscale.com> | 2023-10-11 10:18:48 -0700 |
|---|---|---|
| committer | Denton Gentry <dgentry@tailscale.com> | 2023-10-11 10:40:23 -0700 |
| commit | 80e67a8c4d6fc9489161bc9f1e1eeba8a59e1151 (patch) | |
| tree | 33177c7333ba53c09b601e96c145f6b27d1140e9 | |
| parent | 9f05018419b5042fe2e4e19f4cbdbe52f58b2aef (diff) | |
| download | tailscale-dgentry-authkey.tar.xz tailscale-dgentry-authkey.zip | |
cmd/get-authkey: add expiry argumentdgentry-authkey
Allow the lifetime to be adjusted from the default 90 days.
Updates https://github.com/tailscale/tailscale/issues/3243
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
| -rw-r--r-- | cmd/get-authkey/main.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/get-authkey/main.go b/cmd/get-authkey/main.go index 22dd9af82..50485343c 100644 --- a/cmd/get-authkey/main.go +++ b/cmd/get-authkey/main.go @@ -28,6 +28,7 @@ func main() { ephemeral := flag.Bool("ephemeral", false, "allocate an ephemeral authkey") preauth := flag.Bool("preauth", true, "set the authkey as pre-authorized") tags := flag.String("tags", "", "comma-separated list of tags to apply to the authkey") + expiry := flag.Duration("expiry", 0, "amount of time until authkey expires, for example 24h.") flag.Parse() clientID := os.Getenv("TS_API_CLIENT_ID") @@ -65,7 +66,7 @@ func main() { }, } - authkey, _, err := tsClient.CreateKey(ctx, caps) + authkey, _, err := tsClient.CreateKeyWithExpiry(ctx, caps, *expiry) if err != nil { log.Fatal(err.Error()) } |
