Add openssh-client to trufflehog container (#1045)
* Add openssh-client to docker container * Add ssh auth example and --rm to all docker run commands
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
|
|||||||
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o trufflehog .
|
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o trufflehog .
|
||||||
|
|
||||||
FROM alpine:3.15
|
FROM alpine:3.15
|
||||||
RUN apk add --no-cache bash git ca-certificates \
|
RUN apk add --no-cache bash git openssh-client ca-certificates \
|
||||||
&& rm -rf /var/cache/apk/* && \
|
&& rm -rf /var/cache/apk/* && \
|
||||||
update-ca-certificates
|
update-ca-certificates
|
||||||
COPY --from=builder /build/trufflehog /usr/bin/trufflehog
|
COPY --from=builder /build/trufflehog /usr/bin/trufflehog
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
FROM alpine:3.15
|
FROM alpine:3.15
|
||||||
|
|
||||||
RUN apk add --no-cache bash git ca-certificates \
|
RUN apk add --no-cache bash git openssh-client ca-certificates \
|
||||||
&& rm -rf /var/cache/apk/* && \
|
&& rm -rf /var/cache/apk/* && \
|
||||||
update-ca-certificates
|
update-ca-certificates
|
||||||
WORKDIR /usr/bin/
|
WORKDIR /usr/bin/
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ https://join.slack.com/t/trufflehog-community/shared_invite/zt-pw2qbi43-Aa86hkii
|
|||||||

|

|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=trufflesecurity
|
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=trufflesecurity
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
@@ -36,7 +36,8 @@ docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=tru
|
|||||||
### Example 1: Scan a repo for only verified secrets
|
### Example 1: Scan a repo for only verified secrets
|
||||||
|
|
||||||
Command:
|
Command:
|
||||||
```
|
|
||||||
|
```bash
|
||||||
trufflehog git https://github.com/trufflesecurity/test_keys --only-verified
|
trufflehog git https://github.com/trufflesecurity/test_keys --only-verified
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -59,14 +60,15 @@ Timestamp: 2022-06-16 10:17:40 -0700 PDT
|
|||||||
|
|
||||||
### Example 2: Scan a GitHub Org for only verified secrets
|
### Example 2: Scan a GitHub Org for only verified secrets
|
||||||
|
|
||||||
```
|
```bash
|
||||||
trufflehog github --org=trufflesecurity --only-verified
|
trufflehog github --org=trufflesecurity --only-verified
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example 3: Scan a GitHub Repo for only verified keys and get JSON output
|
### Example 3: Scan a GitHub Repo for only verified keys and get JSON output
|
||||||
|
|
||||||
Command:
|
Command:
|
||||||
```
|
|
||||||
|
```bash
|
||||||
trufflehog git https://github.com/trufflesecurity/test_keys --only-verified --json
|
trufflehog git https://github.com/trufflesecurity/test_keys --only-verified --json
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -77,7 +79,8 @@ Expected output:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Example 4: Scan an S3 bucket for verified keys
|
### Example 4: Scan an S3 bucket for verified keys
|
||||||
```
|
|
||||||
|
```bash
|
||||||
trufflehog s3 --bucket=<bucket name> --only-verified
|
trufflehog s3 --bucket=<bucket name> --only-verified
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -88,9 +91,15 @@ trufflehog s3 --bucket=<bucket name> --only-verified
|
|||||||
+ Why is the scan is taking a long time when I scan a GitHub org
|
+ Why is the scan is taking a long time when I scan a GitHub org
|
||||||
+ Unauthenticated GitHub scans have rate limits. To improve your rate limits, include the `--token` flag with a personal access token
|
+ Unauthenticated GitHub scans have rate limits. To improve your rate limits, include the `--token` flag with a personal access token
|
||||||
+ It says a private key was verified, what does that mean?
|
+ It says a private key was verified, what does that mean?
|
||||||
+ Check out our Driftwood blog post to learn how to do this, in short we've confirmed the key can be used live for SSH or SSL [Blog post](https://trufflesecurity.com/blog/driftwood-know-if-private-keys-are-sensitive/)
|
+ Check out our Driftwood blog post to learn how to do this, in short we've confirmed the key can be used live for SSH or SSL [Blog post](https://trufflesecurity.com/blog/driftwood-know-if-private-keys-are-sensitive/)
|
||||||
|
|
||||||
|
|
||||||
|
### Example 5: Scan a Github Repo using SSH authentication in docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -v "$HOME/.ssh:/root/.ssh:ro" trufflesecurity/trufflehog:latest git ssh://github.com/trufflesecurity/test_keys
|
||||||
|
```
|
||||||
|
|
||||||
# What's new in v3?
|
# What's new in v3?
|
||||||
|
|
||||||
TruffleHog v3 is a complete rewrite in Go with many new powerful features.
|
TruffleHog v3 is a complete rewrite in Go with many new powerful features.
|
||||||
@@ -108,7 +117,7 @@ For every potential credential that is detected, we've painstakingly implemented
|
|||||||
Several options:
|
Several options:
|
||||||
|
|
||||||
### 1. Go
|
### 1. Go
|
||||||
```
|
```bash
|
||||||
git clone https://github.com/trufflesecurity/trufflehog.git
|
git clone https://github.com/trufflesecurity/trufflehog.git
|
||||||
|
|
||||||
cd trufflehog; go install
|
cd trufflehog; go install
|
||||||
@@ -119,12 +128,12 @@ cd trufflehog; go install
|
|||||||
### 3. Docker
|
### 3. Docker
|
||||||
|
|
||||||
|
|
||||||
> Note: Apple M1 hardware users should run with `docker run --platform linux/arm64` for better performance.
|
> Note: Apple M1 hardware users should run with `docker run --rm --platform linux/arm64` for better performance.
|
||||||
|
|
||||||
#### **Most users**
|
#### **Most users**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
|
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
|
||||||
```
|
```
|
||||||
|
|
||||||
#### **Apple M1 users**
|
#### **Apple M1 users**
|
||||||
@@ -133,7 +142,7 @@ The `linux/arm64` image is better to run on the M1 than the amd64 image.
|
|||||||
Even better is running the native darwin binary available, but there is no container image for that.
|
Even better is running the native darwin binary available, but there is no container image for that.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --platform linux/arm64 -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
|
docker run --rm --platform linux/arm64 -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Pip (help wanted)
|
### 4. Pip (help wanted)
|
||||||
@@ -207,7 +216,7 @@ Exit Codes:
|
|||||||
Try scanning an entire GitHub organization with the following:
|
Try scanning an entire GitHub organization with the following:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=trufflesecurity
|
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=trufflesecurity
|
||||||
```
|
```
|
||||||
|
|
||||||
### TruffleHog OSS Github Action
|
### TruffleHog OSS Github Action
|
||||||
@@ -217,9 +226,9 @@ docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=tru
|
|||||||
uses: trufflesecurity/trufflehog@main
|
uses: trufflesecurity/trufflehog@main
|
||||||
with:
|
with:
|
||||||
# Repository path
|
# Repository path
|
||||||
path:
|
path:
|
||||||
# Start scanning from here (usually main branch).
|
# Start scanning from here (usually main branch).
|
||||||
base:
|
base:
|
||||||
# Scan commits until here (usually dev branch).
|
# Scan commits until here (usually dev branch).
|
||||||
head: # optional
|
head: # optional
|
||||||
# Extra args to be passed to the trufflehog cli.
|
# Extra args to be passed to the trufflehog cli.
|
||||||
@@ -264,7 +273,7 @@ repos:
|
|||||||
description: Detect secrets in your data.
|
description: Detect secrets in your data.
|
||||||
entry: bash -c 'trufflehog git file://. --since-commit HEAD --only-verified --fail'
|
entry: bash -c 'trufflehog git file://. --since-commit HEAD --only-verified --fail'
|
||||||
# For running trufflehog in docker, use the following entry instead:
|
# For running trufflehog in docker, use the following entry instead:
|
||||||
# entry: bash -c 'docker run -v "$(pwd):/workdir" -i --rm trufflesecurity/trufflehog:latest git file:///workdir --since-commit HEAD --only-verified --fail'
|
# entry: bash -c 'docker run --rm -v "$(pwd):/workdir" -i --rm trufflesecurity/trufflehog:latest git file:///workdir --since-commit HEAD --only-verified --fail'
|
||||||
language: system
|
language: system
|
||||||
stages: ["commit", "push"]
|
stages: ["commit", "push"]
|
||||||
```
|
```
|
||||||
@@ -302,7 +311,7 @@ detectors:
|
|||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
» trufflehog filesystem --directory /tmp --config config.yaml --only-verified
|
$ trufflehog filesystem --directory /tmp --config config.yaml --only-verified
|
||||||
🐷🔑🐷 TruffleHog. Unearth your secrets. 🐷🔑🐷
|
🐷🔑🐷 TruffleHog. Unearth your secrets. 🐷🔑🐷
|
||||||
|
|
||||||
Found verified result 🐷🔑
|
Found verified result 🐷🔑
|
||||||
|
|||||||
Reference in New Issue
Block a user