From d2a5a1d24f4042b1fbd165998a90e25cce5984c1 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Thu, 31 Aug 2023 13:39:07 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20gcp=20snapshot=20connection=20for?= =?UTF-8?q?=20v9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #1613 Fixes #1627 Signed-off-by: Christian Zunker --- .vscode/launch.json | 11 +- _motor/providers/os/snapshot/localcmd.go | 21 --- apps/cnquery/cmd/plugin.go | 8 + providers/core/resources/core.resources.json | 2 +- providers/gcp/config/config.go | 24 ++- providers/gcp/connection/connection.go | 31 ++-- .../gcpinstancesnapshot/platform.go | 0 .../gcpinstancesnapshot/provider.go | 162 ++++++++++-------- .../gcpinstancesnapshot/snapshot.go | 25 ++- .../snapshot_debug_test.go | 0 .../gcpinstancesnapshot/snapshot_test.go | 0 providers/gcp/connection/shared/shared.go | 24 +++ providers/gcp/go.mod | 45 ++++- providers/gcp/go.sum | 106 ++++++++++++ providers/gcp/provider/provider.go | 108 ++++++++---- providers/os/connection/filesystem.go | 4 +- providers/os/connection/local.go | 6 +- .../os/connection}/snapshot/blockdevices.go | 0 .../connection}/snapshot/blockdevices_test.go | 0 providers/os/connection/snapshot/localcmd.go | 21 +++ .../os/connection}/snapshot/mount_linux.go | 0 .../os/connection}/snapshot/mount_other.go | 0 .../connection}/snapshot/testdata/rhel8.json | 0 .../snapshot/testdata/rhel8_nolabels.json | 0 .../os/connection}/snapshot/volumemounter.go | 5 +- providers/providers.go | 1 + 26 files changed, 440 insertions(+), 164 deletions(-) delete mode 100644 _motor/providers/os/snapshot/localcmd.go rename {_motor/providers => providers/gcp/connection}/gcpinstancesnapshot/platform.go (100%) rename {_motor/providers => providers/gcp/connection}/gcpinstancesnapshot/provider.go (63%) rename {_motor/providers => providers/gcp/connection}/gcpinstancesnapshot/snapshot.go (90%) rename {_motor/providers => providers/gcp/connection}/gcpinstancesnapshot/snapshot_debug_test.go (100%) rename {_motor/providers => providers/gcp/connection}/gcpinstancesnapshot/snapshot_test.go (100%) create mode 100644 providers/gcp/connection/shared/shared.go rename {_motor/providers/os => providers/os/connection}/snapshot/blockdevices.go (100%) rename {_motor/providers/os => providers/os/connection}/snapshot/blockdevices_test.go (100%) create mode 100644 providers/os/connection/snapshot/localcmd.go rename {_motor/providers/os => providers/os/connection}/snapshot/mount_linux.go (100%) rename {_motor/providers/os => providers/os/connection}/snapshot/mount_other.go (100%) rename {_motor/providers/os => providers/os/connection}/snapshot/testdata/rhel8.json (100%) rename {_motor/providers/os => providers/os/connection}/snapshot/testdata/rhel8_nolabels.json (100%) rename {_motor/providers/os => providers/os/connection}/snapshot/volumemounter.go (96%) diff --git a/.vscode/launch.json b/.vscode/launch.json index b1de9a30d4..a04f7a972b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,9 +9,16 @@ "type": "go", "request": "attach", "mode": "remote", + "debugAdapter": "dlv-dap", "remotePath": "${workspaceFolder}", - "port": 2345, - "host": "127.0.0.1" + "port": 12345, + "host": "35.241.232.183", + "substitutePath":[ + { + "from": "${workspaceFolder}", + "to": "/home/christian/workspace/cnquery" + } + ] }, { "name": "Launch Package", diff --git a/_motor/providers/os/snapshot/localcmd.go b/_motor/providers/os/snapshot/localcmd.go deleted file mode 100644 index 54048b2c7c..0000000000 --- a/_motor/providers/os/snapshot/localcmd.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Mondoo, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -package snapshot - -import ( - "go.mondoo.com/cnquery/motor/providers/os" - "go.mondoo.com/cnquery/motor/providers/os/cmd" -) - -type LocalCommandRunner struct { - shell []string -} - -func (r *LocalCommandRunner) RunCommand(command string) (*os.Command, error) { - c := cmd.CommandRunner{Shell: r.shell} - args := []string{} - - res, err := c.Exec(command, args) - return res, err -} diff --git a/apps/cnquery/cmd/plugin.go b/apps/cnquery/cmd/plugin.go index 08fad1c467..21af662ef1 100644 --- a/apps/cnquery/cmd/plugin.go +++ b/apps/cnquery/cmd/plugin.go @@ -102,6 +102,14 @@ func (c *cnqueryPlugin) RunQuery(conf *run.RunQueryConfig, runtime *providers.Ru } } + // FIXME: workaround for gcp-snapshot + // For a gcp-snapshot asset, we start with a GCP connection. + // This get's overriden by a filesystem connection. The fileswystem connection is what we need for the scan + // But later, we need the GCP runtime to cleanup the snapshot disk + if runtime.Provider.Instance.Name == "gcp" && runtime.Provider.Connection.Name == "filesystem" { + defer runtime.Close() + } + assets, err := providers.ProcessAssetCandidates(runtime, runtime.Provider.Connection, upstreamConfig, conf.PlatformId) if err != nil { return err diff --git a/providers/core/resources/core.resources.json b/providers/core/resources/core.resources.json index 61b1d4e04a..9132c843e6 100644 --- a/providers/core/resources/core.resources.json +++ b/providers/core/resources/core.resources.json @@ -1 +1 @@ -{"resources":{"asset":{"id":"asset","name":"asset","fields":{"arch":{"name":"arch","type":"\u0007","is_mandatory":true,"title":"Architecture this OS is running on","provider":"go.mondoo.com/cnquery/providers/core"},"build":{"name":"build","type":"\u0007","is_mandatory":true,"title":"Build version of the platform (optional)","provider":"go.mondoo.com/cnquery/providers/core"},"family":{"name":"family","type":"\u0019\u0007","is_mandatory":true,"title":"List of platform families that this platform belongs to","provider":"go.mondoo.com/cnquery/providers/core"},"fqdn":{"name":"fqdn","type":"\u0007","is_mandatory":true,"title":"Fully qualified domain name (optional)","provider":"go.mondoo.com/cnquery/providers/core"},"ids":{"name":"ids","type":"\u0019\u0007","is_mandatory":true,"title":"All identifiers for this asset","provider":"go.mondoo.com/cnquery/providers/core"},"kind":{"name":"kind","type":"\u0007","is_mandatory":true,"title":"Kind of platform, for example:","desc":"api, baremetal, vm, vm-image, container, container-image, network, ...","provider":"go.mondoo.com/cnquery/providers/core"},"labels":{"name":"labels","type":"\u001a\u0007\u0007","is_mandatory":true,"title":"Optional platform information","provider":"go.mondoo.com/cnquery/providers/core"},"name":{"name":"name","type":"\u0007","is_mandatory":true,"title":"Human readable name of the asset","provider":"go.mondoo.com/cnquery/providers/core"},"platform":{"name":"platform","type":"\u0007","is_mandatory":true,"title":"Platform for this asset (redhat, windows, k8s-pod)","provider":"go.mondoo.com/cnquery/providers/core"},"runtime":{"name":"runtime","type":"\u0007","is_mandatory":true,"title":"Runtime is the specific kind of the platform. Examples include:","desc":"docker-container, podman-container, aws-ec2-instance, ...","provider":"go.mondoo.com/cnquery/providers/core"},"title":{"name":"title","type":"\u0007","is_mandatory":true,"title":"Human-readable title of the platform (e.g. \"Red Hat 8, Container\")","provider":"go.mondoo.com/cnquery/providers/core"},"version":{"name":"version","type":"\u0007","is_mandatory":true,"title":"Version of the platform","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"General asset information","min_mondoo_version":"6.13.0","defaults":"name platform version","provider":"go.mondoo.com/cnquery/providers/core"},"mondoo":{"id":"mondoo","name":"mondoo","fields":{"arch":{"name":"arch","type":"\u0007","title":"The architecture of this client (e.g. linux-amd64)","provider":"go.mondoo.com/cnquery/providers/core"},"build":{"name":"build","type":"\u0007","title":"The build of the client (e.g. production, development)","provider":"go.mondoo.com/cnquery/providers/core"},"capabilities":{"name":"capabilities","type":"\u0019\u0007","title":"Connection capabilities","provider":"go.mondoo.com/cnquery/providers/core"},"jobEnvironment":{"name":"jobEnvironment","type":"\n","title":"Returns the agent execution environment","provider":"go.mondoo.com/cnquery/providers/core"},"version":{"name":"version","type":"\u0007","title":"Version of the client running on the asset","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"Provide contextual information about MQL runtime and environment","min_mondoo_version":"5.15.0","defaults":"version","provider":"go.mondoo.com/cnquery/providers/core"},"parse":{"id":"parse","name":"parse","title":"Parse provides common parsers (json, ini, certs, etc)","min_mondoo_version":"5.15.0","provider":"go.mondoo.com/cnquery/providers/core"},"regex":{"id":"regex","name":"regex","fields":{"creditCard":{"name":"creditCard","type":"\u0008","title":"Matches credit card numbers","provider":"go.mondoo.com/cnquery/providers/core"},"email":{"name":"email","type":"\u0008","title":"Matches email addresses","provider":"go.mondoo.com/cnquery/providers/core"},"emoji":{"name":"emoji","type":"\u0008","title":"Matches emojis","provider":"go.mondoo.com/cnquery/providers/core"},"ipv4":{"name":"ipv4","type":"\u0008","title":"Matches IPv4 addresses","provider":"go.mondoo.com/cnquery/providers/core"},"ipv6":{"name":"ipv6","type":"\u0008","title":"Matches IPv6 addresses","provider":"go.mondoo.com/cnquery/providers/core"},"mac":{"name":"mac","type":"\u0008","title":"Matches MAC addresses","provider":"go.mondoo.com/cnquery/providers/core"},"semver":{"name":"semver","type":"\u0008","title":"Matches semantic version numbers","provider":"go.mondoo.com/cnquery/providers/core"},"url":{"name":"url","type":"\u0008","title":"Matches URL addresses (HTTP/HTTPS)","provider":"go.mondoo.com/cnquery/providers/core"},"uuid":{"name":"uuid","type":"\u0008","title":"Matches hyphen-deliminated UUIDs","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"Builtin regular expression functions","min_mondoo_version":"5.15.0","provider":"go.mondoo.com/cnquery/providers/core"},"time":{"id":"time","name":"time","fields":{"day":{"name":"day","type":"\t","title":"One day, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"hour":{"name":"hour","type":"\t","title":"One hour, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"minute":{"name":"minute","type":"\t","title":"One minute, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"now":{"name":"now","type":"\t","title":"The current time on the local system","provider":"go.mondoo.com/cnquery/providers/core"},"second":{"name":"second","type":"\t","title":"One second, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"today":{"name":"today","type":"\t","title":"The current day starting at midnight","provider":"go.mondoo.com/cnquery/providers/core"},"tomorrow":{"name":"tomorrow","type":"\t","title":"The next day starting at midnight","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"Date and time functions","min_mondoo_version":"5.15.0","provider":"go.mondoo.com/cnquery/providers/core"},"uuid":{"id":"uuid","name":"uuid","fields":{"urn":{"name":"urn","type":"\u0007","title":"URN returns the RFC 2141 URN form of uuid","provider":"go.mondoo.com/cnquery/providers/core"},"value":{"name":"value","type":"\u0007","is_mandatory":true,"title":"Canonical string representation xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","provider":"go.mondoo.com/cnquery/providers/core"},"variant":{"name":"variant","type":"\u0007","title":"Variant encoded in uuid","provider":"go.mondoo.com/cnquery/providers/core"},"version":{"name":"version","type":"\u0005","title":"Version of uuid","provider":"go.mondoo.com/cnquery/providers/core"}},"init":{"args":[{"name":"value","type":"\u0007"}]},"title":"UUIDs based on RFC 4122 and DCE 1.1","min_mondoo_version":"5.15.0","defaults":"value","provider":"go.mondoo.com/cnquery/providers/core"}}} \ No newline at end of file +{"resources":{"asset":{"id":"asset","name":"asset","fields":{"arch":{"name":"arch","type":"\u0007","is_mandatory":true,"title":"Architecture this OS is running on","provider":"go.mondoo.com/cnquery/providers/core"},"build":{"name":"build","type":"\u0007","is_mandatory":true,"title":"Build version of the platform (optional)","provider":"go.mondoo.com/cnquery/providers/core"},"family":{"name":"family","type":"\u0019\u0007","is_mandatory":true,"title":"List of platform families that this platform belongs to","provider":"go.mondoo.com/cnquery/providers/core"},"fqdn":{"name":"fqdn","type":"\u0007","is_mandatory":true,"title":"Fully qualified domain name (optional)","provider":"go.mondoo.com/cnquery/providers/core"},"ids":{"name":"ids","type":"\u0019\u0007","is_mandatory":true,"title":"All identifiers for this asset","provider":"go.mondoo.com/cnquery/providers/core"},"kind":{"name":"kind","type":"\u0007","is_mandatory":true,"title":"Kind of platform, for example:","desc":"api, baremetal, vm, vm-image, container, container-image, network, ...","provider":"go.mondoo.com/cnquery/providers/core"},"labels":{"name":"labels","type":"\u001a\u0007\u0007","is_mandatory":true,"title":"Optional platform information","provider":"go.mondoo.com/cnquery/providers/core"},"name":{"name":"name","type":"\u0007","is_mandatory":true,"title":"Human readable name of the asset","provider":"go.mondoo.com/cnquery/providers/core"},"platform":{"name":"platform","type":"\u0007","is_mandatory":true,"title":"Platform for this asset (redhat, windows, k8s-pod)","provider":"go.mondoo.com/cnquery/providers/core"},"runtime":{"name":"runtime","type":"\u0007","is_mandatory":true,"title":"Runtime is the specific kind of the platform. Examples include:","desc":"docker-container, podman-container, aws-ec2-instance, ...","provider":"go.mondoo.com/cnquery/providers/core"},"title":{"name":"title","type":"\u0007","is_mandatory":true,"title":"Human-readable title of the platform (e.g. \"Red Hat 8, Container\")","provider":"go.mondoo.com/cnquery/providers/core"},"version":{"name":"version","type":"\u0007","is_mandatory":true,"title":"Version of the platform","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"General asset information","min_mondoo_version":"6.13.0","defaults":"name platform version","provider":"go.mondoo.com/cnquery/providers/core"},"mondoo":{"id":"mondoo","name":"mondoo","fields":{"arch":{"name":"arch","type":"\u0007","title":"The architecture of this client (e.g. linux-amd64)","min_mondoo_version":"latest","provider":"go.mondoo.com/cnquery/providers/core"},"build":{"name":"build","type":"\u0007","title":"The build of the client (e.g. production, development)","provider":"go.mondoo.com/cnquery/providers/core"},"capabilities":{"name":"capabilities","type":"\u0019\u0007","title":"Connection capabilities","provider":"go.mondoo.com/cnquery/providers/core"},"jobEnvironment":{"name":"jobEnvironment","type":"\n","title":"Returns the agent execution environment","provider":"go.mondoo.com/cnquery/providers/core"},"version":{"name":"version","type":"\u0007","title":"Version of the client running on the asset","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"Provide contextual information about MQL runtime and environment","min_mondoo_version":"5.15.0","defaults":"version","provider":"go.mondoo.com/cnquery/providers/core"},"parse":{"id":"parse","name":"parse","title":"Parse provides common parsers (json, ini, certs, etc)","min_mondoo_version":"5.15.0","provider":"go.mondoo.com/cnquery/providers/core"},"regex":{"id":"regex","name":"regex","fields":{"creditCard":{"name":"creditCard","type":"\u0008","title":"Matches credit card numbers","provider":"go.mondoo.com/cnquery/providers/core"},"email":{"name":"email","type":"\u0008","title":"Matches email addresses","provider":"go.mondoo.com/cnquery/providers/core"},"emoji":{"name":"emoji","type":"\u0008","title":"Matches emojis","provider":"go.mondoo.com/cnquery/providers/core"},"ipv4":{"name":"ipv4","type":"\u0008","title":"Matches IPv4 addresses","provider":"go.mondoo.com/cnquery/providers/core"},"ipv6":{"name":"ipv6","type":"\u0008","title":"Matches IPv6 addresses","provider":"go.mondoo.com/cnquery/providers/core"},"mac":{"name":"mac","type":"\u0008","title":"Matches MAC addresses","provider":"go.mondoo.com/cnquery/providers/core"},"semver":{"name":"semver","type":"\u0008","title":"Matches semantic version numbers","provider":"go.mondoo.com/cnquery/providers/core"},"url":{"name":"url","type":"\u0008","title":"Matches URL addresses (HTTP/HTTPS)","provider":"go.mondoo.com/cnquery/providers/core"},"uuid":{"name":"uuid","type":"\u0008","title":"Matches hyphen-deliminated UUIDs","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"Builtin regular expression functions","min_mondoo_version":"5.15.0","provider":"go.mondoo.com/cnquery/providers/core"},"time":{"id":"time","name":"time","fields":{"day":{"name":"day","type":"\t","title":"One day, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"hour":{"name":"hour","type":"\t","title":"One hour, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"minute":{"name":"minute","type":"\t","title":"One minute, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"now":{"name":"now","type":"\t","title":"The current time on the local system","provider":"go.mondoo.com/cnquery/providers/core"},"second":{"name":"second","type":"\t","title":"One second, used for durations","provider":"go.mondoo.com/cnquery/providers/core"},"today":{"name":"today","type":"\t","title":"The current day starting at midnight","provider":"go.mondoo.com/cnquery/providers/core"},"tomorrow":{"name":"tomorrow","type":"\t","title":"The next day starting at midnight","provider":"go.mondoo.com/cnquery/providers/core"}},"title":"Date and time functions","min_mondoo_version":"5.15.0","provider":"go.mondoo.com/cnquery/providers/core"},"uuid":{"id":"uuid","name":"uuid","fields":{"urn":{"name":"urn","type":"\u0007","title":"URN returns the RFC 2141 URN form of uuid","provider":"go.mondoo.com/cnquery/providers/core"},"value":{"name":"value","type":"\u0007","is_mandatory":true,"title":"Canonical string representation xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","provider":"go.mondoo.com/cnquery/providers/core"},"variant":{"name":"variant","type":"\u0007","title":"Variant encoded in uuid","provider":"go.mondoo.com/cnquery/providers/core"},"version":{"name":"version","type":"\u0005","title":"Version of uuid","provider":"go.mondoo.com/cnquery/providers/core"}},"init":{"args":[{"name":"value","type":"\u0007"}]},"title":"UUIDs based on RFC 4122 and DCE 1.1","min_mondoo_version":"5.15.0","defaults":"value","provider":"go.mondoo.com/cnquery/providers/core"}}} \ No newline at end of file diff --git a/providers/gcp/config/config.go b/providers/gcp/config/config.go index b3a3a2b291..ef0e2fc4de 100644 --- a/providers/gcp/config/config.go +++ b/providers/gcp/config/config.go @@ -5,15 +5,19 @@ package config import ( "go.mondoo.com/cnquery/providers-sdk/v1/plugin" + "go.mondoo.com/cnquery/providers/gcp/connection/gcpinstancesnapshot" "go.mondoo.com/cnquery/providers/gcp/provider" "go.mondoo.com/cnquery/providers/gcp/resources" ) var Config = plugin.Provider{ - Name: "gcp", - ID: "go.mondoo.com/cnquery/providers/gcp", - Version: "9.0.0", - ConnectionTypes: []string{provider.ConnectionType}, + Name: "gcp", + ID: "go.mondoo.com/cnquery/providers/gcp", + Version: "9.0.0", + ConnectionTypes: []string{ + provider.ConnectionType, + string(gcpinstancesnapshot.SnapshotConnectionType), + }, Connectors: []plugin.Connector{ { Name: "gcp", @@ -47,6 +51,18 @@ var Config = plugin.Provider{ Default: "", Desc: "specify the GCR repository to scan (only used for gcr sub command)", }, + { + Long: "project-id", + Type: plugin.FlagType_String, + Default: "", + Desc: "specify the GCP project ID where the target instance is located (only used for snapshots)", + }, + { + Long: "zone", + Type: plugin.FlagType_String, + Default: "", + Desc: "specify the GCP zone where the target instance is located (only used for snapshots)", + }, }, }, }, diff --git a/providers/gcp/connection/connection.go b/providers/gcp/connection/connection.go index 4997f7615c..0f59538b86 100644 --- a/providers/gcp/connection/connection.go +++ b/providers/gcp/connection/connection.go @@ -10,6 +10,11 @@ import ( "go.mondoo.com/cnquery/providers-sdk/v1/inventory" "go.mondoo.com/cnquery/providers-sdk/v1/plugin" "go.mondoo.com/cnquery/providers-sdk/v1/vault" + "go.mondoo.com/cnquery/providers/gcp/connection/shared" +) + +const ( + Gcp shared.ConnectionType = "gcp" ) type ResourceType int @@ -20,6 +25,7 @@ const ( Organization Folder Gcr + Snapshot ) type GcpConnection struct { @@ -49,10 +55,7 @@ func NewGcpConnection(id uint32, asset *inventory.Asset, conf *inventory.Config) cred = conf.Credentials[0] } if conf.Type == "gcp" { - // FIXME: DEPRECATED, update in v8.0 vv - // The options "project" and "organization" have been deprecated in favor of project-id and organization-id - if conf.Options == nil || (conf.Options["project-id"] == "" && conf.Options["project"] == "" && conf.Options["organization-id"] == "" && conf.Options["organization"] == "" && conf.Options["folder-id"] == "") { - // ^^ + if conf.Options == nil || (conf.Options["project-id"] == "" && conf.Options["organization-id"] == "" && conf.Options["folder-id"] == "") { return nil, errors.New("google provider requires a gcp organization id, gcp project id or google workspace customer id. please set option `project-id` or `organization-id` or `customer-id` or `folder-id`") } } else { @@ -64,24 +67,18 @@ func NewGcpConnection(id uint32, asset *inventory.Asset, conf *inventory.Config) if _, ok := conf.Options["repository"]; ok { resourceType = Gcr resourceID = conf.Options["project-id"] - - // FIXME: DEPRECATED, remove in v8.0 vv - // The options "project" and "organization" have been deprecated in favor of project-id and organization-id - } else if conf.Options["project"] != "" { - resourceType = Project - resourceID = conf.Options["project"] - // ^^ - } else if conf.Options["organization-id"] != "" { resourceType = Organization resourceID = conf.Options["organization-id"] - } else if conf.Options["folder-id"] != "" { resourceType = Folder resourceID = conf.Options["folder-id"] } else if conf.Options["project-id"] != "" { resourceType = Project resourceID = conf.Options["project-id"] + } else if conf.Options["snapshot-name"] != "" { + resourceType = Snapshot + resourceID = conf.Options["snapshot-name"] } var override string @@ -124,3 +121,11 @@ func (c *GcpConnection) ID() uint32 { func (c *GcpConnection) Asset() *inventory.Asset { return c.asset } + +func (c *GcpConnection) Type() shared.ConnectionType { + return Gcp +} + +func (c *GcpConnection) Config() *inventory.Config { + return c.Conf +} diff --git a/_motor/providers/gcpinstancesnapshot/platform.go b/providers/gcp/connection/gcpinstancesnapshot/platform.go similarity index 100% rename from _motor/providers/gcpinstancesnapshot/platform.go rename to providers/gcp/connection/gcpinstancesnapshot/platform.go diff --git a/_motor/providers/gcpinstancesnapshot/provider.go b/providers/gcp/connection/gcpinstancesnapshot/provider.go similarity index 63% rename from _motor/providers/gcpinstancesnapshot/provider.go rename to providers/gcp/connection/gcpinstancesnapshot/provider.go index 2d7b47a757..ff041980b2 100644 --- a/_motor/providers/gcpinstancesnapshot/provider.go +++ b/providers/gcp/connection/gcpinstancesnapshot/provider.go @@ -9,24 +9,17 @@ import ( "github.com/cockroachdb/errors" "github.com/rs/zerolog/log" - "go.mondoo.com/cnquery/motor/motorid/gce" - "go.mondoo.com/cnquery/motor/platform/detector" - "go.mondoo.com/cnquery/motor/providers" - "go.mondoo.com/cnquery/motor/providers/fs" - "go.mondoo.com/cnquery/motor/providers/local" - "go.mondoo.com/cnquery/motor/providers/os" - "go.mondoo.com/cnquery/motor/providers/os/snapshot" "go.mondoo.com/cnquery/mrn" + "go.mondoo.com/cnquery/providers-sdk/v1/inventory" + "go.mondoo.com/cnquery/providers/gcp/connection/shared" + "go.mondoo.com/cnquery/providers/os/connection" + "go.mondoo.com/cnquery/providers/os/connection/snapshot" + "go.mondoo.com/cnquery/providers/os/detector" + "go.mondoo.com/cnquery/providers/os/id/gce" "go.mondoo.com/ranger-rpc/codes" "go.mondoo.com/ranger-rpc/status" ) -var ( - _ providers.Instance = (*Provider)(nil) - _ providers.PlatformIdentifier = (*Provider)(nil) - _ os.OperatingSystemProvider = (*Provider)(nil) -) - type scanTarget struct { TargetType string ProjectID string @@ -35,6 +28,10 @@ type scanTarget struct { SnapshotName string } +const ( + SnapshotConnectionType shared.ConnectionType = "gcp-snapshot" +) + type scannerInstance struct { projectID string zone string @@ -46,23 +43,20 @@ type mountInfo struct { diskUrl string } -func determineScannerInstanceInfo() (*scannerInstance, error) { - localProvider, err := local.New() - if err != nil { - return nil, err - } - localProviderDetector := detector.New(localProvider) - pf, err := localProviderDetector.Platform() - if err != nil { - return nil, err +func determineScannerInstanceInfo(id uint32, conf *inventory.Config, asset *inventory.Asset) (*scannerInstance, error) { + // FIXME: need to pass conf + localConn := connection.NewLocalConnection(id, conf, asset) + pf, detected := detector.DetectOS(localConn) + if !detected { + return nil, errors.New("could not detect platform") } - scannerInstanceInfo, err := gce.Resolve(localProvider, pf) + scannerInstanceInfo, err := gce.Resolve(localConn, pf) if err != nil { - return nil, errors.New("gcp snapshot provider needs to run on a gcp instance") + return nil, errors.New("GCP snapshot provider must run from a GCP VM instance") } identity, err := scannerInstanceInfo.Identify() if err != nil { - return nil, errors.New("gcp snapshot provider needs to run on a gcp instance") + return nil, errors.New("GCP snapshot provider must run from a GCP VM instance") } instanceID := identity.PlatformMrn @@ -92,21 +86,21 @@ func determineScannerInstanceInfo() (*scannerInstance, error) { }, nil } -func ParseTarget(pCfg *providers.Config) scanTarget { +func ParseTarget(conf *inventory.Config) scanTarget { return scanTarget{ - TargetType: pCfg.Options["type"], - ProjectID: pCfg.Options["project-id"], - Zone: pCfg.Options["zone"], - InstanceName: pCfg.Options["instance-name"], - SnapshotName: pCfg.Options["snapshot-name"], + TargetType: conf.Options["type"], + ProjectID: conf.Options["project-id"], + Zone: conf.Options["zone"], + InstanceName: conf.Options["instance-name"], + SnapshotName: conf.Options["snapshot-name"], } } -func New(pCfg *providers.Config) (*Provider, error) { - target := ParseTarget(pCfg) +func NewGcpSnapshotConnection(id uint32, conf *inventory.Config, asset *inventory.Asset) (*GcpSnapshotConnection, error) { + target := ParseTarget(conf) // check if we run on a gcp instance - scanner, err := determineScannerInstanceInfo() + scanner, err := determineScannerInstanceInfo(id, conf, asset) if err != nil { return nil, err } @@ -132,7 +126,7 @@ func New(pCfg *providers.Config) (*Provider, error) { return nil, fmt.Errorf("could not find boot disk for instance %s", target.InstanceName) } - if pCfg.Options["create-snapshot"] != "true" { + if conf.Options["create-snapshot"] != "true" { // search for the latest snapshot for this machine snapshotUrl, created, err := sc.searchLatestSnapshot(target.ProjectID, instanceInfo.BootDiskSourceURL) if status.Code(err) == codes.NotFound { @@ -215,35 +209,49 @@ func New(pCfg *providers.Config) (*Provider, error) { return nil, err } + conf.Options["path"] = volumeMounter.ScanDir // create and initialize fs provider - fsProvider, err := fs.New(&providers.Config{ + fsConn, err := connection.NewFileSystemConnection(id, &inventory.Config{ Path: volumeMounter.ScanDir, - Backend: providers.ProviderType_FS, - PlatformId: pCfg.PlatformId, - Options: pCfg.Options, - }) + Backend: "fs", + PlatformId: conf.PlatformId, + Options: conf.Options, + Type: conf.Type, + }, asset) if err != nil { errorHandler() return nil, err } - p := &Provider{ - Provider: fsProvider, - opts: pCfg.Options, - targetType: target.TargetType, - volumeMounter: volumeMounter, - snapshotCreator: sc, - target: target, - scanner: *scanner, - mountInfo: mi, - identifier: pCfg.PlatformId, + c := &GcpSnapshotConnection{ + FileSystemConnection: fsConn, + opts: conf.Options, + targetType: target.TargetType, + volumeMounter: volumeMounter, + snapshotCreator: sc, + target: target, + scanner: *scanner, + mountInfo: mi, + identifier: conf.PlatformId, } - return p, nil + var ok bool + asset.Platform, ok = detector.DetectOS(fsConn) + if !ok { + return nil, errors.New("failed to detect OS") + } + asset.Id = conf.Type + asset.Name = conf.Options["snapshot-name"] + asset.Platform.Kind = c.Kind() + asset.Platform.Runtime = c.Runtime() + platformId := fmt.Sprintf("//platformid.api.mondoo.app/runtime/gcp/compute/v1/projects/%s/snapshots/%s", conf.Options["project-id"], conf.Options["snapshot-name"]) + asset.PlatformIds = []string{platformId} + + return c, nil } -type Provider struct { - *fs.Provider +type GcpSnapshotConnection struct { + *connection.FileSystemConnection opts map[string]string // the type of object we're targeting (instance, disk, snapshot) targetType string @@ -255,60 +263,62 @@ type Provider struct { identifier string } -func (p *Provider) Close() { - if p == nil { +func (c *GcpSnapshotConnection) Close() { + log.Debug().Msg("closing gcp snapshot connection") + if c == nil { return } - if p.opts != nil { - if p.opts[snapshot.NoSetup] == "true" { + if c.opts != nil { + if c.opts[snapshot.NoSetup] == "true" { return } } - err := p.volumeMounter.UnmountVolumeFromInstance() + err := c.volumeMounter.UnmountVolumeFromInstance() if err != nil { log.Error().Err(err).Msg("unable to unmount volume") } - if p.snapshotCreator != nil { - err = p.snapshotCreator.detachDisk(p.scanner.projectID, p.scanner.zone, p.scanner.instanceName, p.mountInfo.deviceName) + if c.snapshotCreator != nil { + err = c.snapshotCreator.detachDisk(c.scanner.projectID, c.scanner.zone, c.scanner.instanceName, c.mountInfo.deviceName) if err != nil { log.Error().Err(err).Msg("unable to detach volume") } - err = p.snapshotCreator.deleteCreatedDisk(p.mountInfo.diskUrl) + err = c.snapshotCreator.deleteCreatedDisk(c.mountInfo.diskUrl) if err != nil { log.Error().Err(err).Msg("could not delete created disk") } } - err = p.volumeMounter.RemoveTempScanDir() + err = c.volumeMounter.RemoveTempScanDir() if err != nil { log.Error().Err(err).Msg("unable to remove dir") } } -func (p *Provider) Capabilities() providers.Capabilities { - return providers.Capabilities{ - providers.Capability_Aws_Ebs, - } +func (c *GcpSnapshotConnection) Capabilities() shared.Capabilities { + // FIXME: this looks strange in a gcp package, but it's C&P from v8 + return shared.Capability_Aws_Ebs } -func (p *Provider) Kind() providers.Kind { - return providers.Kind_KIND_API +func (c *GcpSnapshotConnection) Kind() string { + return "api" } -func (p *Provider) Runtime() string { - return providers.RUNTIME_GCP_COMPUTE +func (c *GcpSnapshotConnection) Runtime() string { + return "gcp-vm" } -func (p *Provider) PlatformIdDetectors() []providers.PlatformIdDetector { - return []providers.PlatformIdDetector{ - providers.TransportPlatformIdentifierDetector, - } +func (c *GcpSnapshotConnection) Identifier() (string, error) { + return c.identifier, nil +} + +func (c *GcpSnapshotConnection) Type() shared.ConnectionType { + return SnapshotConnectionType } -func (p *Provider) Identifier() (string, error) { - return p.identifier, nil +func (c *GcpSnapshotConnection) Config() *inventory.Config { + return c.FileSystemConnection.Conf } diff --git a/_motor/providers/gcpinstancesnapshot/snapshot.go b/providers/gcp/connection/gcpinstancesnapshot/snapshot.go similarity index 90% rename from _motor/providers/gcpinstancesnapshot/snapshot.go rename to providers/gcp/connection/gcpinstancesnapshot/snapshot.go index 0ceca4536a..caf48f13f1 100644 --- a/_motor/providers/gcpinstancesnapshot/snapshot.go +++ b/providers/gcp/connection/gcpinstancesnapshot/snapshot.go @@ -12,7 +12,7 @@ import ( "time" "github.com/rs/zerolog/log" - "go.mondoo.com/cnquery/motor/motorid/gce" + "go.mondoo.com/cnquery/providers/os/id/gce" "go.mondoo.com/ranger-rpc/codes" "go.mondoo.com/ranger-rpc/status" googleoauth "golang.org/x/oauth2/google" @@ -206,7 +206,12 @@ func (sc *SnapshotCreator) createDisk(disk *compute.Disk, projectID, zone, diskN } if operation.Status == "DONE" { if operation.Error != nil { - return clonedDiskUrl, fmt.Errorf("operation failed: %+v", operation.Error.Errors) + errMessage, _ := operation.Error.MarshalJSON() + log.Debug().Str("error", string(errMessage)).Msg("operation failed") + if len(operation.Error.Errors) > 0 { + errMessage = []byte(operation.Error.Errors[0].Message) + } + return clonedDiskUrl, fmt.Errorf("create disk failed: %s", errMessage) } clonedDiskUrl = operation.TargetLink break @@ -267,7 +272,12 @@ func (sc *SnapshotCreator) attachDisk(projectID, zone, instanceName, sourceDiskU } if operation.Status == "DONE" { if operation.Error != nil { - return fmt.Errorf("operation failed: %+v", operation.Error.Errors) + errMessage, _ := operation.Error.MarshalJSON() + log.Debug().Str("error", string(errMessage)).Msg("operation failed") + if len(operation.Error.Errors) > 0 { + errMessage = []byte(operation.Error.Errors[0].Message) + } + return fmt.Errorf("attach disk failed: %s", errMessage) } break } @@ -284,7 +294,7 @@ func (sc *SnapshotCreator) detachDisk(projectID, zone, instanceName, deviceName return err } - // attach the disk to the instance + // detach the disk from the instance op, err := computeService.Instances.DetachDisk(projectID, zone, instanceName, deviceName).Context(ctx).Do() if err != nil { return err @@ -298,7 +308,12 @@ func (sc *SnapshotCreator) detachDisk(projectID, zone, instanceName, deviceName } if operation.Status == "DONE" { if operation.Error != nil { - return fmt.Errorf("operation failed: %+v", operation.Error.Errors) + errMessage, _ := operation.Error.MarshalJSON() + log.Debug().Str("error", string(errMessage)).Msg("operation failed") + if len(operation.Error.Errors) > 0 { + errMessage = []byte(operation.Error.Errors[0].Message) + } + return fmt.Errorf("detach disk failed: %s", errMessage) } break } diff --git a/_motor/providers/gcpinstancesnapshot/snapshot_debug_test.go b/providers/gcp/connection/gcpinstancesnapshot/snapshot_debug_test.go similarity index 100% rename from _motor/providers/gcpinstancesnapshot/snapshot_debug_test.go rename to providers/gcp/connection/gcpinstancesnapshot/snapshot_debug_test.go diff --git a/_motor/providers/gcpinstancesnapshot/snapshot_test.go b/providers/gcp/connection/gcpinstancesnapshot/snapshot_test.go similarity index 100% rename from _motor/providers/gcpinstancesnapshot/snapshot_test.go rename to providers/gcp/connection/gcpinstancesnapshot/snapshot_test.go diff --git a/providers/gcp/connection/shared/shared.go b/providers/gcp/connection/shared/shared.go new file mode 100644 index 0000000000..e8ddba915f --- /dev/null +++ b/providers/gcp/connection/shared/shared.go @@ -0,0 +1,24 @@ +// Copyright (c) Mondoo, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package shared + +import ( + "go.mondoo.com/cnquery/providers-sdk/v1/inventory" +) + +type ConnectionType string + +type GcpConnection interface { + ID() uint32 + Name() string + Type() ConnectionType + Config() *inventory.Config + Asset() *inventory.Asset +} + +type Capabilities byte + +const ( + Capability_Aws_Ebs Capabilities = 1 << iota +) diff --git a/providers/gcp/go.mod b/providers/gcp/go.mod index 11e07e15d1..b34b2487da 100644 --- a/providers/gcp/go.mod +++ b/providers/gcp/go.mod @@ -21,10 +21,13 @@ require ( cloud.google.com/go/serviceusage v1.7.1 github.com/aws/smithy-go v1.14.2 github.com/google/go-containerregistry v0.16.1 + github.com/cockroachdb/errors v1.9.1 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/rs/zerolog v1.30.0 github.com/stretchr/testify v1.8.4 go.mondoo.com/cnquery v0.0.0-00010101000000-000000000000 + go.mondoo.com/ranger-rpc v0.0.0-20230328135530-12135c17095f + golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea golang.org/x/oauth2 v0.11.0 google.golang.org/api v0.138.0 google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 @@ -34,21 +37,48 @@ require ( require ( cloud.google.com/go v0.110.6 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Masterminds/semver v1.5.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect github.com/andybalholm/brotli v1.0.4 // indirect github.com/apache/arrow/go/v12 v12.0.0 // indirect github.com/apache/thrift v0.16.0 // indirect + github.com/aws/aws-sdk-go-v2 v1.21.0 // indirect + github.com/aws/aws-sdk-go-v2/config v1.18.37 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.35 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 // indirect + github.com/aws/aws-sdk-go-v2/service/ec2 v1.92.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ec2instanceconnect v1.15.6 // indirect + github.com/aws/aws-sdk-go-v2/service/ecr v1.19.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.17.5 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect + github.com/aws/aws-sdk-go-v2/service/ssm v1.36.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 // indirect + github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230823232655-ce48fc331ac7 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/cockroachdb/errors v1.9.1 // indirect github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect github.com/cockroachdb/redact v1.1.3 // indirect + github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v24.0.0+incompatible // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.5+incompatible // indirect github.com/docker/docker-credential-helpers v0.8.0 // indirect + github.com/docker/cli v24.0.0+incompatible // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect + github.com/docker/docker v24.0.5+incompatible // indirect + github.com/docker/docker-credential-helpers v0.8.0 // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/fatih/color v1.15.0 // indirect github.com/getsentry/sentry-go v0.13.0 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/goccy/go-json v0.9.11 // indirect github.com/gofrs/uuid v4.3.1+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -58,6 +88,7 @@ require ( github.com/golang/snappy v0.0.4 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-containerregistry v0.16.1 // indirect github.com/google/s2a-go v0.1.5 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect @@ -65,10 +96,15 @@ require ( github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-plugin v1.4.8 // indirect github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect + github.com/hnakamur/go-scp v1.0.2 // indirect github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/klauspost/asmfmt v1.3.2 // indirect github.com/klauspost/compress v1.16.5 // indirect github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/kr/fs v0.1.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect @@ -82,17 +118,22 @@ require ( github.com/muesli/termenv v0.15.2 // indirect github.com/oklog/run v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc3 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/sftp v1.13.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/segmentio/fasthash v1.0.3 // indirect github.com/segmentio/ksuid v1.0.4 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sethvargo/go-password v0.2.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/afero v1.9.5 // indirect + github.com/vbatts/tar-split v0.11.3 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect - go.mondoo.com/ranger-rpc v0.0.0-20230328135530-12135c17095f // indirect go.opencensus.io v0.24.0 // indirect golang.org/x/crypto v0.12.0 // indirect golang.org/x/mod v0.10.0 // indirect diff --git a/providers/gcp/go.sum b/providers/gcp/go.sum index 23a6cf2247..880b795182 100644 --- a/providers/gcp/go.sum +++ b/providers/gcp/go.sum @@ -71,7 +71,11 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= @@ -79,7 +83,11 @@ github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c h1:RGWPOewvK github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= +github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= @@ -89,8 +97,47 @@ github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/P github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aws/aws-sdk-go-v2 v1.17.7/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= +github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= +github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= +github.com/aws/aws-sdk-go-v2/config v1.18.37 h1:RNAfbPqw1CstCooHaTPhScz7z1PyocQj0UL+l95CgzI= +github.com/aws/aws-sdk-go-v2/config v1.18.37/go.mod h1:8AnEFxW9/XGKCbjYDCJy7iltVNyEI9Iu9qC21UzhhgQ= +github.com/aws/aws-sdk-go-v2/credentials v1.13.35 h1:QpsNitYJu0GgvMBLUIYu9H4yryA5kMksjeIVQfgXrt8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.35/go.mod h1:o7rCaLtvK0hUggAGclf76mNGGkaG5a9KWlp+d9IpcV8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31/go.mod h1:QT0BqUvX1Bh2ABdTGnjqEjvjzrCfIniM9Sc8zn9Yndo= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25/go.mod h1:zBHOPwhBc3FlQjQJE/D3IfPWiWaQmT06Vq9aNukDo0k= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 h1:SijA0mgjV8E+8G45ltVHs0fvKpTj8xmZJ3VwhGKtUSI= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 h1:GPUcE/Yq7Ur8YSUk6lVkoIMWnJNO0HT18GUzCWCgCI0= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.92.1 h1:xn5CI639mnWvdiweqoRx/H221Ia9Asx9XxfIRhe0MPo= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.92.1/go.mod h1:ZZLfkd1Y7fjXujjMg1CFqNmaTl314eCbShlHQO7VTWo= +github.com/aws/aws-sdk-go-v2/service/ec2instanceconnect v1.15.6 h1:KJnKe1kdcFBTroYoB9er25kadj+hdkuNb/s7WbdCnYU= +github.com/aws/aws-sdk-go-v2/service/ec2instanceconnect v1.15.6/go.mod h1:RCkBh2Z5n5/U74VwgoKB3jM7Bo9XzIT0bmnBL36LsY8= +github.com/aws/aws-sdk-go-v2/service/ecr v1.19.5 h1:hg2/a7rE9dwYr+/DPNzHQ+IsHXLNt1NsQVUecBtA8os= +github.com/aws/aws-sdk-go-v2/service/ecr v1.19.5/go.mod h1:pGwmNL8hN0jpBfKfTbmu+Rl0bJkDhaGl+9PQLrZ4KLo= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.17.5 h1:GCIkEQp+7Vt7NmBHB+/1qPYHl6Kg3L0Bg3DJ2v1Oi08= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.17.5/go.mod h1:uRNeiRoKCWT9aVtmX8mvUlDDgq+gmHLF6pGxVS7J6SY= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25/go.mod h1:/95IA+0lMnzW6XzqYJRpjjsAbKEORVeO0anQqjd2CNU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 h1:CdzPW9kKitgIiLV1+MHobfR5Xg25iYnyzWZhyQuSlDI= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35/go.mod h1:QGF2Rs33W5MaN9gYdEQOBBFPLwTZkEhRwI33f7KIG0o= +github.com/aws/aws-sdk-go-v2/service/ssm v1.36.0 h1:L1gK0SF7Filotf8Jbhiq0Y+rKVs/W1av8MH0+AXPrAg= +github.com/aws/aws-sdk-go-v2/service/ssm v1.36.0/go.mod h1:nCdeJmEFby1HKwKhDdKdVxPOJQUNht7Ngw+ejzbzvDU= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 h1:oCvTFSDi67AX0pOX3PuPdGFewvLRU2zzFSrTsgURNo0= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.5/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 h1:dnInJb4S0oy8aQuri1mV6ipLlnZPfnsDNB9BGO9PDNY= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= +github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 h1:CQBFElb0LS8RojMJlxRSo/HXipvTZW2S44Lt9Mk2aYQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.21.5/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU= +github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230823232655-ce48fc331ac7 h1:Q9N/BxETE9cNhAA2EOIfl+VxTQScsNNBpC8536vwkJI= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230823232655-ce48fc331ac7/go.mod h1:TfHDjqSwGGoCUCnvy2LBziYXrjh+G+GbdlPc4vbiENY= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= @@ -115,12 +162,17 @@ github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9D github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= +github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -134,6 +186,18 @@ github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3sm github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40= +github.com/docker/cli v24.0.0+incompatible h1:0+1VshNwBQzQAx9lOl+OYCTCEAD8fKs/qeXMx3O0wqM= +github.com/docker/cli v24.0.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= +github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= +github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -167,6 +231,10 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -284,6 +352,10 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hnakamur/go-scp v1.0.2 h1:i2I0O0pjAaX4BXJFrp1blsIdjOBekc5QOaB0AbdO1d0= +github.com/hnakamur/go-scp v1.0.2/go.mod h1:Dh9GtPFBkiDI1KY1nmf+W7eVCWWmRjJitkCYgvWv+Zc= +github.com/hnakamur/go-sshd v0.0.0-20170228152141-dccc3399d26a h1:p8dbHRhXhPSwVZqk76FguLzyeCZuvCqFlaYSqXOzbyI= +github.com/hnakamur/go-sshd v0.0.0-20170228152141-dccc3399d26a/go.mod h1:R+6I3EdoV6ofbNqJsArhT9+Pnu57DxtmDJAQfxkCbGo= github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f h1:7LYC+Yfkj3CTRcShK0KOL/w6iTiKyqqBA9a41Wnggw8= github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -298,7 +370,9 @@ github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7Ua github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -312,6 +386,10 @@ github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYb github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= @@ -323,12 +401,15 @@ github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -366,10 +447,12 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= @@ -384,6 +467,10 @@ github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8= +github.com/opencontainers/image-spec v1.1.0-rc3/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= @@ -394,6 +481,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pkg/sftp v1.13.5 h1:a3RLUqkyjYRtBTZJZ1VRrKbN3zhuPLlUc3sphVz81go= +github.com/pkg/sftp v1.13.5/go.mod h1:wHDZ0IZX6JcBYRK1TH9bcVq8G7TLpVHYIGJRFnmPfxg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -411,6 +500,7 @@ github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM= @@ -418,9 +508,14 @@ github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KR github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c= github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sethvargo/go-password v0.2.0 h1:BTDl4CC/gjf/axHMaDQtw507ogrXLci6XRiLc7i/UHI= +github.com/sethvargo/go-password v0.2.0/go.mod h1:Ym4Mr9JXLBycr02MFuVQ/0JHidNetSgbzutTr3zsYXE= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= @@ -451,12 +546,15 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck= +github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -495,9 +593,11 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= @@ -622,6 +722,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -639,6 +740,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200828081204-131dc92a58d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -652,15 +754,18 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220906165534-d0df966e6959/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -683,6 +788,7 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/providers/gcp/provider/provider.go b/providers/gcp/provider/provider.go index e6ddb4079a..c8b294f805 100644 --- a/providers/gcp/provider/provider.go +++ b/providers/gcp/provider/provider.go @@ -16,10 +16,14 @@ import ( "go.mondoo.com/cnquery/providers-sdk/v1/plugin" "go.mondoo.com/cnquery/providers-sdk/v1/upstream" "go.mondoo.com/cnquery/providers/gcp/connection" + "go.mondoo.com/cnquery/providers/gcp/connection/gcpinstancesnapshot" + "go.mondoo.com/cnquery/providers/gcp/connection/shared" "go.mondoo.com/cnquery/providers/gcp/resources" ) -const ConnectionType = "gcp" +const ( + ConnectionType = "gcp" +) type Service struct { runtimes map[uint32]*plugin.Runtime @@ -74,7 +78,7 @@ func (s *Service) ParseCLI(req *plugin.ParseCLIReq) (*plugin.ParseCLIRes, error) } if len(req.Args) != 2 { - return nil, errors.New("missing argument, use `gcp project id` or `gcp organization id` or `gcp folder id`") + return nil, errors.New("missing argument, use `gcp project id`, `gcp organization id`, `gcp folder id` or `gcp snapshot name`") } conf := &inventory.Config{ @@ -88,6 +92,18 @@ func (s *Service) ParseCLI(req *plugin.ParseCLIReq) (*plugin.ParseCLIRes, error) credentialsPath = string(x.Value) } + // these flags are currently only used for the snapshot sub-command + var projectId string + if x, ok := flags["project-id"]; ok && len(x.Value) != 0 { + projectId = string(x.Value) + } + + var zone string + if x, ok := flags["zone"]; ok && len(x.Value) != 0 { + zone = string(x.Value) + } + // ^^ snapshot flags + envVars := []string{ "GOOGLE_APPLICATION_CREDENTIALS", "GOOGLE_CREDENTIALS", @@ -102,6 +118,19 @@ func (s *Service) ParseCLI(req *plugin.ParseCLIReq) (*plugin.ParseCLIRes, error) }) } + // parse discovery flags + conf.Discover = &inventory.Discovery{ + Targets: []string{}, + } + if x, ok := flags["discover"]; ok && len(x.Array) != 0 { + for i := range x.Array { + entry := string(x.Array[i].Value) + conf.Discover.Targets = append(conf.Discover.Targets, entry) + } + } else { + conf.Discover.Targets = []string{resources.DiscoveryAuto} + } + switch req.Args[0] { case "org": conf.Options["organization-id"] = req.Args[1] @@ -113,25 +142,19 @@ func (s *Service) ParseCLI(req *plugin.ParseCLIReq) (*plugin.ParseCLIRes, error) conf.Options["project-id"] = req.Args[1] conf.Options["repository"] = string(flags["repository"].Value) conf.Runtime = "gcp-gcr" + case "snapshot": + conf.Options["snapshot-name"] = req.Args[1] + conf.Options["project-id"] = projectId + conf.Options["zone"] = zone + conf.Options["type"] = "snapshot" + conf.Type = string(gcpinstancesnapshot.SnapshotConnectionType) + conf.Discover = nil } asset := inventory.Asset{ Connections: []*inventory.Config{conf}, } - // parse discovery flags - conf.Discover = &inventory.Discovery{ - Targets: []string{}, - } - if x, ok := flags["discover"]; ok && len(x.Array) != 0 { - for i := range x.Array { - entry := string(x.Array[i].Value) - conf.Discover.Targets = append(conf.Discover.Targets, entry) - } - } else { - conf.Discover.Targets = []string{resources.DiscoveryAuto} - } - return &plugin.ParseCLIRes{Asset: &asset}, nil } @@ -152,10 +175,13 @@ func (s *Service) Connect(req *plugin.ConnectReq, callback plugin.ProviderCallba } } + var inventory *inventory.Inventory // discovery assets for further scanning - inventory, err := s.discover(conn) - if err != nil { - return nil, err + if conn.Config().Discover != nil { + inventory, err = s.discover(conn) + if err != nil { + return nil, err + } } return &plugin.ConnectRes{ @@ -170,20 +196,35 @@ func (s *Service) Connect(req *plugin.ConnectReq, callback plugin.ProviderCallba // It is not necessary to implement this method. // If you want to do some cleanup, you can do it here. func (s *Service) Shutdown(req *plugin.ShutdownReq) (*plugin.ShutdownRes, error) { + for i := range s.runtimes { + runtime := s.runtimes[i] + // FIXME: I think, we might need the asset here to cleanup the correct connection + sharedConn := runtime.Connection.(shared.GcpConnection) + if sharedConn.Type() == gcpinstancesnapshot.SnapshotConnectionType { + conn := runtime.Connection.(*gcpinstancesnapshot.GcpSnapshotConnection) + conn.Close() + } + } return &plugin.ShutdownRes{}, nil } -func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallback) (*connection.GcpConnection, error) { +func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallback) (shared.GcpConnection, error) { if len(req.Asset.Connections) == 0 { return nil, errors.New("no connection options for asset") } asset := req.Asset conf := asset.Connections[0] - var conn *connection.GcpConnection + var conn shared.GcpConnection var err error switch conf.Type { + case string(gcpinstancesnapshot.SnapshotConnectionType): + // A GcpSnapshotConnection is a wrapper around a FilesystemConnection + // To make sure the connection is later handled by the os provider, override the type + conf.Type = "filesystem" + s.lastConnectionID++ + conn, err = gcpinstancesnapshot.NewGcpSnapshotConnection(s.lastConnectionID, conf, asset) default: s.lastConnectionID++ conn, err = connection.NewGcpConnection(s.lastConnectionID, asset, conf) @@ -213,25 +254,28 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba return conn, err } -func (s *Service) detect(asset *inventory.Asset, conn *connection.GcpConnection) error { +func (s *Service) detect(asset *inventory.Asset, conn shared.GcpConnection) error { // TODO: adjust asset detection - asset.Id = conn.Conf.Type - asset.Name = conn.Conf.Host + asset.Id = conn.Config().Type + asset.Name = conn.Config().Host - asset.Platform = &inventory.Platform{ - Name: "gcp", - Family: []string{"gcp"}, - Kind: "api", - Title: "GCP Cloud", + switch conn.Config().Type { + default: + asset.Platform = &inventory.Platform{ + Name: "gcp", + Family: []string{"gcp"}, + Kind: "api", + Title: "GCP Cloud", + } + // TODO: Add platform IDs + asset.PlatformIds = []string{"//platformid.api.mondoo.app/runtime/gcp/"} } - // TODO: Add platform IDs - asset.PlatformIds = []string{"//platformid.api.mondoo.app/runtime/gcp/"} return nil } -func (s *Service) discover(conn *connection.GcpConnection) (*inventory.Inventory, error) { - if conn.Conf.Discover == nil { +func (s *Service) discover(conn shared.GcpConnection) (*inventory.Inventory, error) { + if conn.Config().Discover == nil { return nil, nil } diff --git a/providers/os/connection/filesystem.go b/providers/os/connection/filesystem.go index 96bd554e1b..9e30e6b7b8 100644 --- a/providers/os/connection/filesystem.go +++ b/providers/os/connection/filesystem.go @@ -35,7 +35,7 @@ func NewFileSystemConnectionWithClose(id uint32, conf *inventory.Config, assert return &FileSystemConnection{ id: id, - conf: conf, + Conf: conf, asset: assert, MountedDir: path, closeFN: closeFN, @@ -49,7 +49,7 @@ func NewFileSystemConnection(id uint32, conf *inventory.Config, assert *inventor type FileSystemConnection struct { id uint32 - conf *inventory.Config + Conf *inventory.Config asset *inventory.Asset MountedDir string diff --git a/providers/os/connection/local.go b/providers/os/connection/local.go index b7d7bd11dc..6187281fd0 100644 --- a/providers/os/connection/local.go +++ b/providers/os/connection/local.go @@ -77,7 +77,7 @@ func (p *LocalConnection) RunCommand(command string) (*shared.Command, error) { command = shared.BuildSudoCommand(p.Sudo, command) } log.Debug().Msgf("local> run command %s", command) - c := &commandRunner{Shell: p.shell} + c := &CommandRunner{Shell: p.shell} args := []string{} res, err := c.Exec(command, args) @@ -121,13 +121,13 @@ func (p *LocalConnection) Close() { // TODO: we need to close all commands and file handles } -type commandRunner struct { +type CommandRunner struct { shared.Command cmdExecutor *exec.Cmd Shell []string } -func (c *commandRunner) Exec(usercmd string, args []string) (*shared.Command, error) { +func (c *CommandRunner) Exec(usercmd string, args []string) (*shared.Command, error) { c.Command.Stats.Start = time.Now() var cmd string diff --git a/_motor/providers/os/snapshot/blockdevices.go b/providers/os/connection/snapshot/blockdevices.go similarity index 100% rename from _motor/providers/os/snapshot/blockdevices.go rename to providers/os/connection/snapshot/blockdevices.go diff --git a/_motor/providers/os/snapshot/blockdevices_test.go b/providers/os/connection/snapshot/blockdevices_test.go similarity index 100% rename from _motor/providers/os/snapshot/blockdevices_test.go rename to providers/os/connection/snapshot/blockdevices_test.go diff --git a/providers/os/connection/snapshot/localcmd.go b/providers/os/connection/snapshot/localcmd.go new file mode 100644 index 0000000000..1dbd5d0ebf --- /dev/null +++ b/providers/os/connection/snapshot/localcmd.go @@ -0,0 +1,21 @@ +// Copyright (c) Mondoo, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package snapshot + +import ( + "go.mondoo.com/cnquery/providers/os/connection" + "go.mondoo.com/cnquery/providers/os/connection/shared" +) + +type LocalCommandRunner struct { + shell []string +} + +func (r *LocalCommandRunner) RunCommand(command string) (*shared.Command, error) { + c := connection.CommandRunner{Shell: r.shell} + args := []string{} + + res, err := c.Exec(command, args) + return res, err +} diff --git a/_motor/providers/os/snapshot/mount_linux.go b/providers/os/connection/snapshot/mount_linux.go similarity index 100% rename from _motor/providers/os/snapshot/mount_linux.go rename to providers/os/connection/snapshot/mount_linux.go diff --git a/_motor/providers/os/snapshot/mount_other.go b/providers/os/connection/snapshot/mount_other.go similarity index 100% rename from _motor/providers/os/snapshot/mount_other.go rename to providers/os/connection/snapshot/mount_other.go diff --git a/_motor/providers/os/snapshot/testdata/rhel8.json b/providers/os/connection/snapshot/testdata/rhel8.json similarity index 100% rename from _motor/providers/os/snapshot/testdata/rhel8.json rename to providers/os/connection/snapshot/testdata/rhel8.json diff --git a/_motor/providers/os/snapshot/testdata/rhel8_nolabels.json b/providers/os/connection/snapshot/testdata/rhel8_nolabels.json similarity index 100% rename from _motor/providers/os/snapshot/testdata/rhel8_nolabels.json rename to providers/os/connection/snapshot/testdata/rhel8_nolabels.json diff --git a/_motor/providers/os/snapshot/volumemounter.go b/providers/os/connection/snapshot/volumemounter.go similarity index 96% rename from _motor/providers/os/snapshot/volumemounter.go rename to providers/os/connection/snapshot/volumemounter.go index 4f95054fb5..6d839eb017 100644 --- a/_motor/providers/os/snapshot/volumemounter.go +++ b/providers/os/connection/snapshot/volumemounter.go @@ -9,11 +9,10 @@ import ( "os" "strings" - "go.mondoo.com/cnquery/stringx" + "go.mondoo.com/cnquery/utils/stringx" "github.com/cockroachdb/errors" "github.com/rs/zerolog/log" - osProvider "go.mondoo.com/cnquery/motor/providers/os" ) const NoSetup = "no-setup" @@ -24,7 +23,7 @@ type VolumeMounter struct { // where we tell AWS to attach the volume; it doesn't necessarily get attached there, but we have to reference this same location when detaching VolumeAttachmentLoc string opts map[string]string - cmdRunner osProvider.CommandRunner + cmdRunner *LocalCommandRunner } func NewVolumeMounter(shell []string) *VolumeMounter { diff --git a/providers/providers.go b/providers/providers.go index ea62807193..3147080b28 100644 --- a/providers/providers.go +++ b/providers/providers.go @@ -156,6 +156,7 @@ func EnsureProvider(existing Providers, connectorName string, connectorType stri upstream := DefaultProviders.ForConnection(connectorName, connectorType) if upstream == nil { // we can't find any provider for this connector in our default set + // FIXME: This causes a panic in the CLI, we should handle this better return nil, nil }