Skip to content

Commit

Permalink
Bugfix: Propagate remapping impersonation in automatic interrogate (V…
Browse files Browse the repository at this point in the history
  • Loading branch information
scudette authored Jul 24, 2024
1 parent 394fb5b commit b88c17d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
29 changes: 18 additions & 11 deletions actions/client_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ func GetClientInfo(
config_obj *config_proto.Config) *actions_proto.ClientInfo {
result := &actions_proto.ClientInfo{}

info, err := psutils.InfoWithContext(ctx)
if err == nil {
result = &actions_proto.ClientInfo{
Hostname: info.Hostname,
System: info.OS,
Release: info.Platform + info.PlatformVersion,
Architecture: runtime.GOARCH,
Fqdn: fqdn.Get(),
}
}

if config_obj.Version != nil {
result.ClientName = config_obj.Version.Name
result.ClientVersion = config_obj.Version.Version
Expand All @@ -39,6 +28,24 @@ func GetClientInfo(
result.InstallTime = config_obj.Version.InstallTime
}

for _, remapping := range config_obj.Remappings {
if remapping.Type == "impersonation" {
result.Hostname = remapping.Hostname
result.Fqdn = remapping.Hostname
result.System = remapping.Os
return result
}
}

info, err := psutils.InfoWithContext(ctx)
if err == nil {
result.Hostname = info.Hostname
result.System = info.OS
result.Release = info.Platform + info.PlatformVersion
result.Architecture = runtime.GOARCH
result.Fqdn = fqdn.Get()
}

if config_obj.Client != nil {
result.Labels = config_obj.Client.Labels
}
Expand Down
2 changes: 2 additions & 0 deletions vql/remapping/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"runtime"

"github.com/Velocidex/ordereddict"

Expand Down Expand Up @@ -219,6 +220,7 @@ func ApplyRemappingOnScope(
Set("VirtualizationRole", "").
Set("HostID", "").
Set("Exe", "").
Set("Architecture", runtime.GOARCH).
Set("IsAdmin", true),
}))
disablePlugins(remapped_scope, remapping)
Expand Down

0 comments on commit b88c17d

Please sign in to comment.