Skip to content

Commit a8bb42f

Browse files
renamed jira secret scanner to be more consistent
1 parent e671889 commit a8bb42f

File tree

7 files changed

+40
-15
lines changed

7 files changed

+40
-15
lines changed

scripts/README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This is a collection of scripts that act as wrappers around the Rusty Hog binari
44
They provide additional functionality that the New Relic security team uses to monitor
55
and perform wider scans.
66

7-
## GHE Secret Monitor
7+
## ghe_secret_monitor.py
88

99
This is a Python script, re-written based on Douglas Day's work, that performs a scan
1010
of the last 24 hours of commits for an entire GitHub Enterprise instance. It outputs
@@ -28,13 +28,12 @@ sudo systemctl enable ghe_secret_monitor
2828
You can then perform a one-time execution of secret_scanner with the command
2929
`sudo service ghe_secret_monitor start` and examine the results in /var/log/messages
3030

31-
## JIRA Secret Scanner
31+
## jira_secret_monitor.py
3232

33-
This is a Python script, also re-written based on Douglas Day's work, that performs a
34-
scan of any Google Docs that were linked in JIRA over the last 24 hours. Essentially
35-
it runs a JQL query for all tickets modified in the last 24 hours, collects all GDrive
36-
links from the text and comments of each JIRA ticket, and runs ankamali_hog against each
37-
document. It then collects the results and outputs them to New Relic Insights. You can use
33+
This is a Python script, also re-written based on Douglas Day's work, that performs 2 scans:
34+
1) It scans all JIRA tickets modified in the last 24 hours for secrets using gottingen_hog.
35+
2) Within those JIRA tickets it looks for GDrive links and scans those docs for secrets using anakmali_hog.
36+
It then collects the results and outputs them to New Relic Insights. You can use
3837
the same installation method as above, substituting jira_secret_scanner for secret_scanner
3938
in each step.
4039

@@ -89,6 +88,8 @@ INSIGHTS_INSERT_KEY - the New Relic Insights Insert API key for results
8988
INSIGHTS_ACCT_ID - the New Relic Insights account number for results
9089
DUROC_HOG_PATH - the path to the duroc hog binary (relative or absolute)
9190

91+
You will also need to install the third party python library htmllistparse
92+
9293
## s3weblisting_secret_monitor.py
9394

9495
This is a python script meant to perform a Rusty Hog scan for all binaries on a web server that uses the generic
@@ -100,4 +101,6 @@ You will need to supply 4 environment variables to it:
100101
DOWNLOAD_CONFIG_PATH - the path to the JSON config file, e.g. scripts/s3weblisting_secret_monitor.json
101102
INSIGHTS_INSERT_KEY - the New Relic Insights Insert API key for results
102103
INSIGHTS_ACCT_ID - the New Relic Insights account number for results
103-
DUROC_HOG_PATH - the path to the duroc hog binary (relative or absolute)
104+
DUROC_HOG_PATH - the path to the duroc hog binary (relative or absolute)
105+
106+
You will also need to install the third party python library htmllistparse

scripts/ghe_secret_monitor.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
# This is a Python script, re-written based on Douglas Day's work, that performs a scan
2+
# of the last 24 hours of commits for an entire GitHub Enterprise instance. It outputs
3+
# the results to the New Relic Insights product which allows you to create alerts and
4+
# visualizations based on the scanning results. It was designed to be run on an Amazon Linux
5+
# EC2 instance on a nightly basis. You can install it using the following commands:
6+
#
7+
# ```shell script
8+
# cd ~
9+
# mkdir rusty-hog
10+
# wget https://github.com/newrelic/rusty-hog/releases/download/v1.0.4/rustyhogs-musl_darwin_1.0.4.zip
11+
# unzip rustyhogs-musl_darwin_1.0.4.zip -d rusty_hog_1.0.4
12+
# cd rusty_hog_1.0.4
13+
# sudo cp ghe_secret_monitor.service /etc/systemd/system
14+
# sudo vi ghe_secret_monitor.timer # modify each <redacted for git> field
15+
# sudo cp ghe_secret_monitor.timer /etc/systemd/system
16+
# sudo systemctl daemon-reload
17+
# sudo systemctl enable ghe_secret_monitor
18+
# ```
19+
#
20+
# You can then perform a one-time execution of secret_scanner with the command
21+
# `sudo service ghe_secret_monitor start` and examine the results in /var/log/messages
22+
123
from datetime import datetime, timedelta
224
from github import Github, GithubException
325
from multiprocessing import Pool

scripts/htmldirlisting_secret_monitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

3-
# This is a simple script meant to retrieve the latest pypi package (provided through environment variables) and perform a
4-
# Rusty Hog scan on the contents of the download. It will then post the results to Insights.
3+
# This is a simple script meant to retrieve all files from a web server with an HTML directory listing and scan
4+
# the files for secrets using duroc_hog. It will then post the results to Insights.
55

66
import os
77
import gzip
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[Unit]
22
Description=Runs JIRA + GDrive Secret Scanner scan
3-
Wants=jira_secret_scanner.timer
3+
Wants=jira_secret_monitor.timer
44

55
[Service]
66
Type=oneshot
7-
ExecStart=/home/ec2-user/anaconda3/bin/python jira_secret_scanner.py
7+
ExecStart=/home/ec2-user/anaconda3/bin/python jira_secret_monitor.py
88
WorkingDirectory=/home/ec2-user/rusty_hog_1.0.4
99
User=ec2-user
1010
Group=ec2-user
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Unit]
22
Description=Run secret_scanner every day at 11:30pm pacific
3-
Requires=jira_secret_scanner.service
3+
Requires=jira_secret_monitor.service
44

55
[Timer]
66
OnCalendar=*-*-* 7:30:00

scripts/s3weblisting_secret_monitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

3-
# This is a simple script meant to retrieve the latest pypi package (provided through environment variables) and perform a
4-
# Rusty Hog scan on the contents of the download. It will then post the results to Insights.
3+
# This is a simple script meant to retrieve all files from a web server with an HTML-fronted S3 bucket and scan
4+
# the files for secrets using duroc_hog. It will then post the results to Insights.
55

66
import os
77
import gzip

0 commit comments

Comments
 (0)