[PR #682] [MERGED] Add peer login expiration #12865

Closed
opened 2026-08-05 02:06:52 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/682
Author: @braginini
Created: 2/10/2023
Status: Merged
Merged: 2/13/2023
Merged by: @braginini

Base: mainHead: feature/user-peer-login-expiration


📝 Commits (8)

  • f9a99e1 Add peer login expiration
  • 6759ecf Add peer login expiration check on Sync
  • 55d76cc Add peer login JWT token check when expired
  • a0f5a38 Add peer login expiration default setting to account
  • 4270c7c Fix tests
  • a96c7c5 Fix Codacy
  • 0fb0133 Disable peer login expiration
  • f170a63 Fix Codacy issues

📊 Changes

6 files changed (+226 additions, -53 deletions)

View changed files

📝 management/server/account.go (+28 -15)
📝 management/server/file_store.go (+5 -0)
📝 management/server/grpcserver.go (+54 -14)
📝 management/server/mock_server/account_mock.go (+18 -0)
📝 management/server/peer.go (+75 -24)
📝 management/server/peer_test.go (+46 -0)

📄 Description

Describe your changes

This PR adds a peer login expiration logic that requires
peers created by a user to re-authenticate (re-login) after
a certain threshold of time (24h by default).

The Account object now has a PeerLoginExpiration
property that indicates the duration after which a peer's
login will expire and a login will be required. Defaults to 24h.

There are two new properties added to the Peer object:
LastLogin that indicates the last time peer successfully used
the Login gRPC endpoint and LoginExpirationEnabled that
enables/disables peer login expiration.

The login expiration logic applies only to peers that were created
by a user and not those that were added with a setup key.

P.S. The expiration is disabled always for now. Will be enabled in the future versions.
Next PRs:
HTTP Peer API will have a method to enable/disable expiration.
HTTP Peer API GET Peers will return the indicator that peer's login
has expired.
HTTP API for system settings to globally enable/disable expiration and set expiration duration.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 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/netbirdio/netbird/pull/682 **Author:** [@braginini](https://github.com/braginini) **Created:** 2/10/2023 **Status:** ✅ Merged **Merged:** 2/13/2023 **Merged by:** [@braginini](https://github.com/braginini) **Base:** `main` ← **Head:** `feature/user-peer-login-expiration` --- ### 📝 Commits (8) - [`f9a99e1`](https://github.com/netbirdio/netbird/commit/f9a99e140e1958836a0a7bffa92f0eb5ab7af9c9) Add peer login expiration - [`6759ecf`](https://github.com/netbirdio/netbird/commit/6759ecf5ec884c2b714d8938bd8877f30e0bbdf5) Add peer login expiration check on Sync - [`55d76cc`](https://github.com/netbirdio/netbird/commit/55d76cc63efff20c2d028f56e3bd9dd1602c46a7) Add peer login JWT token check when expired - [`a0f5a38`](https://github.com/netbirdio/netbird/commit/a0f5a38e5a4ea3dee34174e93d9b06ec6b14c8c3) Add peer login expiration default setting to account - [`4270c7c`](https://github.com/netbirdio/netbird/commit/4270c7cc474aa66534e0cfb949ca91e00d6e0b65) Fix tests - [`a96c7c5`](https://github.com/netbirdio/netbird/commit/a96c7c54f3d44ce109e3175bfefa3ed12040b702) Fix Codacy - [`0fb0133`](https://github.com/netbirdio/netbird/commit/0fb0133da4249654a0e5684cdbbec5ce8c87d9fa) Disable peer login expiration - [`f170a63`](https://github.com/netbirdio/netbird/commit/f170a63fe20589ebd2ea7e5ab687a7088302476f) Fix Codacy issues ### 📊 Changes **6 files changed** (+226 additions, -53 deletions) <details> <summary>View changed files</summary> 📝 `management/server/account.go` (+28 -15) 📝 `management/server/file_store.go` (+5 -0) 📝 `management/server/grpcserver.go` (+54 -14) 📝 `management/server/mock_server/account_mock.go` (+18 -0) 📝 `management/server/peer.go` (+75 -24) 📝 `management/server/peer_test.go` (+46 -0) </details> ### 📄 Description ## Describe your changes This PR adds a peer login expiration logic that requires peers created by a user to re-authenticate (re-login) after a certain threshold of time (24h by default). The Account object now has a PeerLoginExpiration property that indicates the duration after which a peer's login will expire and a login will be required. Defaults to 24h. There are two new properties added to the Peer object: LastLogin that indicates the last time peer successfully used the Login gRPC endpoint and LoginExpirationEnabled that enables/disables peer login expiration. The login expiration logic applies only to peers that were created by a user and not those that were added with a setup key. _P.S. The expiration is disabled always for now. Will be enabled in the future versions. Next PRs: HTTP Peer API will have a method to enable/disable expiration. HTTP Peer API GET Peers will return the indicator that peer's login has expired. HTTP API for system settings to globally enable/disable expiration and set expiration duration._ ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 02:06:52 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#12865