Commit Graph

556 Commits

Author SHA1 Message Date
c65a934107 refactor to use name instead of description 2023-03-27 16:28:49 +02:00
9e74f30d2f fix delete token parameter lookup 2023-03-27 15:19:19 +02:00
a27fe4326c Add JWT middleware validation failure log (#760)
We will log the middleware log now, but in the next
releases we should provide a generic error that can be
parsed by the dashboard.
2023-03-23 18:26:41 +01:00
e6292e3124 Disable peer expiration of peers added with setup keys (#758) 2023-03-23 17:47:53 +01:00
628b497e81 Adjustments for the change server flow (#756)
Check SSO support by calling the internal.GetDeviceAuthorizationFlowInfo

Rename LoginSaveConfigIfSSOSupported to SaveConfigIfSSOSupported

Receive device name as input for setup-key login

have a default android name when no context value is provided

log non parsed errors from management registration calls
2023-03-23 16:35:06 +01:00
8f66dea11c Add Keycloak Idp Manager (#746)
Added intergration with keycloak user API.
2023-03-23 14:54:31 +01:00
de8608f99f add rest endpoints and update openapi doc 2023-03-21 16:02:19 +01:00
8e4710763e use single line return for SaveAccount 2023-03-21 14:02:34 +01:00
82af60838e use "ok" convention for check variables throughout files_store 2023-03-21 14:00:59 +01:00
311b67fe5a change error messages 2023-03-21 13:56:31 +01:00
94d39ab48c improve style for tests 2023-03-21 13:34:48 +01:00
41a47be379 add function comments, implement account mock functions and added error handling in tests 2023-03-20 16:38:17 +01:00
e30def175b switch PATs to map and add deletion 2023-03-20 16:14:55 +01:00
e1ef091d45 remove unnecessary string conversion 2023-03-20 12:08:01 +01:00
511ba6d51f Delete pat_handler.go 2023-03-20 11:47:54 +01:00
b852198f67 codacy and lint hints 2023-03-20 11:44:12 +01:00
628a201e31 fix PAT array split 2023-03-16 16:59:32 +01:00
453643683d add method to account mock 2023-03-16 16:44:05 +01:00
b8cab2882b storing and retrieving PATs 2023-03-16 15:57:44 +01:00
3b42d5e48a fix imports after merge 2023-03-16 11:59:12 +01:00
f8db5742b5 Merge branch 'main' into feature/add_PAT_generation 2023-03-16 11:36:43 +01:00
bc3cec23ec use slice copy 2023-03-16 11:32:55 +01:00
292ee260ad Add version info command to signal server (#739)
Add version command to signal and management servers.

The version information will be filled during build time.
2023-03-15 07:54:51 +01:00
2a1efbd0fd Don't drop Rules from file storage after migration to Policies (#741)
Rego policy migration clears the rules property of the file storage, but it does not allow rollback management upgrade, so this changes pre-saves rules in the file store and updates it from the policies.
2023-03-15 09:42:40 +04:00
3bfa26b13b Feat rego default policy (#700)
Converts rules to Rego policies and allow users to write raw policies to set up connectivity and firewall on the clients.
2023-03-13 18:14:18 +04:00
221934447e Send remote agents updates when peer re-authenticates (#737)
When peer login expires, all remote peers are updated to exclude the peer from connecting.
Once a peer re-authenticates, the remote peers are not updated.
This peer fixes the behavior.
2023-03-10 17:39:29 +01:00
9ce8056b17 Use global login expiration setting when sending network map (#731)
Peers were considered expired and not sent to remote peers
when global expiration was disabled.
2023-03-09 11:24:42 +01:00
62de082961 fix account test 2023-03-08 12:21:44 +01:00
c4d9b76634 add comment for exported const 2023-03-08 12:09:22 +01:00
b4bb5c6bb8 use const and do array copy 2023-03-08 11:54:10 +01:00
2b1965c941 switch secret generation to use lib 2023-03-08 11:36:03 +01:00
83e7e30218 store hashedToken as string 2023-03-08 11:30:09 +01:00
ed4f90b6aa Report offline peers to agents (#728)
The peer login expiration ACL check introduced in #714
filters out peers that are expired and agents receive a network map 
without that expired peers.
However, the agents should see those peers in status "Disconnected".

This PR extends the Agent <-> Management protocol 
by introducing a new field OfflinePeers
that contain expired peers. Agents keep track of those and display 
then just in the Status response.
2023-03-07 10:17:25 +01:00
ed470d7dbe add comments for exported functions 2023-03-06 14:46:04 +01:00
cb8abacadd extend User Copy function 2023-03-06 14:01:18 +01:00
bcac5f7b32 fixed some namings 2023-03-06 13:51:32 +01:00
95d87384ab fixed some namings 2023-03-06 13:49:07 +01:00
e914adb5cd Move Login business logic from gRPC API to Accountmanager (#713)
The Management gRPC API has too much business logic 
happening while it has to be in the Account manager.
This also needs to make more requests to the store 
through the account manager.
2023-03-03 18:35:38 +01:00
2f2d45de9e updated PAT struct to only use user id instead of user 2023-03-03 16:37:39 +01:00
b3f339c753 improved code for token checksum calc 2023-03-03 14:51:33 +01:00
e0fc779f58 add id to the PAT 2023-03-02 16:19:31 +01:00
fe22eb3b98 Check peer expiration after ACL check (#714)
Bug 1: When calculating the network map, peers added by a setup key
were falling under expiration logic while they shouldn't.

Bug 2: Peers HTTP API didn't return expired peers for non-admin users
because of the expired peer check in the ACL logic.

The fix applies peer expiration checks outside of the ACL logic.
2023-03-02 12:45:10 +01:00
69be2a8071 add generating token (only frame for now, actual token is only dummy) 2023-03-01 20:12:04 +01:00
1bda8fd563 Remove stale peer indices when getting peer by key after removing (#711)
When we delete a peer from an account, we save the account in the file store.
The file store maintains peerID -> accountID and peerKey -> accountID indices.
Those can't be updated when we delete a peer because the store saves the whole account
without a peer already and has no access to the removed peer.
In this PR, we dynamically check if there are stale indices when GetAccountByPeerPubKey
and GetAccountByPeerID.
2023-03-01 12:11:32 +01:00
1ab791e91b Merge pull request #707 from netbirdio/chore/NB-93-re-arrange-api-code
chore/re-arrange-api-code
2023-03-01 09:52:42 +01:00
41948f7919 Fix peer status update when expiring peers (#708) 2023-02-28 20:02:30 +01:00
60f67076b0 change methods to not link 2023-02-28 18:17:55 +01:00
c645171c40 split api code into smaller pieces 2023-02-28 18:08:02 +01:00
8a130ec3f1 add comments to fix codacy 2023-02-28 16:51:30 +01:00
c26cd3b9fe add comments for constructors and fix typo 2023-02-28 15:46:08 +01:00