From f23300d1e4bdf263e37b903ce159ff19479ad59e Mon Sep 17 00:00:00 2001 From: Victor GRENU Date: Sun, 5 Jan 2020 15:14:03 +0100 Subject: [PATCH 1/2] v0.2 --- .env.example | 1 + .gitignore | 1 + Dockerfile | 1 - Makefile | 4 ---- README.md | 1 + ast.sh | 20 ++++++++++++++------ 6 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e1a3283 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +AWS_DEFAULT_REGION=us-east-1 \ No newline at end of file diff --git a/.gitignore b/.gitignore index fcb9cf9..c4faa64 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ Icon # Thumbnails ._* +.env # Files that might appear in the root of a volume .DocumentRevisions-V100 diff --git a/Dockerfile b/Dockerfile index 409ff99..9cc4c0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ diff --git a/Makefile b/Makefile index ec78829..d263a84 100644 --- a/Makefile +++ b/Makefile @@ -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} . diff --git a/README.md b/README.md index ac2a962..99a77da 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/ast.sh b/ast.sh index 984409a..81a6a16 100755 --- a/ast.sh +++ b/ast.sh @@ -1,16 +1,15 @@ #!/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" +PROFILE_NAME="zoph" CONTAINER_IMAGE="aws-security-toolbox:latest" GREEN='\033[0;32m' NC='\033[0m' # No Color @@ -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" @@ -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 } @@ -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 \ @@ -59,6 +65,8 @@ stop() { if [[ "$1" == "build"* ]]; then build +elif [[ "$1" == "pull"* ]]; then + pull elif [[ "$1" == "login"* ]]; then login elif [[ "$1" == "exec"* ]]; then From f6cceefcea35a5adf57e0b0fa073ded972844df0 Mon Sep 17 00:00:00 2001 From: Victor GRENU Date: Sun, 5 Jan 2020 15:16:09 +0100 Subject: [PATCH 2/2] update default aws-vault profile name --- ast.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ast.sh b/ast.sh index 81a6a16..3c3e8d4 100755 --- a/ast.sh +++ b/ast.sh @@ -9,7 +9,7 @@ DESCRIPTION="Docker image for SecOps folks" ################################################ ################ Config ######################## -PROFILE_NAME="zoph" +PROFILE_NAME="default" CONTAINER_IMAGE="aws-security-toolbox:latest" GREEN='\033[0;32m' NC='\033[0m' # No Color