Commit graph

37 commits

Author SHA1 Message Date
Abhishek K
5849e0e2e1
NET-1932: sort out acls into CE and PRO (#3460)
* move relevant acl and tag code to CE and Pro pkgs

* intialise pro acl funcs

* list gateways by user access

* check user gw access by policies

* filter out user policies on CE

* filter out tagged policies on CE

* fix ce acl comms

* allow gateways tag

* allow gateway tag  on CE, remove failover and gw check on acl policy

* add gw rules func to pro

* add inet gw support on CE

* add egress acl API

* add egress acl API

* fix(go): set is_gw when converting api node to server node;

* fix(go): set is_gw when converting api node to server node;

* fix policy validity checker for inet gws

* move dns option to host model

* fix node removal from egress policy on delete

* add migration logic for ManageDNS

* fix dns json field

* fix nil error on node tags

* add egress info to relayed nodes

---------

Co-authored-by: Vishal Dalwadi <dalwadivishal26@gmail.com>
2025-06-02 13:05:10 +05:30
Abhishek K
307a3d1e4b
NET-1932: Merge egress and internet gateways (#3436)
* feat: api access tokens

* revoke all user tokens

* redefine access token api routes, add auto egress option to enrollment keys

* add server settings apis, add db table for settigs

* handle server settings updates

* switch to using settings from DB

* fix sever settings migration

* revet force migration for settings

* fix server settings database write

* egress model

* fix revoked tokens to be unauthorized

* update egress model

* remove unused functions

* convert access token to sql schema

* switch access token to sql schema

* fix merge conflicts

* fix server settings types

* bypass basic auth setting for super admin

* add TODO comment

* setup api handlers for egress revamp

* use single DB, fix update nat boolean field

* extend validaiton checks for egress ranges

* add migration to convert to new egress model

* fix panic interface conversion

* publish peer update on settings update

* revoke token generated by an user

* add user token creation restriction by user role

* add forbidden check for access token creation

* revoke user token when group or role is changed

* add default group to admin users on update

* chore(go): import style changes from migration branch;

1. Singular file names for table schema.
2. No table name method.
3. Use .Model instead of .Table.
4. No unnecessary tagging.

* remove nat check on egress gateway request

* Revert "remove nat check on egress gateway request"

This reverts commit 0aff12a189.

* remove nat check on egress gateway request

* feat(go): add db middleware;

* feat(go): restore method;

* feat(go): add user access token schema;

* add inet gw status to egress model

* fetch node ids in the tag, add inet gw info clients

* add inet gw info to node from egress list

* add migration logic internet gws

* create default acl policies

* add egress info

* add egress TODO

* add egress TODO

* fix user auth api:

* add reference id to acl policy

* add egress response from DB

* publish peer update on egress changes

* re initalise oauth and email config

* set verbosity

* normalise cidr on egress req

* add egress id to acl group

* change acls to use egress id

* resolve merge conflicts

* fix egress reference errors

* move egress model to schema

* add api context to DB

* sync auto update settings with hosts

* sync auto update settings with hosts

* check acl for egress node

* check for egress policy in the acl dst groups

* fix acl rules for egress policies with new models

* add status to egress model

* fix inet node func

* mask secret and convert jwt duration to minutes

* enable egress policies on creation

* convert jwt duration to minutes

* add relevant ranges to inet egress

* skip non active egress routes

* resolve merge conflicts

* fix static check

* update gorm tag for primary key on egress model

* create user policies for egress resources

* resolve merge conflicts

* get egress info on failover apis, add egress src validation for inet gws

* add additional validation checks on egress req

* add additional validation checks on egress req

* skip all resources for inet policy

* delete associated egress acl policies

* fix failover of inetclient

* avoid setting inet client asd inet gw

* fix all resource egress policy

* fix inet gw egress rule

* check for node egress on relay req

* fix egress acl rules comms

* add new field for egress info on node

* check acl policy in failover ctx

* avoid default host to be set as inet client

* fix relayed egress node

* add valid error messaging for egress validate func

* return if inet default host

* jump port detection to 51821

* check host ports on pull

* check user access gws via acls

* add validation check for default host and failover for inet clients

* add error messaging for acl policy check

* fix inet gw status

* ignore failover req for peer using inet gw

* check for allowed egress ranges for a peer

* add egress routes to static nodes by access

* avoid setting failvoer as inet client

* fix egress error messaging

* fix extclients egress comms

* fix inet gw acting as inet client

* return formatted error on update acl validation

* add default route for static nodes on inetclient

* check relay node acting as inetclient

* move inet node info to separate field, fix all resouces policy

* remove debug logs

---------

Co-authored-by: Vishal Dalwadi <dalwadivishal26@gmail.com>
2025-05-21 12:50:21 +05:30
abhishek9686
7e0ff17420 validate egress ranges with metric 2025-03-03 11:33:46 +04:00
Abhishek K
48535f7ef1
NET-1956: Async Node Status API (#3341)
* add node status api

* upsate node status api to return map data

* resolve merge conflicts
2025-02-24 08:48:24 +03:00
Yabin Ma
1d9e0f71df
add format int64 for swagger doc (#3247)
* add format int64 for swagger doc

* add format int64 for swagger doc

* add global override

* swagger doc update

* add new line for .swaggo file
2024-12-12 09:52:52 +04:00
Abhishek K
31c2311bef
NET-1782: Fetch Node Connection Status from metrics (#3237)
* add live status of node

* handle static node status

* add public IP field to server configuration

* get public Ip from config

* improve node status logic

* improvise status check

* use only checkin status on old nodes

---------

Co-authored-by: the_aceix <aceixsmartx@gmail.com>
2024-12-10 10:46:05 +04:00
abhishek9686
6c1208ad81 resolve merge conflicts 2024-10-17 15:15:54 +04:00
abhishek9686
6ccafe82ed set static nodes to list 2024-10-15 19:36:46 +04:00
abhishek9686
04b8737a02 move tags to node model 2024-09-22 13:37:58 +04:00
Max Ma
189ac27527
NET-1509:add ingresspersistentkeepalive and ingressmtu for extClient/RAC config (#3107)
* add ingresspersistentkeepalive and ingressmtu for extClient/RAC config

* add ingressmtu and PKA in api response

* add pka and mtu in api/nodes PUT call

* add default value for PKA and mtu for extClients
2024-09-12 12:19:27 +04:00
Aceix
2de3fde872
fix(NET-1280): remove RAG metadata length restriction (#2990) 2024-07-05 15:54:05 +05:30
Aceix
abf3f4f55d
feat(NET-1106): support additional RAG endpoint IPs (#2907) 2024-05-08 14:45:05 +05:30
Abhishek K
0638dcac49
NET-940: Inet Gws (#2828)
* internet gws apis

* add validate check for inet request

* add default gw changes to peer update

* update json tag

* add OS checks for inet gws

* add set defaul gw pro func

* allow disable and enable inet gw

* add inet handlers to pro

* add fields to api node

* add inet allowed ips

* add default gw to pull

* unset node inet details on deletion

* unset internet gw on network nodes

* unset inet gw fix

* unset inet gw fix

* send default gw ip

* fix inet node endpoint

* add default gw endpoint ip to pull resp

* validate after unset gws

* add inet client peer allowedips to inet node

* validate after unset gws

* fix allowed ips for inet peer and gw node

* fix allowed ips for inet peer and gw node

* fix allowed ips for inet peer and gw node

* fix allowed ips for inet peer and gw node

* fix inet gw and relayed conflict

* fix inet gw and relayed conflict

* fix update req

* fix update inet gw api

* when inet gw is peer ignore other allowedIps

* test relay

* revert test relay

* revert inet peer update changes

* channel internet traffic of relayed node to relay's inetgw

* channel internet traffic of relayed node to relay's inetgw

* channel internet traffic of relayed node to relay's inetgw

* add check for relayed node

* add inet info to peer update

* add inet info to peer update

* fix update node to persist inet info

* fix go tests

* egress ranges with inet gw fix

* egress ranges with inet gw fix

* disallow node acting using inet gw to act as inet gw

* add check to validate inet gw

* fix typos

* add firewall check

* set inetgw on ingress req on community

* set inetgw to false on community on ingress del
2024-02-28 08:46:51 +07:00
the_aceix
5882b86d40 feat(NET-709): add node metadata for remote gws 2024-01-26 10:06:36 +00:00
Abhishek K
530dbdc65c
NET-710: Internet Gws Re-Design (#2718)
* add internet gateway to client gateway

* migration func to remove internet egress range from egress gateway

* add internet gateways ranges to firewall update

* add internet gw ranges to extcleint conf

* add ipv6 internet address

* remove failover field from ingress req

* only let normal to be created on PRO (#2716)

* feat(NET-805): send internet gw props to rac

* set inet gw field on node update api

* move internet gws to EE

---------

Co-authored-by: the_aceix <aceixsmartx@gmail.com>
2023-12-06 23:57:58 +04:00
Abhishek K
b78cc0a8a1
NET-725: Failovers (#2685)
* api to  to get host relayed from client

* add auto relay to api host

* add peer nat type

* set pro field on signal

* rm net check on relay me handler

* return success response

* re-establish failover logic

* set failOver ctx

* failOver with peer pub key

* failovered peer updates

* failover handlers, reset failovered peer on deletion

* rm unused funcs

* initialize failover handler on EE

* ignore failover node on signal

* failover changes

* set host id on signal

* extend signal model to include node ids

* add backwards compatibility

* add failover as node api

* set json response on failover handers

* add failover field to api node

* fix signal data check

* initialize failover peer map

* reset failovered status when relayed or deleted

* add failover info to api node

* reset network failover

* only proceed furtuer if failover exists in the network

* set failOver node defaults

* cannot set failover node as relayed

* debug log

* debug log

* debug changes

* debug changes

* debug changes

* revert debug changes

* don't add peers to idmap when removed

* reset failed Over

* fix static checks

* rm debug log

* add check for linux host
2023-11-29 20:10:07 +04:00
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
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
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
Matthew R Kasun
828b3f7162 remove local network/range 2023-02-26 16:28:16 -05:00
0xdcarns
2f556dbcba disallowed updating of egress ranges 2023-02-09 10:27:38 -05:00
Matthew R Kasun
77cfae41ff remove postup/down 2023-02-02 11:16:54 -05:00
Anish Mukherjee
b926d393be fix node ipv6 address update 2023-01-27 10:01:54 +05:30
Aceix
bb0956f85f fix(GRA-1062): fix node expdate update 2023-01-26 14:08:02 +00:00
Aceix
a2ab933f89 fix(GRA-995): fix for update node address check 2023-01-17 10:04:12 +00:00
Abhishek Kondur
bff68bd945 rm peers from node model 2023-01-05 14:56:20 +05:30
Abhishek Kondur
2ff8684fd4 keep node level peers for now 2023-01-05 09:42:41 +05:30
Abhishek Kondur
72e4b914b9 move peers to host level 2023-01-05 09:24:46 +05:30
0xdcarns
f1f164cf35 fix host ID return for API 2023-01-03 14:17:36 -05:00
Abhishek Kondur
8a9241d5e2 fix keepalive conversion type 2022-12-30 11:43:48 +05:30
Matthew R Kasun
a371b7ae21
Merge branch 'netclient_refactor_latest' into GRA-824-getPeerUpdate 2022-12-23 15:59:55 -05:00
0xdcarns
368d01ff10 removed localaddress 2022-12-23 14:06:39 -05:00
Matthew R. Kasun
eae92470c5 refactor of peerUpdate
contains some debugging logging
2022-12-23 13:41:17 -05:00
0xdcarns
8f8335aa4f finished model conversion 2022-12-21 14:06:33 -05:00
0xdcarns
e92f524fbe finished convert api to nm node 2022-12-21 11:56:29 -05:00
Aceix
d1c51aed24 tech(GRA-823): address comments 2022-12-21 10:17:20 -05:00
Aceix
dcad50d0ee tech(GRA-823): add node DTO 2022-12-21 10:17:20 -05:00