Skip to content

Commit

Permalink
Merge pull request #5 from z0ph/0.2
Browse files Browse the repository at this point in the history
0.2
  • Loading branch information
z0ph authored Jan 5, 2020
2 parents 30fa247 + f6cceef commit 608e90b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AWS_DEFAULT_REGION=us-east-1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Icon

# Thumbnails
._*
.env

# Files that might appear in the root of a volume
.DocumentRevisions-V100
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ LABEL maintainer="Victor GRENU - https://github.com/z0ph/"
LABEL Project="https://github.com/z0ph/aws-security-toolbox"

WORKDIR /opt/secops
ENV AWS_DEFAULT_REGION=eu-west-1

RUN apt-get update -y && \
apt-get install -y \
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ PROJECT ?= aws-security-toolbox
DESCRIPTION ?= Docker container for SecOps folks
################################################

################ Config ########################
AWS_REGION ?= eu-west-1
################################################

build:
@docker build -t ${PROJECT} .

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This will reduce the overhead and the headache of installation these tools and d

- docker [macOS](https://docs.docker.com/docker-for-mac/) or [Linux](https://docs.docker.com/install/linux/docker-ce/debian/)
- `awscli` installed & configured
- create `.env` file before building your Docker image locally (see `[.env.example](./.env.example)`) to set your `DEFAULT_AWS_REGION`

## Usage

Expand Down
18 changes: 13 additions & 5 deletions ast.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/bash

# victor.grenu@gmail.com
# vgrenu@zoph.io
# https://zoph.me

################ Project #######################
PROJECT="AWS-Security-Toolbox (AST)"
DESCRIPTION="Docker container image for SecOps folks"
PROJECT="aws-security-toolbox"
DESCRIPTION="Docker image for SecOps folks"
################################################

################ Config ########################
AWS_REGION="eu-west-1"
PROFILE_NAME="default"
CONTAINER_IMAGE="aws-security-toolbox:latest"
GREEN='\033[0;32m'
Expand All @@ -21,6 +20,7 @@ help() {
echo "$DESCRIPTION"
echo ""
echo " build - build the container image based on Dockerfile (update tools)"
echo " pull - pull the container image from Docker hub"
echo " login - log-in to the container image using interactive mode"
echo " exec [command] - exec your command using aws-vault remotly"
echo " stop - stop the current running SecOps Container"
Expand All @@ -31,6 +31,12 @@ build() {
echo "--> Container: $CONTAINER_IMAGE built successfully"
}

pull() {
docker pull zoph/$PROJECT
echo "--> Container: zoph/$CONTAINER_IMAGE pulled successfully"
docker tag zoph/$CONTAINER_IMAGE zoph/$PROJECT:$PROJECT
}

login() {
docker run -it -v ${HOME}/.aws:/root/.aws:ro --mount src="/tmp",target=/tmp,type=bind $CONTAINER_IMAGE /bin/bash
}
Expand All @@ -43,7 +49,7 @@ exec() {
# echo $AWS_SECRET_ACCESS_KEY
# echo $AWS_SESSION_TOKEN
# echo $AWS_SECURITY_TOKEN
printf "==> Running: ${GREEN}$@${NC}\n"
printf "==> Running: ${GREEN}$@${NC} (aws-vault profile: $PROFILE_NAME)\n"
docker run -it \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
Expand All @@ -59,6 +65,8 @@ stop() {

if [[ "$1" == "build"* ]]; then
build
elif [[ "$1" == "pull"* ]]; then
pull
elif [[ "$1" == "login"* ]]; then
login
elif [[ "$1" == "exec"* ]]; then
Expand Down

0 comments on commit 608e90b

Please sign in to comment.