Skip to content

Commit

Permalink
Tighten permission in Windows MSI installer. (#3875)
Browse files Browse the repository at this point in the history
Also fix quarantine artifact to access the port in cases where the URL
does not have an explicit port.

Update documentation references.
  • Loading branch information
scudette committed Nov 4, 2024
1 parent 7e03121 commit 79c6836
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
4 changes: 3 additions & 1 deletion artifacts/definitions/Windows/Remediation/Quarantine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ sources:
// Parse a URL to get the port or use 443. We deliberately do
// not support plain http!
LET get_port(URL) = split(string=url(parse=URL).Host, sep=":")[1] || "443"
LET get_port(URL) = if(condition=url(parse=URL).Host =~ ":",
then=split(string=url(parse=URL).Host, sep=":")[1],
else="443")
// extract Velociraptor config for policy
LET extracted_config <= SELECT * FROM foreach(
Expand Down
10 changes: 2 additions & 8 deletions docs/references/vql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5869,7 +5869,7 @@
description: The accessor to use.
- name: raw
type: bool
description: Emit raw events (no parsed).
description: Emit raw events (not parsed).
- name: start_time
type: time.Time
description: Only parse events newer than this time (default all times).
Expand Down Expand Up @@ -10359,13 +10359,7 @@
description: The accessor to use.
- name: raw
type: bool
description: Emit raw events (no parsed).
- name: start_time
type: time.Time
description: Only parse events newer than this time (default all times).
- name: end_time
type: time.Time
description: Only parse events older than this time (default all times).
description: Emit raw events (not parsed).
metadata:
permissions: FILESYSTEM_READ
platforms:
Expand Down
4 changes: 2 additions & 2 deletions docs/wix/velociraptor_amd64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<Component Id='Install' Guid='9f3cfed0-b89d-43d4-8fcf-242824e84fd8'>
<CreateFolder>
<Permission User="[WIX_ACCOUNT_USERS]" GenericRead="no" Read="no"
ChangePermission="yes"/>
ChangePermission="no"/>
<Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" GenericAll="yes"
ChangePermission="yes"/>
<Permission User="[WIX_ACCOUNT_LOCALSYSTEM]" GenericAll="yes"
Expand All @@ -50,7 +50,7 @@
<Component Id="Tools" Guid="97dc953a-8a2f-494f-9585-56ae526d0b48">
<CreateFolder>
<Permission User="[WIX_ACCOUNT_USERS]" GenericRead="no" Read="no"
ChangePermission="yes"/>
ChangePermission="no"/>
<Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" GenericAll="yes"
ChangePermission="yes"/>
<Permission User="[WIX_ACCOUNT_LOCALSYSTEM]" GenericAll="yes"
Expand Down
5 changes: 3 additions & 2 deletions services/client_info/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ func (self *ClientInfoManager) getClientTasks(
if message.FlowRequest != nil {
total_flow_requests++

// Only include the first number requests
if total_flow_requests <= number {
// Only include the first number requests, unless they are
// urgent requests which are always delivered regardless.
if total_flow_requests <= number || message.Urgent {
result = append(result, message)

// Add extra backwards compatibility messages for
Expand Down
12 changes: 9 additions & 3 deletions vql/parsers/journald/journald.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
type JournalPluginArgs struct {
Filenames []*accessors.OSPath `vfilter:"required,field=filename,doc=A list of journal log files to parse."`
Accessor string `vfilter:"optional,field=accessor,doc=The accessor to use."`
Raw bool `vfilter:"optional,field=raw,doc=Emit raw events (no parsed)."`
Raw bool `vfilter:"optional,field=raw,doc=Emit raw events (not parsed)."`
StartTime time.Time `vfilter:"optional,field=start_time,doc=Only parse events newer than this time (default all times)."`
EndTime time.Time `vfilter:"optional,field=end_time,doc=Only parse events older than this time (default all times)."`
}
Expand Down Expand Up @@ -105,6 +105,12 @@ func (self JournalPlugin) Call(
return output_chan
}

type WatchJournalPluginArgs struct {
Filenames []*accessors.OSPath `vfilter:"required,field=filename,doc=A list of journal log files to parse."`
Accessor string `vfilter:"optional,field=accessor,doc=The accessor to use."`
Raw bool `vfilter:"optional,field=raw,doc=Emit raw events (not parsed)."`
}

type WatchJournaldPlugin struct{}

func (self WatchJournaldPlugin) Call(
Expand All @@ -117,7 +123,7 @@ func (self WatchJournaldPlugin) Call(
defer close(output_chan)
defer vql_subsystem.RegisterMonitor("watch_journald", args)()

arg := &JournalPluginArgs{}
arg := &WatchJournalPluginArgs{}
err := arg_parser.ExtractArgsWithContext(ctx, scope, args, arg)
if err != nil {
scope.Log("watch_journald: %v", err)
Expand Down Expand Up @@ -176,7 +182,7 @@ func (self WatchJournaldPlugin) Info(scope vfilter.Scope, type_map *vfilter.Type
return &vfilter.PluginInfo{
Name: "watch_journald",
Doc: "Watch a journald file and stream events from it. ",
ArgType: type_map.AddType(scope, &JournalPluginArgs{}),
ArgType: type_map.AddType(scope, &WatchJournalPluginArgs{}),
Metadata: vql.VQLMetadata().Permissions(acls.FILESYSTEM_READ).Build(),
}
}
Expand Down

0 comments on commit 79c6836

Please sign in to comment.