forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added orgs() plugin and user management (Velocidex#1949)
It is not possible in VQL to add users to different orgs and grant them different access. Also allow the query() plugin to runas a user and run within a different org context. This allows scheduling of collection hunts across different orgs as well retrieving the results from different orgs.
- Loading branch information
Showing
92 changed files
with
1,389 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1 @@ | ||
package accessors | ||
|
||
import ( | ||
"www.velocidex.com/golang/velociraptor/acls" | ||
acl_proto "www.velocidex.com/golang/velociraptor/acls/proto" | ||
config_proto "www.velocidex.com/golang/velociraptor/config/proto" | ||
vql_subsystem "www.velocidex.com/golang/velociraptor/vql" | ||
) | ||
|
||
// Get a new, more restricted ACL manager suitable for remapping | ||
// configuration. NOTE that this remapping manager can not give | ||
// **more** permissions than before, but can only remove permissions | ||
// from the existing token. It is useful when we want to block | ||
// certaain plugins from working because we are emulating a more | ||
// restricted environment. For example when analyzing a dead image on | ||
// Windows we need to prevent wmi() plugin from interrogating the | ||
// analysis host, therefore would typically remove the MACHINE_STATE | ||
// permission. | ||
func GetRemappingACLManager( | ||
existing_manager vql_subsystem.ACLManager, | ||
remap_config []*config_proto.RemappingConfig) (vql_subsystem.ACLManager, error) { | ||
token := &acl_proto.ApiClientACL{} | ||
for _, item := range remap_config { | ||
if item.Type == "permissions" { | ||
for _, perm := range item.Permissions { | ||
allowed, err := existing_manager.CheckAccess( | ||
acls.GetPermission(perm)) | ||
if err == nil && allowed { | ||
err := acls.SetTokenPermission(token, perm) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return &vql_subsystem.ServerACLManager{Token: token}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.