Commit graph

553 commits

Author SHA1 Message Date
Gabriel de Souza Seibel cb4b99ffcb
[NET-562] Persistent Keep Alive from node to host (#2604)
* Move PKA field from models node to host level

* Move PKA field from api models node to host level

* Adapt logic package to node->host PKA

* Adapt migration-related code to node->host PKA

* Adapt cli code to node->host PKA

* Change host PKA default to 20s

* On IfaceDelta, check for PKA on host

* On handleHostRegister, set default PKA

* Use a default PKA

* Use int64 for api host pka

* Reorder imports

* Don't use host pka in iface delta

* Fix ConvertAPIHostToNMHost

* Add swagger doc for host PKA field

* Fix swagger.yml

* Set default PKA only for new hosts

* Remove TODO comment

* Remove redundant check

* Have api-host pka be specified in seconds
2023-10-06 10:09:19 +04:00
Gabriel de Souza Seibel 23ad85bd8c
Add handler that sends MQ msg to upgrade a host (#2582) 2023-10-02 10:37:31 +04:00
Aceix bfc61fa359
session management for remote access client (#2592)
* feat(NET-584): wip: session mgmt for RAC

* feat(NET-584): session mgmt for RAC

* feat(NET-584): session mgmt for RAC

* feat(NET-584): session mgmt for RAC

* feat(NET-584): session mgmt for RAC

* feat(NET-584): session mgmt for RAC

* feat(NET-584): session mgmt for RAC

* feat(NET-584): session mgmt for RAC

* feat(NET-584): only enable if client is disabled

* feat(NET-584): check only for normal users

* feat(NET-584): fix condition
2023-10-02 08:57:58 +04:00
Matthew R Kasun cd80c03fa2
remove stunlist (#2572) 2023-09-22 11:34:13 +02:00
Abhishek K 719e0c254d
NET-551: User Mgmt Re-Design (#2547)
* add superadmin role, apis to create superadmin user

* apis to attach and remove user from remote access gateways

* add api to list user's remote client has gateway clients

* remove code related user groups

* remove networks and groups from user model

* refactor user CRUD operations

* fix network permission test

* add superadmin to authorize func

* remove user network and groups from cli

* api to transfer superadmin role

* add api to list users on a ingress gw

* restrict user access to resources on server

* deny request from remote access client if extclient is already created

* fix user tests

* fix static checks

* fix static checks

* add limits to extclient create handler

* set username to superadmin on if masterkey is used

* allow creation of extclients using masterkey

* add migration func to assign superadmin role for existing admin user

* check for superadmin on migration if users are present

* allowe masterkey to extcleint apis

* check ownerid

* format error, on jwt token verification failure return unauthorized rather than forbidden

* user update fix

* move user remote functionality to ee

* fix update user api

* security patch

* initalise ee user handlers

* allow user to use master key to update any user

* use slog

* fix auth user test

* table headers

* remove user role, it's covered in middleware

* setuser defaults fix
2023-09-01 14:27:08 +05:30
Gabriel de Souza Seibel 1a1ba1ccf4
[NET-546] Move ee code to ee package, unify ee status and terminology (#2538)
* Move ee code to ee package and unify ee status to IsPro

* Consolidate naming for paid/professional/enterprise version as "pro". Notes:

- Changes image tags
- Changes build tags
- Changes package names
- Doesn't change links to docs that mention "ee"
- Doesn't change parameters sent to PostHog that mention "ee"

* Revert docker image tag being -pro, back to -ee

* Revert go build tag being pro, back to ee

* Add build tags for some ee content

* [2] Revert go build tag being pro, back to ee

* Fix test workflow

* Add a json tag to be backwards compatible with frontend "IsEE" check

* Add a json tag for the serverconfig struct for IsEE

* Ammend json tag to Is_EE

* fix ee tags

---------

Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
2023-09-01 07:42:05 +05:30
Abhishek K 31fcc8cd6d
NET-528: add host static info to peer update (#2550)
* set isstatic field on peer update

* remove static check for peer port
2023-08-31 00:33:37 +05:30
Matthew R Kasun d366c23c63
validate dns entry does not contain whitespace (#2512) 2023-08-22 11:50:28 +05:30
Matthew R Kasun 5c38b5b2d0
migration (#2509)
* create gateways during migration

* set version for testing

* restruct migration

* debug logging

* enforce unique names for ext client names (#2476)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* prune(NET-483): remove defunct host.internetgateway field (#2487)

* don't reference host on err (#2493)

* deprecrate netclient install scripts (#2490)

* Net 500: validate network parameter passed to node endpoints (#2480)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* validate network parameter passed to node endpoints

---------

Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* NET-513 (#2492)

nm-certs.sh now requests certificate for EE and CE edition domains accordingly.

* [NET-404] Run in limited mode when ee checks fail (#2474)

* Add limited http handlers functionality to rest handler

* Export ee.errValidation (ee.ErrValidation)

* Export a fatal error handled by the hook manager

* Export a new status variable for unlicensed server

* Mark server as unlicensed when ee checks fail

* Handle license validation failures with a (re)boot in a limited state

* Revert "Export a fatal error handled by the hook manager"

This reverts commit 069c21974a8d36e889c73ad78023448d787d62a5.

* Revert "Export ee.errValidation (ee.ErrValidation)"

This reverts commit 59dbab8c79773ca5d879f28cbaf53f3dd4297b9b.

* Revert "Add limited http handlers functionality to rest handler"

This reverts commit e2f1f28facaca54713db76a588839cd2733cf673.

* Revert "Handle license validation failures with a (re)boot in a limited state"

This reverts commit 58cfbbaf522a1345aac1fa67964ebff0a6d60cd8.

* Revert "Mark server as unlicensed when ee checks fail"

This reverts commit 77c6dbdd3c9cfa6e7d6becedef6251e8617ae367.

* Handle license validation failures with a middleware

* Forbid responses if unlicensed ee and not in status api

* Remove unused func

* feat(NET-449): add sync feature to request a host pull from server (#2491)

* fix(NET-486): change client name length validation (#2498)

set limit to 5<=x<=32

* [NET-477] Pick AMB URL dynamically (#2489)

* Introduce config for environment

* Introduce func to get environment

* Choose accounts api host from environment

* Test the ee package on workflows

* Use build tag ee for license_test.go

* [Feature]: nm-quick script tackling arm TODO support (#2488)

* domain flag for auto installs

* use static servers with custom domain (#2421)

* send delete peer update always

* fix add/remove host api calls

* keep mq updates in a single go func

* move branch test logic to devops (#2443)

* handle IOT OS

* save server name to env (#2460)

* ensure branch test servers available after test runs (#2467)

* save server name to env

* free server always; add PR to discord messages

* use correct method to delete droplets (#2468)

* quick fix for the launcher

* removed exit when triggering not supported exit and removed the TODO comments related to this issue

---------

Co-authored-by: Matthew R Kasun <mkasun@nusak.ca>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* rebase conflict

* include pass and os in mirgration data

* node network ranges

* remove debugging logs

* add gateways

* use sent node

* upgrade shell script

* associate node to host during migration

* add node to host.Nodes and publish peer update

* save host outside loop

* fix script name

* simplify upgrade script

* don't migrate relays

* simplify upgrade script even more

* guard against blank address or address6

* typos

---------

Co-authored-by: Aceix <aceixsmartX@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>
Co-authored-by: Farukh Khan <farukhkhan21@gmail.com>
Co-authored-by: Gabriel de Souza Seibel <gabrielseibel1@gmail.com>
Co-authored-by: bornav <51048565+bornav@users.noreply.github.com>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
2023-08-14 23:14:10 +05:30
Farukh Khan a9a8596d71
NET-507 (#2506)
* NET-507

* Fixed server restart changing the node expiration date to the defaults.

* Removed expired nodes removal from zombie cleanup routine.

* Added a new expired nodes deletion routine which removes expired nodes every hour.

* NET-507 suggested changes

* Possible fix for zombie nodes upon node deletion from the UI.

* Suggested changes implemented for expired nodes deletion go routine.

* NET-507 typo fix

* typo fix for DeleteNode purge parameter
2023-08-10 20:27:44 +05:30
Farukh Khan 449f3f947b
Net 509 515 (#2496)
* NET-509

* External client config files with IPv6 endpoints now have the [] separating the address and port.

* NET-515

* Increased network name max length to 32

* NET-509-515

* Updated unit test for network name max length check.

* Updated extclient endpoint ip string manipulation to use sprintf

* Added proper error message for network name length more than max allowed.

* NET-515 small typo fix for error strings should not be capitalized
2023-08-08 23:17:22 +05:30
Aceix 596cc7a945
feat(NET-449): add sync feature to request a host pull from server (#2491) 2023-08-04 13:22:47 +05:30
Aceix 91859c2490
prune(NET-483): remove defunct host.internetgateway field (#2487) 2023-08-02 17:26:44 +05:30
Aceix a7914b1631
fix(NET-388): fix to update node dns toggle (#2472) 2023-07-28 21:28:36 +05:30
Abhishek K cf11169553
NET-433: Only Set Routes for NAT enabled egress GW (#2469)
* remove related fields and code

* remover metrics collection from server code

* fw update struct

* add ext client flag to metrics data

* simply nat types

* rm proxy update from cli

* remove ingress routes from firewall update

* check if egress ranges are present

* rm unused func
2023-07-28 19:44:51 +05:30
Abhishek K ab73278597
add timestamp to turn signal (#2470) 2023-07-28 09:20:43 +05:30
Abhishek K 645bc4c126
NET-447: Removed proxy related fields and code (#2459)
* remove related fields and code

* remover metrics collection from server code

* fw update struct

* add ext client flag to metrics data

* simply nat types

* rm proxy update from cli
2023-07-26 11:22:49 +05:30
Aceix f4a5520f86
Kwesi/net 326 bug client ac ls (#2462)
* feat(NET-326): return 200 [] instead of 500 when there are not network acls

* fix(NET-326): implement allow/deny client acl functions

* fix(NET-326): implement extclient acl update

* fix(NET-326): kame fixes, send peer updates
2023-07-26 10:32:54 +05:30
Abhishek K e6c6ec3b45
add egress routes info to peer update (#2452) 2023-07-14 18:49:52 +05:30
Abhishek Kondur b64cef3447 fix merge conflicts 2023-06-28 22:12:30 +05:30
Abhishek K 38454ece79
IOT-66: Single Peer update for IOT client (#2424)
* send peer update to IOT client only when it is relayed

* move node check

* send relay del update for iot client

* fix relay delete logic for iot

* set relay node to true for iot peer update

* add node addrs to peer update

* revert tag
2023-06-28 22:08:49 +05:30
Abhishek K 230e062c84
GRA-1298: License check changes, free tier limits for saas (#2418)
* set free tier limits through config

* add host limit to config

* check for host limit on free tier

* fix license validation, replace node limit with hosts

* add hosts to telemetry data

* debug init

* validate license every 1hr

* hook manager, api to fetch server usage

* hook manager, server usage api

* encode json server usage api

* update ngork url

* update license validation endpoint

* avoid setting limits on eer

* adding hotfix

* correct users limits env var

* add comments to exported funcs

---------

Co-authored-by: afeiszli <alex.feiszli@gmail.com>
2023-06-28 20:33:06 +05:30
Aceix 84617359fa
fix(NET-379): send host NAT type over api (#2423) 2023-06-28 20:23:11 +05:30
Abhishek Kondur 243cc74490 remove endpoint detection from host model 2023-06-27 22:36:24 +05:30
Abhishek K 6c2582651c
Net-137: Node relays (#2401)
* revert relays

* initial relay commit

* get relayed allowed ips

* add more relay validation checks, peer logic cleanup

* rm relayed nodes from relay node when relayed node is deleted

* fix egress updates for relayed nodes

* rm unused func

* remove  debug logs

* avoid adding egress ranges on the relayed gw node

---------

Co-authored-by: Matthew R Kasun <mkasun@nusak.ca>
2023-06-19 12:26:14 -04:00
Tobias Cudnik 94ca72e370
NET-173 Sync EndpointDetection config (#2374)
* adding serverconfig logic and variable to hosts

* - sync EndpointDetection on peerupdate
- add EndpointDetection to env config

* - endpoint detection always comes from the server
- fixed ENDPOINT_DETECTION -> NETCLIENT_ENDPOINT_DETECTION

---------

Co-authored-by: afeiszli <alex.feiszli@gmail.com>
2023-06-13 16:33:53 -04:00
Abhishek K 78e26c4673
add nodes to pull response (#2371) 2023-06-06 22:16:21 -04:00
Abhishek K 47edf65b1f
NET-186: Wg public listen port (#2344)
* fetch public listen of wg if present

* check if wg pub listen port has been changed on host update

* wg public port to host api model for visibility

* rm comment
2023-05-31 08:21:02 +05:30
Matthew R Kasun 78640f1342
Extclient NET-63x (#2286)
* model changes

* additional fields for extclient create

* add DNS to extclient config

* extclient name checks

* update extclient

* nmctl extclient

* final tweaks

* review comments

* add extclientdns to node on ingress creation

* fix to add ingress dns to api (#2296)

---------

Co-authored-by: Aceix <aceixsmartX@gmail.com>
2023-05-17 10:58:03 -04:00
Abhishek K 46acf1d336
NET-129: Turn Signal Actions (#2290)
* add signal action field

* add negotiation signal action

* typo fix

* change signal action name
2023-05-15 15:40:34 -04:00
Matthew R Kasun 13473f4dd7 review comments 2023-05-08 13:44:32 -04:00
Matthew R Kasun 3ccd81eac8 add type to APIEnrollementKey 2023-05-08 06:30:55 -04:00
Matthew R Kasun 3567811aab add type to enrollement key 2023-05-05 11:03:59 -04:00
Abhishek Kondur 423abf0fe4 add use_turn option to config,check if server is using turn 2023-04-28 14:06:28 +05:30
Abhishek Kondur 9b87a6b722 remove unused fields 2023-04-26 17:03:25 +04:00
Abhishek Kondur 9e0038f39c merge conflicts resolved 2023-04-25 11:12:22 +04:00
Matthew R Kasun 754ab44a48 Merge remote-tracking branch 'origin/develop' into GRA-1529-key-update 2023-04-19 09:48:04 -04:00
dcarns 3d82df3bc6
Merge pull request #2133 from gravitl/refactor_auto_update
Add host level auto update setting with default true
2023-04-19 09:40:56 -04:00
Abhishek Kondur 23e3c1ce29 remove unused field 2023-04-19 13:24:36 +04:00
Abhishek Kondur 3d6005b649 remove unused field on peer conf 2023-04-19 13:24:06 +04:00
Abhishek Kondur 433b61417b merge conflicts resolved 2023-04-19 13:23:06 +04:00
Abhishek Kondur aaa2211939 add server field to signal struct 2023-04-19 07:05:17 +04:00
0xdcarns 18c9bcc58f adapted sso to host registration 2023-04-17 22:23:17 -04:00
Abhishek Kondur a8e234efc9 avoid sending turn domain to client 2023-04-17 11:44:17 +04:00
Abhishek Kondur d4ceabd4b3 register host through server, add basic auth to turn apis 2023-04-17 11:21:28 +04:00
Matthew R Kasun 63552891ee refactor key updates on host basis vice node 2023-04-13 15:02:14 -04:00
Abhishek Kondur 1324b6443d add reply field to signal struct 2023-04-13 10:00:09 +04:00
Abhishek Kondur 726531af25 change relayendpoint type to str 2023-04-11 09:46:51 +04:00
Abhishek Kondur 4d223c1cdc api for signalling peer 2023-04-10 12:14:40 +04:00
Abhishek Kondur 559880f11d add nat type to peer conf 2023-04-10 11:20:51 +04:00
Abhishek Kondur 5153c471d8 add turn port to server config 2023-04-06 11:30:53 +04:00
Abhishek Kondur f54ae9ae8f turnserver registration apis 2023-04-06 08:50:34 +04:00
Abhishek Kondur b8904d1f3c Merge branch 'develop' of https://github.com/gravitl/netmaker into GRA-1494 2023-04-04 18:32:55 +04:00
Abhishek Kondur 5e8e56b56e merge conflicts resolved 2023-04-03 22:43:33 +04:00
0xdcarns 2da7d7242f remove debug items 2023-03-30 17:33:55 -04:00
0xdcarns 8f2c38b118 Merge branch 'develop' into GRA-1401/host-nattype 2023-03-30 17:27:09 -04:00
0xdcarns fa40a5929d added turn ep + nat type to host model 2023-03-30 17:23:21 -04:00
0xdcarns 63eac1e79c added host pull model, made API 2023-03-22 15:36:53 -04:00
Abhishek Kondur 851fdbfee1 add turn config to host model 2023-03-22 12:05:51 +04:00
Abhishek Kondur 91b4d237c8 add turn config to server config 2023-03-22 11:09:50 +04:00
Abhishek Kondur cafdfa70c1 turn server poc 2023-03-22 11:00:03 +04:00
0xdcarns 8f8b4c8b70 merge develop 2023-03-20 17:05:41 -04:00
0xdcarns bf687dd478 add return 2023-03-20 08:55:28 -04:00
Anish Mukherjee 6b684d95a4 add host auto updated setting with default true 2023-03-20 17:47:41 +05:30
0xdcarns 5fb3100c72 merge develop 2023-03-17 15:16:43 -04:00
afeiszli 0bbf1dbe54 hotfixing logging and model issues found during IoT testing 2023-03-16 13:41:56 -04:00
0xdcarns ac6363dda6 adjust peer updates to send ifaces with peer 2023-03-16 11:54:29 -04:00
Matthew R Kasun 8b5d194666 Merge remote-tracking branch 'origin/develop' into GRA-1375-default-proxy 2023-03-15 13:24:52 -04:00
dcarns 99cb2195a0
Merge pull request #2119 from gravitl/GRA-1369-ext-acls
GRA-1369 - added logic for ext client ACLs
2023-03-15 13:19:41 -04:00
dcarns 78b367cf0c
Merge pull request #2117 from gravitl/GRA-1388-adapt-migrate
GR-1388 adapt migrate
2023-03-15 10:55:15 -04:00
dcarns abee5e104a
Merge pull request #2116 from gravitl/GRA-1321
GRA-1321: Metrics Fix
2023-03-15 08:49:55 -04:00
0xdcarns 0f3faceb93 added logic for ext client ACLs 2023-03-14 13:39:33 -04:00
0xdcarns 11daff3f1c added iot check in mq message handlers 2023-03-14 10:46:12 -04:00
0xdcarns 0baa3a743c adapted migrate to easier registration 2023-03-14 08:44:18 -04:00
Abhishek Kondur 959ca622e3 add new field to proxy metrics 2023-03-14 06:55:25 +04:00
0xdcarns 0b7df753f7 removed references to AccessKey model 2023-03-13 16:02:44 -04:00
Matthew R Kasun b3cfbe7266 default proxy mode 2023-03-13 14:39:13 -04:00
Abhishek Kondur 178ded7572 change proxy listen port type 2023-03-13 13:13:45 +04:00
Abhishek Kondur 5daa73cd92 add proxy listen port to peerConf model 2023-03-13 12:37:51 +04:00
dcarns bcbe355281
Merge pull request #2107 from gravitl/feature_best_interface
Feature best interface
2023-03-10 19:36:56 -05:00
0xdcarns ee9df20b05 changed register response, simplified host port check dereference 2023-03-10 11:43:26 -05:00
Anish Mukherjee 83f3262a87 remove redundant interface 2023-03-10 19:07:33 +05:30
Anish Mukherjee 0891dcb854 append proxy listen port and peer host interfaces to peerID map 2023-03-10 19:01:30 +05:30
Anish Mukherjee ea6623ba3e append host interfaces to hostPeerUpdate 2023-03-09 18:40:40 +05:30
dcarns 6fc9843b90
Merge pull request #2100 from gravitl/GRA-1335-ext-client-pubkeys
GRA-1335 allowed public key input for ext clients
2023-03-08 16:19:53 -05:00
Anish Mukherjee c11ba7c44b append local addresses 2023-03-08 19:17:09 +05:30
0xdcarns 55b24c5eeb allowed public key input for ext clients 2023-03-06 15:54:50 -05:00
afeiszli d3a35d00b9 resolving PR comments 2023-03-03 16:20:38 -05:00
afeiszli bf8a5bbc69 changing StunList to slice 2023-03-03 10:28:50 -05:00
afeiszli 4ff135e196 adding StunList 2023-03-01 17:10:36 -05:00
dcarns d19f292e6c
Merge pull request #2073 from gravitl/GRA-1280-local-network
remove local network/range
2023-02-28 10:01:02 -05:00
Matthew R Kasun 828b3f7162 remove local network/range 2023-02-26 16:28:16 -05:00
0xdcarns e759637750 Merge branch 'develop' into GRA-1198 2023-02-24 11:23:41 -05:00
0xdcarns a419b24151 added node peers to return 2023-02-21 13:14:06 -05:00
0xdcarns 95013fd49a removed old peer update style 2023-02-21 10:31:37 -05:00
0xdcarns a1f5d73a58 added request ack 2023-02-17 11:39:30 -05:00
0xdcarns 6b30cef968 handled node additions in more elegant manner 2023-02-17 11:32:02 -05:00
0xdcarns bae3a5a028 Merge branch 'develop' into GRA-1198 2023-02-16 16:48:30 -05:00
0xdcarns 607198d563 added host registration endpoint 2023-02-16 14:27:57 -05:00
walkerwmanuel 442b32e0d9 Wrote test to test Enrolment Keys 2023-02-16 10:56:13 -05:00