-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate client config to queries running in the client. (#4047)
This propagates things like prevent_execve into the query scope to ensure it is inspected at all levels. Also implemented a plugin deny list as a more robust way to prevent some plugins and functions from running on the endpoint. This extends the idea of prevent_execve to other potentially dangerous plugins (e.g. rm). It is implemented as a deny list in addition to the previous allow_list to make it easier to use.
- Loading branch information
Showing
13 changed files
with
513 additions
and
313 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
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
Large diffs are not rendered by default.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package startup | ||
|
||
import ( | ||
"www.velocidex.com/golang/velociraptor/accessors" | ||
config_proto "www.velocidex.com/golang/velociraptor/config/proto" | ||
"www.velocidex.com/golang/velociraptor/logging" | ||
vql_subsystem "www.velocidex.com/golang/velociraptor/vql" | ||
) | ||
|
||
// Potentially restrict server functionality. | ||
func MaybeEnforceAllowLists(config_obj *config_proto.Config) error { | ||
if config_obj.Defaults == nil { | ||
return nil | ||
} | ||
|
||
if len(config_obj.Defaults.AllowedPlugins) > 0 { | ||
logger := logging.GetLogger(config_obj, &logging.FrontendComponent) | ||
logger.Info("Restricting VQL plugins to set %v and functions to set %v\n", | ||
config_obj.Defaults.AllowedPlugins, config_obj.Defaults.AllowedFunctions) | ||
} | ||
|
||
if len(config_obj.Defaults.DeniedPlugins) > 0 { | ||
logger := logging.GetLogger(config_obj, &logging.FrontendComponent) | ||
logger.Info("Removing VQL plugins to set %v and functions to set %v\n", | ||
config_obj.Defaults.DeniedPlugins, config_obj.Defaults.DeniedPlugins) | ||
} | ||
|
||
err := vql_subsystem.EnforceVQLAllowList( | ||
config_obj.Defaults.AllowedPlugins, | ||
config_obj.Defaults.AllowedFunctions, | ||
config_obj.Defaults.DeniedPlugins, | ||
config_obj.Defaults.DeniedFunctions) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if len(config_obj.Defaults.AllowedAccessors) > 0 { | ||
err = accessors.EnforceAccessorAllowList( | ||
config_obj.Defaults.AllowedAccessors) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return 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
Oops, something went wrong.