Skip to content

Commit fd6f8c4

Browse files
authoredNov 24, 2022
Merge pull request #26 from google/gcr
Implement GCR importer
2 parents 651a67f + 4a41381 commit fd6f8c4

File tree

6 files changed

+801
-41
lines changed

6 files changed

+801
-41
lines changed
 

‎README.md

+36-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
- [Requirements](#requirements)
1111
- [Building HashR binary and running tests](#building-hashr-binary-and-running-tests)
1212
- [Setting up HashR](#setting-up-hashr)
13-
- [OS configuration & required 3rd party tooling](#os-configuration--required-3rd-party-tooling)
13+
- [OS configuration \& required 3rd party tooling](#os-configuration--required-3rd-party-tooling)
1414
- [Setting up storage for processing tasks](#setting-up-storage-for-processing-tasks)
1515
- [Setting up PostgreSQL storage](#setting-up-postgresql-storage)
1616
- [Setting up Cloud Spanner](#setting-up-cloud-spanner)
1717
- [Setting up importers](#setting-up-importers)
1818
- [TarGz](#targz)
1919
- [Deb](#deb)
2020
- [RPM](#rpm)
21-
- [GCP](#gcp)
21+
- [GCP (Google Cloud Platform)](#gcp-google-cloud-platform)
22+
- [GCR (Google Container Registry)](#gcr-google-container-registry)
2223
- [Windows](#windows)
2324
- [WSUS](#wsus)
2425
- [Setting up exporters](#setting-up-exporters)
@@ -219,7 +220,7 @@ This is very similar to the TarGz importer except that it looks for `.rpm` packa
219220

220221
1. `-rpm_repo_path` which should point to the path on the local file system that contains `.rpm` files
221222

222-
#### GCP
223+
#### GCP (Google Cloud Platform)
223224

224225
This importer can extract files from GCP disk [images](https://cloud.google.com/compute/docs/images). This is done in few steps:
225226

@@ -230,7 +231,7 @@ This importer can extract files from GCP disk [images](https://cloud.google.com/
230231
1. Copy raw_disk.tar.gz from GCS to local hashR storage
231232
1. Extract raw_disk.tar.gz and pass the disk image to Plaso
232233

233-
List of GCP projects containing public GCP images can be found [here](https://cloud.google.com/compute/docs/images/os-details#general-info). In order to use this importer you need to have a GCP project and follow these steps:
234+
List of GCP projects containing public GCP images can be found [here](https://cloud.google.com/compute/docs/images/os-details#general-info). In order to use this importer you need to have a GCP project and follow these steps:
234235

235236
Step 1: Create HashR service account, if this was done while setting up Cloud Spanner please go to step 4.
236237

@@ -324,6 +325,37 @@ To use this importer you need to specify the following flag(s):
324325
1. `-hashrGCPProject` GCP project that will be used to store copy of disk images for processing and also run Cloud Build
325326
1. `-hashrGCSBucket` GCS bucket that will be used to store output of Cloud Build (disk images in .tar.gz format)
326327

328+
#### GCR (Google Container Registry)
329+
This importer extracts files from container images stored in GCR repositories. In order to set ip up follow these steps:
330+
331+
Step 1: Create HashR service account, skip to step 4 if this was done while setting up other GCP dependent components.
332+
333+
``` shell
334+
gcloud iam service-accounts create hashr-sa --description="HashR SA key." --display-name="hashr"
335+
```
336+
337+
Step 2: Create service account key and store in your home directory. Make sure to set *<project_name>* to your project name:
338+
339+
``` shell
340+
gcloud iam service-accounts keys create ~/hashr-sa-private-key.json --iam-account=hashr-sa@<project_name>.iam.gserviceaccount.com
341+
```
342+
343+
Step 3: Point GOOGLE_APPLICATION_CREDENTIALS env variable to your service account key:
344+
345+
``` shell
346+
export GOOGLE_APPLICATION_CREDENTIALS=~/hashr-sa-private-key.json
347+
```
348+
349+
Step 4: Grant hashR service account key required permissions to access given GCR repository.
350+
351+
``` shell
352+
gsutil iam ch serviceAccount:hashr-sa@<project_name>.iam.gserviceaccount.com:objectViewer gs://artifacts.<project_name_hosting_gcr_repo>.appspot.com
353+
```
354+
355+
To use this importer you need to specify the following flag(s):
356+
357+
1. `-gcr_repos` which should contain comma separated list of GCR repositories from which you want to import the container images.
358+
327359
#### Windows
328360

329361
This importer extracts files from official Windows installation media in ISO-13346 format, e.g. the ones you can download from official Microsoft [website](https://www.microsoft.com/en-gb/software-download/windows10ISO).

‎go.mod

+32-17
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,57 @@ go 1.18
55
require (
66
cloud.google.com/go/spanner v1.32.0
77
github.com/DATA-DOG/go-sqlmock v1.5.0
8-
github.com/Microsoft/go-winio v0.5.3-0.20220712145307-8fca75951feb
8+
github.com/Microsoft/go-winio v0.6.0
99
github.com/golang/glog v1.0.0
10-
github.com/google/go-cmp v0.5.8
10+
github.com/google/go-cmp v0.5.9
11+
github.com/google/go-containerregistry v0.12.1
1112
github.com/lib/pq v1.10.6
12-
google.golang.org/api v0.80.0
13-
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd
14-
google.golang.org/grpc v1.46.2
15-
google.golang.org/protobuf v1.28.0
13+
github.com/sassoftware/go-rpmutils v0.2.0
14+
golang.org/x/oauth2 v0.1.0
15+
google.golang.org/api v0.96.0
16+
google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de
17+
google.golang.org/grpc v1.48.0
18+
google.golang.org/protobuf v1.28.1
19+
pault.ag/go/debian v0.12.0
1620
)
1721

1822
require (
19-
cloud.google.com/go v0.100.2 // indirect
20-
cloud.google.com/go/compute v1.6.1 // indirect
23+
cloud.google.com/go v0.102.1 // indirect
24+
cloud.google.com/go/compute v1.10.0 // indirect
2125
github.com/DataDog/zstd v1.4.8 // indirect
2226
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
2327
github.com/cespare/xxhash/v2 v2.1.1 // indirect
2428
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
2529
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
30+
github.com/containerd/stargz-snapshotter/estargz v0.12.1 // indirect
31+
github.com/docker/cli v20.10.20+incompatible // indirect
32+
github.com/docker/distribution v2.8.1+incompatible // indirect
33+
github.com/docker/docker v20.10.20+incompatible // indirect
34+
github.com/docker/docker-credential-helpers v0.7.0 // indirect
2635
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
2736
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
2837
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
2938
github.com/golang/protobuf v1.5.2 // indirect
30-
github.com/googleapis/gax-go/v2 v2.3.0 // indirect
39+
github.com/google/uuid v1.3.0 // indirect
40+
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
41+
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
3142
github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d // indirect
32-
github.com/klauspost/compress v1.11.7 // indirect
33-
github.com/sassoftware/go-rpmutils v0.2.0 // indirect
43+
github.com/klauspost/compress v1.15.11 // indirect
44+
github.com/mitchellh/go-homedir v1.1.0 // indirect
45+
github.com/opencontainers/go-digest v1.0.0 // indirect
46+
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
47+
github.com/pkg/errors v0.9.1 // indirect
48+
github.com/sirupsen/logrus v1.9.0 // indirect
3449
github.com/ulikunitz/xz v0.5.9 // indirect
50+
github.com/vbatts/tar-split v0.11.2 // indirect
3551
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
3652
go.opencensus.io v0.23.0 // indirect
3753
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
38-
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
39-
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
40-
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
41-
golang.org/x/text v0.3.7 // indirect
42-
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
54+
golang.org/x/net v0.1.0 // indirect
55+
golang.org/x/sync v0.1.0 // indirect
56+
golang.org/x/sys v0.1.0 // indirect
57+
golang.org/x/text v0.4.0 // indirect
58+
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
4359
google.golang.org/appengine v1.6.7 // indirect
44-
pault.ag/go/debian v0.12.0 // indirect
4560
pault.ag/go/topsort v0.0.0-20160530003732-f98d2ad46e1a // indirect
4661
)

0 commit comments

Comments
 (0)