Documentation
¶
Index ¶
- Variables
- func AddGlobalGroupOnRoleUpgrade(oldRole, newRole schema.UserRoleID, groups map[schema.UserGroupID]struct{})
- func AddGlobalNetRolesToAdmins(u *schema.User)
- func AddPostureCheckHook(ctx context.Context)
- func AddStaticNodesWithTag(ctx context.Context, tag models.Tag, nMap map[string]models.Node) map[string]models.Node
- func AddTagMapWithStaticNodes(ctx context.Context, netID schema.NetworkID, ...) map[models.TagID][]models.Node
- func AddTagMapWithStaticNodesWithUsers(ctx context.Context, netID schema.NetworkID, ...) map[models.TagID][]models.Node
- func ApproveJITRequest(ctx context.Context, requestID string, expiresAt time.Time, approvedBy string) (*schema.JITGrant, *schema.JITRequest, error)
- func AssignVirtualRangeToEgress(nw *schema.Network, eg *schema.Egress) error
- func CanUserCreateNetwork(ctx context.Context, username string) bool
- func CheckAutoRelayCtx(autoRelayNode, victimNode, peerNode models.Node) error
- func CheckIDSyntax(id string) error
- func CheckIfAnyPolicyisUniDirectional(targetNode models.Node, acls []models.Acl) bool
- func CheckIfTagAsActivePolicy(ctx context.Context, tagID models.TagID, netID schema.NetworkID) bool
- func CheckJITAccess(ctx context.Context, networkID, userID string) (bool, *schema.JITGrant, error)
- func CheckPeerStatus(ctx context.Context, node *models.Node, defaultAclPolicy bool, ...)
- func CheckPostureViolations(ctx context.Context, d models.PostureCheckDeviceInfo, network schema.NetworkID) ([]models.Violation, schema.Severity)
- func CheckPostureViolationsForHost(ctx context.Context, host *schema.Host, tags map[models.TagID]struct{}, ...) ([]models.Violation, schema.Severity)
- func CheckUIHostReadAccess(r *http.Request, host *schema.Host) error
- func CleanupFlows() error
- func CleanupGwsMigration(ctx context.Context)
- func CountryNameFromISO(code string) string
- func CreateAutoRelay(node models.Node) error
- func CreateDefaultNetworkRolesAndGroups(ctx context.Context, netID schema.NetworkID, username string)
- func CreateDefaultTags(ctx context.Context, netID schema.NetworkID)
- func CreateDefaultUserPolicies(ctx context.Context, netID schema.NetworkID)
- func CreateJITRequest(ctx context.Context, networkID, userName, reason string) (*schema.JITRequest, error)
- func CreateUserGroup(ctx context.Context, g *schema.UserGroup) error
- func DeactivateUserGrantsOnNetwork(ctx context.Context, networkID, userID string) error
- func DefaultRoleForScope(s scope.Scope) schema.UserRoleID
- func DeleteAllNetworkTags(ctx context.Context, networkID schema.NetworkID)
- func DeleteAndCleanUpGroup(group *schema.UserGroup) error
- func DeleteMetrics(ctx context.Context, nodeid string) error
- func DeleteNetworkRoles(ctx context.Context, netID string)
- func DeleteNodeMetricsFromPeers(ctx context.Context, nodeID string)
- func DeleteRole(ctx context.Context, rid schema.UserRoleID, force bool) error
- func DeleteTag(ctx context.Context, tagID models.TagID, removeFromPolicy bool) error
- func DenyJITRequest(requestID string, deniedBy string) (*schema.JITRequest, error)
- func DisableJITOnNetwork(ctx context.Context, networkID string) error
- func DisconnectExtClientsFromNetwork(ctx context.Context, networkID string) error
- func DisconnectExtClientsFromNetworkForScope(ctx context.Context, network *schema.Network) error
- func DisconnectUserExtClientsFromNetwork(ctx context.Context, networkID, userID string) error
- func DisconnectUserHostNodesFromNetwork(ctx context.Context, networkID, userID string) error
- func DoesAutoRelayExist(ctx context.Context, network string) (autoRelayNodes []models.Node)
- func EnableJITOnNetwork(ctx context.Context, networkID string, jitUserGroupIDs []schema.UserGroupID) error
- func EnsureDefaultUserGroupNetworkPolicies(ctx context.Context, old, new *schema.UserGroup) error
- func EventRetentionHook() error
- func EventWatcher()
- func ExpireJITGrants() error
- func FilterNetworksByRole(ctx context.Context, allnetworks []schema.Network, user *schema.User) []schema.Network
- func GetAccountsHost() string
- func GetAccountsUIHost() string
- func GetAnyRole(ctx context.Context, id schema.UserRoleID) (*schema.UserRole, error)
- func GetAutoRelayNode(network string, allNodes []models.Node) (models.Node, error)
- func GetAutoRelayPeerIps(ctx context.Context, peer, node *models.Node) []net.IPNet
- func GetDefaultGlobalAdminGroupID() schema.UserGroupID
- func GetDefaultGlobalAdminRoleID() schema.UserRoleID
- func GetDefaultGlobalUserGroupID() schema.UserGroupID
- func GetDefaultGlobalUserRoleID() schema.UserRoleID
- func GetDefaultGroupAclName(groupName string) string
- func GetDefaultNetworkAdminGroupID(networkID schema.NetworkID) schema.UserGroupID
- func GetDefaultNetworkAdminRoleID(networkID schema.NetworkID) schema.UserRoleID
- func GetDefaultNetworkUserGroupID(networkID schema.NetworkID) schema.UserGroupID
- func GetDefaultNetworkUserRoleID(networkID schema.NetworkID) schema.UserRoleID
- func GetDeploymentMode() string
- func GetEgressUserRulesForNode(ctx context.Context, targetnode *models.Node, rules map[string]models.AclRule) map[string]models.AclRule
- func GetFilteredNodesByUserAccess(user *schema.User, nodes []models.Node) (filteredNodes []models.Node)
- func GetFwRulesForNodeAndPeerOnGw(node, peer models.Node, allowedPolicies []models.Acl) (rules []models.FwRule)
- func GetFwRulesForUserNodesOnGw(ctx context.Context, node models.Node, nodes []models.Node) (rules []models.FwRule)
- func GetGroupNetworksMap(ctx context.Context, g *schema.UserGroup) (map[schema.NetworkID]schema.Network, error)
- func GetMetrics(ctx context.Context, nodeid string) (*models.Metrics, error)
- func GetNameserversForHost(ctx context.Context, h *schema.Host) (returnNsLi []models.Nameserver)
- func GetNameserversForNode(ctx context.Context, node *models.Node) (returnNsLi []models.Nameserver)
- func GetNetworkAdmins(ctx context.Context, networkID string) ([]schema.User, error)
- func GetNetworkIngresses(ctx context.Context, network string) ([]models.Node, error)
- func GetNodeIDsWithTag(ctx context.Context, tagID models.TagID) (ids []string)
- func GetNodeStatus(ctx context.Context, node *models.Node, defaultEnabledPolicy bool)
- func GetNodesWithTag(ctx context.Context, tagID models.TagID) map[string]models.Node
- func GetPostureCheckDeviceInfoByNode(ctx context.Context, node *models.Node) models.PostureCheckDeviceInfo
- func GetPostureCheckDeviceInfoForHost(host *schema.Host, tags map[models.TagID]struct{}, skipAutoUpdate bool, ...) models.PostureCheckDeviceInfo
- func GetPostureCheckViolations(ctx context.Context, checks []schema.PostureCheck, ...) ([]models.Violation, schema.Severity)
- func GetSaaSNMUIHost() string
- func GetSaaSNMUIHostWithVersion() string
- func GetStaticNodeWithTag(ctx context.Context, tagID models.TagID) map[string]models.Node
- func GetTag(ctx context.Context, tagID models.TagID) (models.Tag, error)
- func GetTagMapWithNodes(ctx context.Context) (tagNodesMap map[models.TagID][]models.Node)
- func GetTagMapWithNodesByNetwork(ctx context.Context, netID schema.NetworkID, withStaticNodes bool) (tagNodesMap map[models.TagID][]models.Node)
- func GetUserAclRulesForNode(ctx context.Context, targetnode *models.Node, rules map[string]models.AclRule) map[string]models.AclRule
- func GetUserGroup(ctx context.Context, gid schema.UserGroupID) (schema.UserGroup, error)
- func GetUserGroupsInNetwork(ctx context.Context, netID schema.NetworkID) (networkGrps map[schema.UserGroupID]schema.UserGroup)
- func GetUserGrpMap() map[schema.UserGroupID]map[string]struct{}
- func GetUserRAGNodes(ctx context.Context, user *schema.User) (gws map[string]models.Node)
- func HandleExporterIntegrationPull(_ mqtt.Client, _ mqtt.Message)
- func InitAutoRelayCache()
- func InsertTag(ctx context.Context, tag models.Tag) error
- func IsAclPolicyValid(ctx context.Context, acl models.Acl) (err error)
- func IsGroupValid(ctx context.Context, groupID schema.UserGroupID) error
- func IsGroupsValid(ctx context.Context, groups map[schema.UserGroupID]struct{}) error
- func IsNetworkAdmin(ctx context.Context, user *schema.User, networkID string) bool
- func IsNetworkRolesValid(ctx context.Context, ...) error
- func IsPeerAllowed(ctx context.Context, node, peer models.Node, checkDefaultPolicy bool) bool
- func IsUserAllowedToCommunicate(ctx context.Context, userName string, peer models.Node) (bool, []models.Acl)
- func ListNetworkTags(ctx context.Context, netID schema.NetworkID) ([]models.Tag, error)
- func ListTagsWithNodes(ctx context.Context, netID schema.NetworkID) ([]models.TagListResp, error)
- func LoadNodeMetricsToCache(ctx context.Context) error
- func LogEvent(ctx context.Context, a *models.Event)
- func MQUpdateMetrics(client mqtt.Client, msg mqtt.Message)
- func MQUpdateMetricsFallBack(ctx context.Context, nodeid string, newMetrics models.Metrics)
- func MergePostureCheckUpdate(existing, update *schema.PostureCheck)
- func NetworkPermissionsCheck(username string, r *http.Request) error
- func OrgPermissionsCheck(username string, r *http.Request) error
- func PlatformRoleRequiresGroupEnforcement(role schema.UserRoleID) bool
- func PopulatePostureCheckGroupNames(ctx context.Context, pcs []schema.PostureCheck)
- func PrepareOauthUserFromInvite(ctx context.Context, in *schema.UserInvite) (schema.User, error)
- func PublishCollectMetrics(hostID, nodeID, reason string)
- func PushToSIEM()
- func RemoveAutoRelayFromCache(network string)
- func RemoveDeviceTagFromAclPolicies(ctx context.Context, tagID models.TagID, netID schema.NetworkID) error
- func RemoveTagFromEgress(net schema.NetworkID, tagID models.TagID)
- func RemoveTagFromNameservers(tagID models.TagID, netID schema.NetworkID) error
- func RemoveTagFromPostureChecks(tagID models.TagID, netID schema.NetworkID)
- func RemoveUserFromAclPolicy(ctx context.Context, userName string)
- func RemoveUserGroupFromAllJITScopes(ctx context.Context, groupID schema.UserGroupID) error
- func RemoveUserGroupFromNetworkJITScope(ctx context.Context, networkID string, groupID schema.UserGroupID) error
- func RemoveUserGroupFromPostureChecks(grpID schema.UserGroupID, netID schema.NetworkID)
- func RemoveUserJITNetworkAccess(ctx context.Context, networkID, userID string) error
- func ResetAutoRelay(ctx context.Context, autoRelayNode *models.Node) error
- func ResetAutoRelayedPeer(ctx context.Context, autoRelayedNode *models.Node) error
- func RunPostureChecks() error
- func RunPostureChecksForTenant(ctx context.Context) error
- func SetAutoRelay(node *models.Node)
- func SetAutoRelayCtx(autoRelayNode, victimNode, peerNode models.Node) error
- func SetAutoRelayInCache(node models.Node)
- func SetDeploymentMode(deploymentMode string)
- func SetPeerMetricsDisconnected(ctx context.Context, nodeID string)
- func SkipPushToSiem()
- func SortTagEntrys(tags []models.TagListResp)
- func StartFlowCleanupLoop()
- func StopFlowCleanupLoop()
- func StripGroupsOnRoleDowngrade(oldRole, newRole schema.UserRoleID, groups map[schema.UserGroupID]struct{})
- func TenantPermissionsCheck(username string, r *http.Request) error
- func UpdateDeviceTag(ctx context.Context, OldID, newID models.TagID, netID schema.NetworkID)
- func UpdateJITUserGroupsOnNetwork(ctx context.Context, networkID string, jitUserGroupIDs []schema.UserGroupID) error
- func UpdateMetrics(ctx context.Context, nodeid string, metrics *models.Metrics) error
- func UpdateTag(ctx context.Context, req models.UpdateTagReq, newID models.TagID)
- func UpdateUserGroup(ctx context.Context, g schema.UserGroup) error
- func UpdateUserGwAccess(ctx context.Context, currentUser, changeUser *schema.User)
- func UpdatesUserGwAccessOnGrpUpdates(ctx context.Context, groupID schema.UserGroupID, ...)
- func UpdatesUserGwAccessOnRoleUpdates(ctx context.Context, ...)
- func UpsertTag(ctx context.Context, tag models.Tag) error
- func UserGroupsInit(ctx context.Context)
- func UserHasDeviceNetworkWriteAccess(ctx context.Context, user *schema.User, network string) bool
- func UserHasGlobalNetworksAdminMembership(user *schema.User) bool
- func UserHasNetworkGroupAccess(ctx context.Context, user *schema.User, networkID string) bool
- func UserNetworkRolesInit(ctx context.Context)
- func UserRolesInit()
- func UserSubjectToNetworkJIT(ctx context.Context, networkID string, user *schema.User) bool
- func ValidateCreateGroupReq(ctx context.Context, g schema.UserGroup) error
- func ValidateEgressReq(ctx context.Context, e *schema.Egress) error
- func ValidateNameserverReq(ctx context.Context, ns *schema.Nameserver) error
- func ValidatePostureCheck(ctx context.Context, pc *schema.PostureCheck) error
- func ValidateUpdateGroupReq(ctx context.Context, new schema.UserGroup) error
- type EDRComplianceConfig
- type JITRequestWithGrant
- type JITStatusResponse
- type MDMComplianceConfig
- type UserJITNetworkStatus
Constants ¶
This section is empty.
Variables ¶
var AuditorUserPermissionTemplate = schema.UserRole{ ID: schema.Auditor, Default: true, DenyDashboardAccess: false, TenantGlobalAccess: false, NetworkLevelAccess: datatypes.NewJSONType(schema.ResourceAccess{ schema.NetworkRsrc: { schema.AllNetworkRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, }), }
var DeploymentMode string
var EventActivityCh = make(chan models.Event, 100)
var NetworkAdminAllPermissionTemplate = schema.UserRole{ ID: globalNetworksAdminRoleID, Name: "Network Admins", MetaData: "can manage configuration of all networks", Default: true, TenantGlobalAccess: true, NetworkID: schema.AllNetworks, }
var NetworkUserAllPermissionTemplate = schema.UserRole{ ID: globalNetworksUserRoleID, Name: "Network Users", MetaData: "Can connect to nodes in your networks via Netmaker Desktop App.", Default: true, TenantGlobalAccess: false, NetworkID: schema.AllNetworks, NetworkLevelAccess: datatypes.NewJSONType(schema.ResourceAccess{ schema.HostRsrc: { schema.AllHostRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.RemoteAccessGwRsrc: { schema.AllRemoteAccessGwRsrcID: schema.RsrcPermissionScope{ Read: true, VPNaccess: true, }, }, schema.ExtClientsRsrc: { schema.AllExtClientsRsrcID: schema.RsrcPermissionScope{ Read: true, Create: true, Update: true, Delete: true, SelfOnly: true, }, }, schema.DnsRsrc: { schema.AllDnsRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.AclRsrc: { schema.AllAclsRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.EgressGwRsrc: { schema.AllEgressGwRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.InetGwRsrc: { schema.AllInetGwRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.RelayRsrc: { schema.AllRelayRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.TagRsrc: { schema.AllTagsRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.PostureCheckRsrc: { schema.AllPostureCheckRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.NameserverRsrc: { schema.AllNameserverRsrcID: schema.RsrcPermissionScope{ Read: true, }, }, schema.JitUserRsrc: { schema.AllJitUserRsrcID: schema.RsrcPermissionScope{ Read: true, Create: true, Update: true, Delete: true, SelfOnly: true, }, }, }), }
var PlatformUserUserPermissionTemplate = schema.UserRole{ ID: schema.PlatformUser, Default: true, TenantGlobalAccess: false, }
var ServiceUserPermissionTemplate = schema.UserRole{ ID: schema.ServiceUser, Default: true, TenantGlobalAccess: false, DenyDashboardAccess: true, }
Functions ¶
func AddGlobalGroupOnRoleUpgrade ¶
func AddGlobalGroupOnRoleUpgrade(oldRole, newRole schema.UserRoleID, groups map[schema.UserGroupID]struct{})
AddGlobalGroupOnRoleUpgrade assigns the global all-networks admin group when a user is upgraded to admin or super-admin from a non-elevated role and has no groups.
func AddGlobalNetRolesToAdmins ¶
AddGlobalNetRolesToAdmins assigns the global networks admin group only when an admin or super-admin has no groups (e.g. create/migrate). It does not run on update so callers can remove all group membership from elevated users.
func AddPostureCheckHook ¶
func AddStaticNodesWithTag ¶
func ApproveJITRequest ¶
func ApproveJITRequest(ctx context.Context, requestID string, expiresAt time.Time, approvedBy string) (*schema.JITGrant, *schema.JITRequest, error)
ApproveJITRequest - approves a JIT request and creates a grant
func CanUserCreateNetwork ¶
CanUserCreateNetwork reports whether the user can create a network via POST /api/networks.
func CheckAutoRelayCtx ¶
func CheckIDSyntax ¶
func CheckJITAccess ¶
CheckJITAccess - checks if a user has active JIT access for a network
func CheckPeerStatus ¶
func CheckPostureViolations ¶
func CheckPostureViolationsForHost ¶ added in v1.7.0
func CheckPostureViolationsForHost( ctx context.Context, host *schema.Host, tags map[models.TagID]struct{}, network schema.NetworkID, skipAutoUpdate bool, ) ([]models.Violation, schema.Severity)
CheckPostureViolationsForHost refreshes MDM/EDR snapshots for the host and evaluates network posture checks. Use this for registration and join flows instead of building PostureCheckDeviceInfo without integration state.
func CheckUIHostReadAccess ¶ added in v1.7.0
CheckUIHostReadAccess ensures a dashboard user may read posture data for a host by verifying network-scoped host read permission on at least one host network.
func CleanupFlows ¶
func CleanupFlows() error
func CleanupGwsMigration ¶
func CountryNameFromISO ¶
func CreateAutoRelay ¶
func CreateJITRequest ¶
func CreateJITRequest(ctx context.Context, networkID, userName, reason string) (*schema.JITRequest, error)
CreateJITRequest - creates a new JIT access request
func CreateUserGroup ¶
CreateUserGroup - creates new user group
func DeactivateUserGrantsOnNetwork ¶
DeactivateUserGrantsOnNetwork - deletes all active grants for a user on a network
func DefaultRoleForScope ¶ added in v1.7.0
func DefaultRoleForScope(s scope.Scope) schema.UserRoleID
func DeleteAllNetworkTags ¶
func DeleteAndCleanUpGroup ¶
func DeleteMetrics ¶
DeleteMetrics - deletes metrics of a given node
func DeleteNetworkRoles ¶
func DeleteNodeMetricsFromPeers ¶
DeleteNodeMetricsFromPeers - removes a deleted node's entry from all peers' connectivity maps
func DeleteRole ¶
DeleteRole - deletes user role
func DenyJITRequest ¶
func DenyJITRequest(requestID string, deniedBy string) (*schema.JITRequest, error)
DenyJITRequest - denies a JIT request and returns the updated request
func DisableJITOnNetwork ¶
DisableJITOnNetwork - disables JIT on a network and clears JIT fields on all ext clients (user configs) belonging to the network.
func DisconnectExtClientsFromNetwork ¶
DisconnectExtClientsFromNetwork - disconnects ext clients whose owners are subject to JIT on this network.
func DisconnectExtClientsFromNetworkForScope ¶
DisconnectExtClientsFromNetworkForScope removes client-app ext clients for users who require a JIT grant under the given network configuration. Admin-managed config files (no device/ remote_access_client id) are kept.
func DisconnectUserExtClientsFromNetwork ¶
DisconnectUserExtClientsFromNetwork - disconnects a specific user's ext clients from a network
func DisconnectUserHostNodesFromNetwork ¶ added in v1.7.0
DisconnectUserHostNodesFromNetwork removes full-mesh host nodes for a user on a network.
func DoesAutoRelayExist ¶
DoesAutoRelayExist - checks if autorelay exists already in the network
func EnableJITOnNetwork ¶
func EnableJITOnNetwork(ctx context.Context, networkID string, jitUserGroupIDs []schema.UserGroupID) error
EnableJITOnNetwork - enables JIT on a network, optionally scoped to jitUserGroupIDs (empty = all users). Removes client-app ext clients for users who are subject to JIT under the new configuration.
func EventRetentionHook ¶ added in v1.7.0
func EventRetentionHook() error
func EventWatcher ¶
func EventWatcher()
func ExpireJITGrants ¶
func ExpireJITGrants() error
ExpireJITGrants - expires grants that have passed their expiration time
func FilterNetworksByRole ¶
func GetAccountsHost ¶
func GetAccountsHost() string
func GetAccountsUIHost ¶
func GetAccountsUIHost() string
func GetAnyRole ¶ added in v1.7.0
func GetAutoRelayNode ¶
GetAutoRelayNode - gets the host acting as autoRelay
func GetAutoRelayPeerIps ¶
GetAutoRelayPeerIps - adds the autorelayed peerIps by the peer
func GetDefaultGlobalAdminGroupID ¶
func GetDefaultGlobalAdminGroupID() schema.UserGroupID
func GetDefaultGlobalAdminRoleID ¶
func GetDefaultGlobalAdminRoleID() schema.UserRoleID
func GetDefaultGlobalUserGroupID ¶
func GetDefaultGlobalUserGroupID() schema.UserGroupID
func GetDefaultGlobalUserRoleID ¶
func GetDefaultGlobalUserRoleID() schema.UserRoleID
func GetDefaultGroupAclName ¶
func GetDefaultNetworkAdminGroupID ¶
func GetDefaultNetworkAdminGroupID(networkID schema.NetworkID) schema.UserGroupID
func GetDefaultNetworkAdminRoleID ¶
func GetDefaultNetworkAdminRoleID(networkID schema.NetworkID) schema.UserRoleID
func GetDefaultNetworkUserGroupID ¶
func GetDefaultNetworkUserGroupID(networkID schema.NetworkID) schema.UserGroupID
func GetDefaultNetworkUserRoleID ¶
func GetDefaultNetworkUserRoleID(networkID schema.NetworkID) schema.UserRoleID
func GetDeploymentMode ¶
func GetDeploymentMode() string
func GetGroupNetworksMap ¶
func GetMetrics ¶
GetMetrics - gets the metrics
func GetNameserversForHost ¶
func GetNameserversForNode ¶
func GetNetworkAdmins ¶
GetNetworkAdmins - gets all network admins for a network
func GetNetworkIngresses ¶
GetNetworkIngresses - gets the gateways of a network
func GetNodeIDsWithTag ¶
func GetNodeStatus ¶
func GetNodesWithTag ¶
func GetPostureCheckDeviceInfoByNode ¶
func GetPostureCheckDeviceInfoByNode(ctx context.Context, node *models.Node) models.PostureCheckDeviceInfo
GetPostureCheckDeviceInfoByNode retrieves PostureCheckDeviceInfo for a given node
func GetPostureCheckDeviceInfoForHost ¶ added in v1.7.0
func GetPostureCheckViolations ¶
func GetPostureCheckViolations(ctx context.Context, checks []schema.PostureCheck, d models.PostureCheckDeviceInfo) ([]models.Violation, schema.Severity)
func GetSaaSNMUIHost ¶
func GetSaaSNMUIHost() string
func GetSaaSNMUIHostWithVersion ¶
func GetSaaSNMUIHostWithVersion() string
func GetStaticNodeWithTag ¶
func GetTagMapWithNodes ¶
func GetUserAclRulesForNode ¶
func GetUserGroup ¶
GetUserGroup - fetches user group
func GetUserGroupsInNetwork ¶
func GetUserGrpMap ¶
func GetUserGrpMap() map[schema.UserGroupID]map[string]struct{}
func GetUserRAGNodes ¶
func InitAutoRelayCache ¶
func InitAutoRelayCache()
func IsAclPolicyValid ¶
IsAclPolicyValid - validates if acl policy is valid
func IsGroupValid ¶
func IsGroupValid(ctx context.Context, groupID schema.UserGroupID) error
func IsGroupsValid ¶
func IsGroupsValid(ctx context.Context, groups map[schema.UserGroupID]struct{}) error
func IsNetworkAdmin ¶
IsNetworkAdmin - checks if user is a network admin via user groups. networkID may be the network name (netid) or UUID.
func IsNetworkRolesValid ¶
func IsPeerAllowed ¶
IsPeerAllowed - checks if peer needs to be added to the interface
func IsUserAllowedToCommunicate ¶
func IsUserAllowedToCommunicate(ctx context.Context, userName string, peer models.Node) (bool, []models.Acl)
IsUserAllowedToCommunicate - check if user is allowed to communicate with peer
func ListNetworkTags ¶
ListNetworkTags - lists all tags in network
func ListTagsWithNodes ¶
ListTagsWithHosts - lists all tags with tagged hosts
func LoadNodeMetricsToCache ¶
func MQUpdateMetricsFallBack ¶
MQUpdateMetricsFallBack - called when mq fallback thread is triggered on client
func MergePostureCheckUpdate ¶ added in v1.7.0
func MergePostureCheckUpdate(existing, update *schema.PostureCheck)
MergePostureCheckUpdate fills in fields omitted from an update payload using the existing stored posture check. Clients that toggle status often omit attribute-specific Config; without this merge validation would see empty MDM flags and reject the request.
func OrgPermissionsCheck ¶ added in v1.7.0
func PlatformRoleRequiresGroupEnforcement ¶
func PlatformRoleRequiresGroupEnforcement(role schema.UserRoleID) bool
PlatformRoleRequiresGroupEnforcement reports whether network-scoped resource access must come from user groups (admin/super-admin still use platform FullAccess for global permissions only).
func PopulatePostureCheckGroupNames ¶
func PopulatePostureCheckGroupNames(ctx context.Context, pcs []schema.PostureCheck)
PopulatePostureCheckGroupNames sets group name as the value for each user group key
func PrepareOauthUserFromInvite ¶
PrepareOauthUserFromInvite - init oauth user before create
func PublishCollectMetrics ¶
func PublishCollectMetrics(hostID, nodeID, reason string)
PublishCollectMetrics asks the host (over MQTT) to collect and publish metrics now. Triggered on events like node join and reconnect. Best-effort; logs and returns on failure.
func PushToSIEM ¶
func PushToSIEM()
func RemoveAutoRelayFromCache ¶
func RemoveAutoRelayFromCache(network string)
func RemoveDeviceTagFromAclPolicies ¶
func RemoveDeviceTagFromAclPolicies(ctx context.Context, tagID models.TagID, netID schema.NetworkID) error
RemoveDeviceTagFromAclPolicies - remove device tag from acl policies
func RemoveUserFromAclPolicy ¶
func RemoveUserGroupFromAllJITScopes ¶
func RemoveUserGroupFromAllJITScopes(ctx context.Context, groupID schema.UserGroupID) error
RemoveUserGroupFromAllJITScopes removes the given user-group ID from the JITUserGroupIDs allowlist of every network. Intended for use when a user group is deleted, so networks don't keep stale references that could silently change JIT scope semantics.
func RemoveUserGroupFromNetworkJITScope ¶
func RemoveUserGroupFromNetworkJITScope(ctx context.Context, networkID string, groupID schema.UserGroupID) error
RemoveUserGroupFromNetworkJITScope removes the given user-group ID from the network's JITUserGroupIDs allowlist. Intended for use when a user group is removed from a network's roles, so the JIT scope is kept consistent with the group's actual network membership.
func RemoveUserGroupFromPostureChecks ¶
func RemoveUserGroupFromPostureChecks(grpID schema.UserGroupID, netID schema.NetworkID)
func RemoveUserJITNetworkAccess ¶ added in v1.7.0
RemoveUserJITNetworkAccess deletes a user's host nodes and ext clients from a network after JIT ends.
func ResetAutoRelay ¶
ResetAutoRelay - reset autorelayed peers
func ResetAutoRelayedPeer ¶
ResetAutoRelayedPeer - removes auto relayed over node from network peers
func RunPostureChecks ¶
func RunPostureChecks() error
func RunPostureChecksForTenant ¶ added in v1.7.0
func SetAutoRelay ¶
func SetAutoRelayCtx ¶
func SetAutoRelayInCache ¶
func SetDeploymentMode ¶
func SetDeploymentMode(deploymentMode string)
func SetPeerMetricsDisconnected ¶
SetPeerMetricsDisconnected - marks a node as disconnected in all peers' connectivity maps
func SkipPushToSiem ¶
func SkipPushToSiem()
func SortTagEntrys ¶
func SortTagEntrys(tags []models.TagListResp)
SortTagEntrys - Sorts slice of Tag entries by their id
func StartFlowCleanupLoop ¶
func StartFlowCleanupLoop()
func StopFlowCleanupLoop ¶
func StopFlowCleanupLoop()
func StripGroupsOnRoleDowngrade ¶
func StripGroupsOnRoleDowngrade(oldRole, newRole schema.UserRoleID, groups map[schema.UserGroupID]struct{})
StripGroupsOnRoleDowngrade is a no-op; group membership is not modified on role change.
func TenantPermissionsCheck ¶ added in v1.7.0
func UpdateDeviceTag ¶
UpdateDeviceTag - updates device tag on acl policies
func UpdateJITUserGroupsOnNetwork ¶
func UpdateJITUserGroupsOnNetwork(ctx context.Context, networkID string, jitUserGroupIDs []schema.UserGroupID) error
UpdateJITUserGroupsOnNetwork updates the JIT user-group allowlist while JIT remains enabled.
func UpdateMetrics ¶
UpdateMetrics - updates the metrics of a given client
func UpdateUserGroup ¶
UpdateUserGroup - updates new user group
func UpdateUserGwAccess ¶
func UpdatesUserGwAccessOnGrpUpdates ¶
func UpdatesUserGwAccessOnGrpUpdates(ctx context.Context, groupID schema.UserGroupID, oldNetworkRoles, newNetworkRoles map[schema.NetworkID]map[schema.UserRoleID]struct{})
func UserGroupsInit ¶
func UserHasDeviceNetworkWriteAccess ¶ added in v1.7.0
UserHasDeviceNetworkWriteAccess reports whether the user may mutate device network membership/state (join, leave, exit-node selection). Read-only network roles that only grant Read are denied; Network Users (VPNaccess / extclient create) and roles with host write scopes are allowed.
func UserHasGlobalNetworksAdminMembership ¶
UserHasGlobalNetworksAdminMembership reports global all-networks admin via groups.
func UserHasNetworkGroupAccess ¶
UserHasNetworkGroupAccess reports whether the user has any network role on the network (or all-networks scope) through group membership. networkID may be the network name (netid) or UUID.
func UserNetworkRolesInit ¶ added in v1.7.0
func UserRolesInit ¶
func UserRolesInit()
func UserSubjectToNetworkJIT ¶ added in v1.7.0
UserSubjectToNetworkJIT reports whether client-app extclient create must verify a JIT grant for this user on the network. False when the feature/network JIT is off or the user is outside jit_user_group_ids scope.
func ValidateCreateGroupReq ¶
func ValidateNameserverReq ¶
func ValidateNameserverReq(ctx context.Context, ns *schema.Nameserver) error
func ValidatePostureCheck ¶
func ValidatePostureCheck(ctx context.Context, pc *schema.PostureCheck) error
Types ¶
type EDRComplianceConfig ¶ added in v1.7.0
type EDRComplianceConfig struct {
RequireAgentInstalled bool
RequireAgentHealthy bool
MaxAllowedRiskLevel string
MaxStateAgeHours int
}
EDRComplianceConfig is the typed view of PostureCheck.Config when Attribute == EDRCompliance.
func ParseEDRComplianceConfig ¶ added in v1.7.0
func ParseEDRComplianceConfig(cfg datatypes.JSONMap) EDRComplianceConfig
type JITRequestWithGrant ¶
type JITRequestWithGrant struct {
schema.JITRequest
GrantID string `json:"grant_id,omitempty"` // Grant ID if request is approved
}
JITRequestWithGrant - JIT request with grant ID for approved requests
func GetNetworkJITRequests ¶
func GetNetworkJITRequests(networkID string, statusFilter string) ([]JITRequestWithGrant, error)
GetNetworkJITRequests - gets JIT requests for a network, optionally filtered by status statusFilter can be: "pending", "approved", "denied", "expired", or "" for all
func GetNetworkJITRequestsPaginated ¶
func GetNetworkJITRequestsPaginated(ctx context.Context, networkID string, statusFilter string, page, pageSize int) ([]JITRequestWithGrant, int64, error)
GetNetworkJITRequestsPaginated - gets paginated JIT requests for a network, optionally filtered by status statusFilter can be: "pending", "approved", "denied", "expired", or "" for all page and pageSize control pagination. db.SetPagination will apply defaults (page=1, pageSize=10) if values are invalid. Returns: requests, total count, error
type JITStatusResponse ¶
type JITStatusResponse struct {
HasAccess bool `json:"has_access"`
Grant *schema.JITGrant `json:"grant,omitempty"`
Request *schema.JITRequest `json:"request,omitempty"`
PendingRequest bool `json:"pending_request"`
}
JITStatusResponse - response for JIT status check
func GetUserJITStatus ¶
func GetUserJITStatus(ctx context.Context, networkID, userID string) (*JITStatusResponse, error)
GetUserJITStatus - gets JIT status for a user on a network
type MDMComplianceConfig ¶ added in v1.7.0
MDMComplianceConfig is the typed view of PostureCheck.Config when Attribute == MDMCompliance.
func ParseMDMComplianceConfig ¶ added in v1.7.0
func ParseMDMComplianceConfig(cfg datatypes.JSONMap) MDMComplianceConfig
ParseMDMComplianceConfig decodes the JSONMap stored on PostureCheck.Config into a typed MDMComplianceConfig. Unknown keys are ignored.
type UserJITNetworkStatus ¶
type UserJITNetworkStatus struct {
NetworkID string `json:"network_id"`
NetworkName string `json:"network_name,omitempty"`
JITEnabled bool `json:"jit_enabled"`
JitAppliesToUser bool `json:"jit_applies_to_user"`
HasAccess bool `json:"has_access"`
Grant *schema.JITGrant `json:"grant,omitempty"`
Request *schema.JITRequest `json:"request,omitempty"`
PendingRequest bool `json:"pending_request"`
}
UserJITNetworkStatus - represents JIT status for a network from user's perspective
func GetUserJITNetworksStatus ¶
func GetUserJITNetworksStatus(ctx context.Context, networks []schema.Network, user *schema.User) ([]UserJITNetworkStatus, error)
GetUserJITNetworksStatus - gets JIT status for multiple networks for a user