Skip to content

Commit

Permalink
Merge pull request nccgroup#893 from kbroughton/bugfix/docker-build
Browse files Browse the repository at this point in the history
fix docker-compose.yaml, unignore docker/bin
  • Loading branch information
x4v13r64 committed Oct 13, 2020
2 parents 86899c1 + 250ff27 commit 1b29577
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ report-*
# Private folders
/private*/
/**/private*/

!docker/bin
49 changes: 49 additions & 0 deletions docker/bin/container-install-additional.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# =====================================
# install software packages needed for
# all the other components to run
# =====================================
# AUTHOR: jason.ross@nccgroup.com
# VERSION: 0.1.0
# =====================================
export DEBIAN_FRONTEND=noninteractive

WORKDIR=/root
TMPDIR=/tmp
cd ${TMPDIR}

echo -e "\n\nSoftware Pre-reqs Installation Starting...\n\n"

# =====================================
# make sure the timezone gets set to UTC
# =====================================
ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime

# =====================================
# set up the pre-reqs
# =====================================
apt-get update > /dev/null 2>&1
apt-get install -qy \
apt-transport-https \
apt-utils \
ca-certificates \
cmake \
curl \
dialog \
gnupg \
groff \
less \
lsb-release \
nano \
python3 \
python3-pip \
unzip \
vim \
virtualenv \
virtualenvwrapper

# reconfigure the tzdata package to make sure it picks up the UTC bit
dpkg-reconfigure --frontend noninteractive tzdata

echo -e "\n\nSoftware Pre-reqs Installation Complete!\n\n"
50 changes: 50 additions & 0 deletions docker/bin/container-install-aws2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# =====================================
# container-scoutsuite-install.sh
# =====================================
# AUTHOR: jason.ross@nccgroup.com
# VERSION: 0.1.0
# =====================================
export DEBIAN_FRONTEND=noninteractive

WORKDIR=/root
TMPDIR=/tmp
AWSDIR=/root/.aws

echo -e "\n\nAWS2 CLI Installation Starting...\n\n"

# =====================================
# install AWS CLI v2
# =====================================
cd ${TMPDIR}
curl "https://d1vvhvl2y92vvt.cloudfront.net/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install --update

# =====================================
# clean up install artifacts
# =====================================
rm ${TMPDIR}/awscliv2.zip
rm -rf ${TMPDIR}/aws

# =====================================
# Setup AWS configuration templates
# =====================================

# if the aws config directory already exists
# then we do nothing and leave it alone
if [ ! -d ${AWSDIR} ]; then
mkdir ${AWSDIR}

# create the config template
cat <<'EOF' >${AWSDIR}/config
[default]
region = us-east-1
output = json
aws_access_key_id = <access-key>
aws_secret_access_key = <secret key>
EOF
fi

echo -e "\n\nAWS2 CLI Installation Complete!\n\n"
41 changes: 41 additions & 0 deletions docker/bin/container-install-azure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# =====================================
# install the Azure CLI Tools
# =====================================
# AUTHOR: jason.ross@nccgroup.com
# VERSION: 0.1.0
# =====================================
export DEBIAN_FRONTEND=noninteractive

WORKDIR=/root
TMPDIR=/tmp
cd ${TMPDIR}

echo -e "\n\nAzure CLI Installation Starting...\n\n"

# blackbox pipe a random URL directly to shell
# why? because MSFT
#curl -sL https://aka.ms/InstallAzureCLIDeb | bash

# manual process

# add msft gpg key to apt
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg

# set the right repo name
CLI_REPO=$(lsb_release -cs)

# MSFT has no repo for focal yet, force the system to use eoan instead
if [[ ${CLI_REPO} -eq "focal" ]]; then
CLI_REPO="eoan"
fi

# add the msft repo to apt
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \
> /etc/apt/sources.list.d/azure-cli.list

# install the software
apt-get update && apt-get install -y azure-cli

echo -e "\n\nAzure CLI Installation Complete!\n\n"
27 changes: 27 additions & 0 deletions docker/bin/container-install-gcp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# =====================================
# install gCloud SDK CLI Tools
# =====================================
# AUTHOR: jason.ross@nccgroup.com
# VERSION: 0.1.0
# =====================================
export DEBIAN_FRONTEND=noninteractive

WORKDIR=/root
TMPDIR=/tmp
cd ${TMPDIR}

echo -e "\n\ngCloud SDK Installation Starting...\n\n"

# add the gcp repo to apt
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list

# add the gcp pubkey to apt
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

# install the sdk + some extra python-related bits
apt-get update && apt-get install -y google-cloud-sdk google-cloud-sdk-app-engine-python google-cloud-sdk-app-engine-python-extras

# let folks know the install is done
echo -e "\n\ngCloud SDK Installation Complete!\n\n"
22 changes: 22 additions & 0 deletions docker/bin/container-install-scoutsuite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# =====================================
# install ScoutSuite into a virtual env
# =====================================
# AUTHOR: jason.ross@nccgroup.com
# VERSION: 0.1.0
# =====================================
export DEBIAN_FRONTEND=noninteractive

WORKDIR=/root
TMPDIR=/tmp

# =====================================
# install ScoutSuite
# =====================================
cd ${WORKDIR}
virtualenv -p python3 scoutsuite
source ${WORKDIR}/scoutsuite/bin/activate
pip install scoutsuite

echo -e "\n\nScoutsuite Installation Complete!\n\n"
6 changes: 6 additions & 0 deletions docker/bin/container-set-motd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
cat <<'EOF' >> /root/.bashrc
cd ${HOME}
source ${HOME}/scoutsuite/bin/activate
echo -e "Welcome to ScoutSuite!\nTo run ScoutSuite, just type \`scout -h\` to see the help documentation.\nHave fun!\n\n"
EOF
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
env_file:
- config/build.env
build:
context: src
context: .
dockerfile: src/Dockerfile
args:
- VCS_REF
Expand Down

0 comments on commit 1b29577

Please sign in to comment.