From 5ff75039bebe0611a042e5208dbfcb8134022d67 Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 16 Jun 2023 23:34:47 -0400 Subject: [PATCH 01/12] add in missing installations for emu --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index 492e2e0a5..b6defffac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,6 +62,13 @@ fi WORKDIR /usr/src/app +#RUN if [ grep "\- emu" /usr/src/app/conf/local.yml ]; then \ +# apt-get install zlib1g; \ +# ./usr/src/app/plugins/emu/download_payloads.sh; \ +#fi +RUN apt-get -y install zlib1g unzip; +RUN ./plugins/emu/download_payloads.sh; + # Default HTTP port for web interface and agent beacons over HTTP EXPOSE 8888 From a52d3e548299246bc810065f134ea130f6430e3e Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 23 Jun 2023 10:00:19 -0400 Subject: [PATCH 02/12] add pyminizip installation for Docker --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index b6defffac..ec6833acb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,6 +67,7 @@ WORKDIR /usr/src/app # ./usr/src/app/plugins/emu/download_payloads.sh; \ #fi RUN apt-get -y install zlib1g unzip; +RUN pip3 install pyminizip; RUN ./plugins/emu/download_payloads.sh; # Default HTTP port for web interface and agent beacons over HTTP From 34ca5ff72fb65cf263815ab8298caef23dc90e34 Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 23 Jun 2023 10:50:48 -0400 Subject: [PATCH 03/12] fix if/grep statement --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ec6833acb..6a4ad0804 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,13 +62,11 @@ fi WORKDIR /usr/src/app -#RUN if [ grep "\- emu" /usr/src/app/conf/local.yml ]; then \ -# apt-get install zlib1g; \ -# ./usr/src/app/plugins/emu/download_payloads.sh; \ -#fi -RUN apt-get -y install zlib1g unzip; -RUN pip3 install pyminizip; -RUN ./plugins/emu/download_payloads.sh; +RUN if [ $(grep -c "\- emu" conf/local.yml) ]; then \ + apt-get -y install zlib1g unzip; \ + pip3 install -r ./plugins/emu/requirements.txt; \ + ./plugins/emu/download_payloads.sh; \ +fi # Default HTTP port for web interface and agent beacons over HTTP EXPOSE 8888 From 701e982cd3ef949fff874f441ed54c8187cf5401 Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 23 Jun 2023 10:57:53 -0400 Subject: [PATCH 04/12] comment dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 6a4ad0804..7391bc1fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,6 +62,7 @@ fi WORKDIR /usr/src/app +# If emu is enabled, complete necessary installation steps RUN if [ $(grep -c "\- emu" conf/local.yml) ]; then \ apt-get -y install zlib1g unzip; \ pip3 install -r ./plugins/emu/requirements.txt; \ From e563c5973a167d4875d0164a4caee3ec033bb3eb Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 23 Jun 2023 14:04:41 -0400 Subject: [PATCH 05/12] don't rewrite local.yml if it exists --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7391bc1fe..3a4bcbec1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,8 @@ RUN if [ "$WIN_BUILD" = "true" ] ; then apt-get -y install mingw-w64; fi RUN pip3 install --no-cache-dir -r requirements.txt # Set up config file and disable atomic by default -RUN grep -v "\- atomic" conf/default.yml > conf/local.yml +RUN sed -i '/\- atomic/d' conf/default.yml +RUN if [ -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; fi # Install golang RUN curl -L https://go.dev/dl/go1.17.6.linux-amd64.tar.gz -o go1.17.6.linux-amd64.tar.gz @@ -63,7 +64,7 @@ fi WORKDIR /usr/src/app # If emu is enabled, complete necessary installation steps -RUN if [ $(grep -c "\- emu" conf/local.yml) ]; then \ +RUN if [ $(grep -c "\- emu" conf/default.yml) ]; then \ apt-get -y install zlib1g unzip; \ pip3 install -r ./plugins/emu/requirements.txt; \ ./plugins/emu/download_payloads.sh; \ From 96e7d3573d12474d9145ef7f1186f38d0bf1565e Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 7 Jul 2023 15:50:00 -0400 Subject: [PATCH 06/12] create local.yml file manually and check that for enabled plugins --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a4bcbec1..bb2f51fe9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,9 @@ RUN pip3 install --no-cache-dir -r requirements.txt # Set up config file and disable atomic by default RUN sed -i '/\- atomic/d' conf/default.yml -RUN if [ -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; fi +RUN if [! -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; \ + else grep -v "\- atomic" conf/default.yml > conf/local.yml; \ + fi # Install golang RUN curl -L https://go.dev/dl/go1.17.6.linux-amd64.tar.gz -o go1.17.6.linux-amd64.tar.gz @@ -64,10 +66,10 @@ fi WORKDIR /usr/src/app # If emu is enabled, complete necessary installation steps -RUN if [ $(grep -c "\- emu" conf/default.yml) ]; then \ +RUN if [ $(grep -c "\- emu" conf/local.yml) ]; then \ apt-get -y install zlib1g unzip; \ pip3 install -r ./plugins/emu/requirements.txt; \ - ./plugins/emu/download_payloads.sh; \ + #./plugins/emu/download_payloads.sh; \ fi # Default HTTP port for web interface and agent beacons over HTTP From 65d5b5faf085cf94c42d2d6672464471627c06f5 Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 7 Jul 2023 15:53:22 -0400 Subject: [PATCH 07/12] uncomment download_payloads script --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bb2f51fe9..71c9cef8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,7 +69,7 @@ WORKDIR /usr/src/app RUN if [ $(grep -c "\- emu" conf/local.yml) ]; then \ apt-get -y install zlib1g unzip; \ pip3 install -r ./plugins/emu/requirements.txt; \ - #./plugins/emu/download_payloads.sh; \ + ./plugins/emu/download_payloads.sh; \ fi # Default HTTP port for web interface and agent beacons over HTTP From 1f73da476ce34880efa0e81384797eaf2a45859e Mon Sep 17 00:00:00 2001 From: blee Date: Fri, 7 Jul 2023 16:18:45 -0400 Subject: [PATCH 08/12] fix RUN conditional --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 71c9cef8b..83f9786c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,7 @@ RUN if [ "$WIN_BUILD" = "true" ] ; then apt-get -y install mingw-w64; fi RUN pip3 install --no-cache-dir -r requirements.txt # Set up config file and disable atomic by default -RUN sed -i '/\- atomic/d' conf/default.yml -RUN if [! -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; \ +RUN if [ -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; \ else grep -v "\- atomic" conf/default.yml > conf/local.yml; \ fi From b4125015c2313de4c55f5a09858aeaca9b1b5a0c Mon Sep 17 00:00:00 2001 From: bleepbop Date: Sun, 9 Jul 2023 22:11:11 -0400 Subject: [PATCH 09/12] fix missing directory issues by updating workdir --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 83f9786c7..596c54c3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,15 +62,17 @@ RUN if [ ! -d "/usr/src/app/plugins/atomic/data/atomic-red-team" ]; then \ /usr/src/app/plugins/atomic/data/atomic-red-team; \ fi -WORKDIR /usr/src/app +WORKDIR /usr/src/app/plugins/emu # If emu is enabled, complete necessary installation steps RUN if [ $(grep -c "\- emu" conf/local.yml) ]; then \ - apt-get -y install zlib1g unzip; \ - pip3 install -r ./plugins/emu/requirements.txt; \ - ./plugins/emu/download_payloads.sh; \ + apt-get -y install zlib1g unzip; \ + pip3 install -r ./requirements.txt; \ + ./download_payloads.sh; \ fi +WORKDIR /usr/src/app + # Default HTTP port for web interface and agent beacons over HTTP EXPOSE 8888 From fed310c059eb3e2755407c103d1ea6bf6f74703b Mon Sep 17 00:00:00 2001 From: blee Date: Tue, 11 Jul 2023 21:08:36 -0400 Subject: [PATCH 10/12] use config_generator to create missing config file --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 596c54c3a..a342279af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,9 @@ RUN if [ "$WIN_BUILD" = "true" ] ; then apt-get -y install mingw-w64; fi RUN pip3 install --no-cache-dir -r requirements.txt # Set up config file and disable atomic by default -RUN if [ -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; \ - else grep -v "\- atomic" conf/default.yml > conf/local.yml; \ +RUN if [ -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; \ + else sed -i '/\- atomic/d' conf/default.yml; \ + python3 -c "import app; import app.utility.config_generator; app.utility.config_generator.ensure_local_config();"; \ fi # Install golang From 2e5be0f23db0c161bb594fccc377a8a50cb1f52c Mon Sep 17 00:00:00 2001 From: bleepbop Date: Tue, 11 Jul 2023 22:01:28 -0400 Subject: [PATCH 11/12] fix path to conf/local --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a342279af..cebd79917 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,9 +66,9 @@ fi WORKDIR /usr/src/app/plugins/emu # If emu is enabled, complete necessary installation steps -RUN if [ $(grep -c "\- emu" conf/local.yml) ]; then \ +RUN if [ $(grep -c "\- emu" ../../conf/local.yml) ]; then \ apt-get -y install zlib1g unzip; \ - pip3 install -r ./requirements.txt; \ + pip3 install -r requirements.txt; \ ./download_payloads.sh; \ fi From 47f69ee5b3be5107a5b4be5062119a879b8a5dd0 Mon Sep 17 00:00:00 2001 From: bleepbop Date: Sun, 23 Jul 2023 21:08:10 -0400 Subject: [PATCH 12/12] simplify config generation + atomic removal line --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index cebd79917..8fa852e95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,10 +22,8 @@ RUN if [ "$WIN_BUILD" = "true" ] ; then apt-get -y install mingw-w64; fi RUN pip3 install --no-cache-dir -r requirements.txt # Set up config file and disable atomic by default -RUN if [ -f "conf/local.yml" ]; then sed -i '/\- atomic/d' conf/local.yml; \ - else sed -i '/\- atomic/d' conf/default.yml; \ - python3 -c "import app; import app.utility.config_generator; app.utility.config_generator.ensure_local_config();"; \ - fi +RUN python3 -c "import app; import app.utility.config_generator; app.utility.config_generator.ensure_local_config();"; \ + sed -i '/\- atomic/d' conf/local.yml; # Install golang RUN curl -L https://go.dev/dl/go1.17.6.linux-amd64.tar.gz -o go1.17.6.linux-amd64.tar.gz