Implement Key Expiry #364

Closed
opened 2025-12-29 01:27:43 +01:00 by adam · 1 comment
Owner

Originally created by @nikking on GitHub (Nov 4, 2022).

Feature request

Tailscale offers a feature called Key Expiry.

As a security feature, users need to periodically reauthenticate on each of their devices. The default expiration period depends on your domain setting. By default, new domains are set with an expiry period of 180 days.

I'm interested to use Headscale with my org and key expiration is a security requirement.

Originally created by @nikking on GitHub (Nov 4, 2022). <!-- Headscale is a multinational community across the globe. Our common language is English. Please consider raising the feature request in this language. --> **Feature request** <!-- A clear and precise description of what new or changed feature you want. --> Tailscale offers a feature called [Key Expiry](https://tailscale.com/kb/1028/key-expiry/). > As a security feature, users need to periodically reauthenticate on each of their devices. The default expiration period depends on your domain setting. By default, new domains are set with an expiry period of 180 days. I'm interested to use Headscale with my org and key expiration is a security requirement.
adam added the enhancement label 2025-12-29 01:27:43 +01:00
adam closed this issue 2025-12-29 01:27:43 +01:00
Author
Owner

@FStelzer commented on GitHub (Dec 8, 2022):

depending on what the time the expiry should be based on you can quite easily do this using the api.
I'm using something similar to:
headscale nodes list -o json | jq '.[] | select(.last_seen.seconds < (now - 86400)) | .id' | xargs -iID headscale nodes expire -i ID

in a cron to automatically expire keys that have not been online for one day (86400s) in this case. Using the jq selector you can filter for all kinds of user info. try "headscale nodes list -o json" to see whats available and might fit your needs.
Not as easy as just a config flag but quite a bit more flexible

@FStelzer commented on GitHub (Dec 8, 2022): depending on what the time the expiry should be based on you can quite easily do this using the api. I'm using something similar to: headscale nodes list -o json | jq '.[] | select(.last_seen.seconds < (now - 86400)) | .id' | xargs -iID headscale nodes expire -i ID in a cron to automatically expire keys that have not been online for one day (86400s) in this case. Using the jq selector you can filter for all kinds of user info. try "headscale nodes list -o json" to see whats available and might fit your needs. Not as easy as just a config flag but quite a bit more flexible
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#364