From 40cc1fd9a7945b1f1a3a55b0fab178ca71151d20 Mon Sep 17 00:00:00 2001 From: Parikshit Patel Date: Tue, 21 Apr 2020 10:35:44 +1000 Subject: [PATCH 1/5] Update Dockerfile --- Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 59ab2b4..fd8e6d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,13 @@ FROM alpine:3.10.1 -RUN apk add --no-cache openssh tcpdump curl mtr nmap nmap-nping bind-tools nginx jq && \ - apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ aws-cli +RUN apk add --no-cache openssh tcpdump curl mtr nmap nmap-nping bind-tools nginx jq + #apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ aws-cli + +# Install aws-cli using pip +RUN apk -Uuv add groff less python py-pip +RUN pip install awscli +RUN apk --purge -v del py-pip +RUN rm /var/cache/apk/* ADD files/ /files/ From 8f4b56dc1d7a6bebdc7912da4550b453a0e811f4 Mon Sep 17 00:00:00 2001 From: Parikshit Patel Date: Tue, 21 Apr 2020 10:36:24 +1000 Subject: [PATCH 2/5] Commenting SSH testing --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2e00b77..b080b96 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ test: checks curl -f localhost:8023 # Testing sshd - ssh -i ~/.ssh/testing -p 8022 root@localhost -- ip addr + # ssh -i ~/.ssh/testing -p 8022 root@localhost -- ip addr # Cleanup docker logs debugger-webserver From 951c1ce9515214961d849856cb5864eaa561d4cd Mon Sep 17 00:00:00 2001 From: Parikshit Patel Date: Tue, 21 Apr 2020 10:43:37 +1000 Subject: [PATCH 3/5] Commenting line to copy sshkey --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fd8e6d1..6e20e12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,6 @@ RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa && \ # Changing the motd to remember the above configuration printf '\n\nNOTICE: export $(strings /proc/1/environ) is run on the ash shell profile which makes the aws cli work with Task Roles.\nc' > /etc/motd -COPY ./testing.pub /root/.ssh/authorized_keys +# COPY ./testing.pub /root/.ssh/authorized_keys CMD [ "/files/entrypoint.sh" ] From 340ef125fd384836a2fee3626387deccf1798246 Mon Sep 17 00:00:00 2001 From: Parikshit Patel Date: Tue, 21 Apr 2020 11:01:14 +1000 Subject: [PATCH 4/5] Adding Environment section in taskdefinition --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 46beb75..6d9d8ba 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,15 @@ docker run -dit --name debugger-tcpdump -v ~/.aws/:/root/.aws/ -e BUCKET={bucket "image": "{image}", "essential": true, "name": "accessContainer" + "environment": [ + { + "name": "BUCKET", + "value": "{mybucketname}" + }, + { + "name": "TCPDUMP", + "value": "true" + } } ], "memory": "512", From b5b950a80c928bd4aa012ad7272663598e548ce7 Mon Sep 17 00:00:00 2001 From: Parikshit Patel Date: Tue, 21 Apr 2020 11:06:38 +1000 Subject: [PATCH 5/5] Adding environment section in the task definition --- README.md | 95 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 6d9d8ba..7685001 100644 --- a/README.md +++ b/README.md @@ -22,54 +22,55 @@ docker run -dit --name debugger-tcpdump -v ~/.aws/:/root/.aws/ -e BUCKET={bucket ### Sample Fargate Task Definition ```json { - "executionRoleArn": "arn:aws:iam::{account}:role/{ecsExecutionRole}", - "containerDefinitions": [ - { - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": "/ecs/testing", - "awslogs-region": "us-west-2", - "awslogs-stream-prefix": "ecs" - } - }, - "portMappings": [ - { - "hostPort": 8022, - "protocol": "tcp", - "containerPort": 8022 - }, - { - "hostPort": 80, - "protocol": "tcp", - "containerPort": 80 - } - ], - "cpu": 0, - "memory": 256, - "memoryReservation": 128, - "image": "{image}", - "essential": true, - "name": "accessContainer" - "environment": [ - { - "name": "BUCKET", - "value": "{mybucketname}" - }, + "executionRoleArn": "arn:aws:iam::{account}:role/{ecsExecutionRole}", + "containerDefinitions": [ { - "name": "TCPDUMP", - "value": "true" + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "/ecs/testing", + "awslogs-region": "us-west-2", + "awslogs-stream-prefix": "ecs" + } + }, + "portMappings": [ + { + "hostPort": 8022, + "protocol": "tcp", + "containerPort": 8022 + }, + { + "hostPort": 80, + "protocol": "tcp", + "containerPort": 80 + } + ], + "environment": [ + { + "name": "BUCKET", + "value": "{yourbucketname}" + }, + { + "name": "TCPDUMP", + "value": "true" + } + ], + "cpu": 0, + "memory": 256, + "memoryReservation": 128, + "image": "{image}", + "essential": true, + "name": "accessContainer" } - } - ], - "memory": "512", - "taskRoleArn": "arn:aws:iam::{account}:role/{taskRole}", - "compatibilities": [ - "EC2", - "FARGATE" - ], - "family": "testing", - "networkMode": "awsvpc", - "cpu": "256" + ], + "memory": "512", + "taskRoleArn": "arn:aws:iam::{account}:role/{taskRole}", + "compatibilities": [ + "EC2", + "FARGATE" + ], + "family": "testing", + "networkMode": "awsvpc", + "cpu": "256" } ```