image builder, tweaking

This commit is contained in:
t3chn0m4g3 2022-03-24 18:54:56 +01:00
parent 14a9b09f74
commit 328139d9b9
18 changed files with 105 additions and 25 deletions

View file

@ -20,7 +20,7 @@ fi
# Main
mkdir -p /root/.docker/cli-plugins/
cd /root/.docker/cli-plugins/
wget https://github.com/docker/buildx/releases/download/v0.7.1/buildx-v0.7.1.linux-amd64 -O docker-buildx
wget https://github.com/docker/buildx/releases/download/v0.8.1/buildx-v0.8.1.linux-amd64 -O docker-buildx
chmod +x docker-buildx
docker buildx ls

79
docker/builder.sh Executable file
View file

@ -0,0 +1,79 @@
#!/bin/bash
# Setup Vars
myPLATFORMS="linux/amd64,linux/arm64"
myHUBORG="dtagdevsec"
myTAG="2203"
myIMAGESBASE="adbhoney ciscoasa citrixhoneypot conpot cowrie ddospot dicompot dionaea elasticpot endlessh ewsposter fatt glutton hellpot heralding honeypots honeytrap ipphoney log4pot mailoney medpot nginx p0f redishoneypot sentrypeer spiderfoot suricata wordpot"
myIMAGESELK="elasticsearch kibana logstash map"
myIMAGESTANNER="phpox redis snare tanner"
myBUILDERLOG="builder.log"
myBUILDERERR="builder.err"
myBUILDCACHE="/buildcache"
# Got root?
myWHOAMI=$(whoami)
if [ "$myWHOAMI" != "root" ]
then
echo "Need to run as root ..."
exit
fi
# Check for Buildx
docker buildx > /dev/null 2>&1
if [ "$?" == "1" ];
then
echo "### Build environment not setup. Run bin/setup_builder.sh"
fi
# Only run with command switch
if [ "$1" == "" ]; then
echo "### T-Pot Multi Arch Image Builder."
echo "## Usage: builder.sh [build, push]"
echo "## build - Just build images, do not push."
echo "## push - Build and push images."
echo "## Pushing requires an active docker login."
exit
fi
fuBUILDIMAGES () {
local myPATH="$1"
local myIMAGELIST="$2"
local myPUSHOPTION="$3"
for myREPONAME in $myIMAGELIST;
do
echo -n "Now building: $myREPONAME in $myPATH$myREPONAME/."
docker buildx build --cache-from "type=local,src=$myBUILDCACHE" --cache-to "type=local,dest=$myBUILDCACHE" --platform $myPLATFORMS -t $myHUBORG/$myREPONAME:$myTAG $myPUSHOPTION $myPATH$myREPONAME/. >> $myBUILDERLOG 2>&1
if [ "$?" != "0" ];
then
echo " [ ERROR ] - Check logs!"
echo "Error building $myREPONAME" >> "$myBUILDERERR"
else
echo " [ OK ]"
fi
done
}
# Just build images
if [ "$1" == "build" ];
then
mkdir -p $myBUILDCACHE
rm -f "$myBUILDERLOG" "$myBUILDERERR"
echo "### Building images ..."
fuBUILDIMAGES "" "$myIMAGESBASE" ""
fuBUILDIMAGES "elk/" "$myIMAGESELK" ""
fuBUILDIMAGES "tanner/" "$myIMAGESTANNER" ""
fi
# Build and push images
if [ "$1" == "push" ];
then
mkdir -p $myBUILDCACHE
rm -f "$myBUILDERLOG" "$myBUILDERERR"
echo "### Building and pushing images ..."
fuBUILDIMAGES "" "$myIMAGESBASE" "--push"
fuBUILDIMAGES "elk/" "$myIMAGESELK" "--push"
fuBUILDIMAGES "tanner/" "$myIMAGESTANNER" "--push"
fi

View file

@ -26,6 +26,7 @@ RUN apk --no-cache -U upgrade && \
git clone https://github.com/cymmetria/ciscoasa_honeypot && \
cd ciscoasa_honeypot && \
git checkout d6e91f1aab7fe6fc01fabf2046e76b68dd6dc9e2 && \
sed -i "s/git+git/git+https/g" requirements.txt && \
pip3 install --no-cache-dir -r requirements.txt && \
cp /root/dist/asa_server.py /opt/ciscoasa_honeypot && \
chown -R ciscoasa:ciscoasa /opt/ciscoasa_honeypot && \

View file

@ -176,7 +176,7 @@ services:
# Ewsposter service
ewsposter:
build: ews/.
build: ewsposter/.
image: "dtagdevsec/ewsposter:2203"
# Nginx service
@ -192,4 +192,4 @@ services:
# Map Web Service
map_web:
build: elk/map/.
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"

View file

@ -82,7 +82,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
depends_on:
- map_redis
@ -96,6 +96,6 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
depends_on:
- map_redis

View file

@ -27,7 +27,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
depends_on:
- map_redis
@ -41,6 +41,6 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
depends_on:
- map_redis

View file

@ -184,7 +184,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -199,7 +199,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service

View file

@ -87,7 +87,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -102,7 +102,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Nginx service

View file

@ -355,7 +355,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -370,7 +370,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service

View file

@ -174,7 +174,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -189,7 +189,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service

View file

@ -168,7 +168,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -183,7 +183,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service

View file

@ -193,7 +193,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -208,7 +208,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service

View file

@ -499,7 +499,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -514,7 +514,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service

View file

@ -578,7 +578,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -593,7 +593,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service

View file

@ -211,7 +211,7 @@ services:
tty: true
ports:
- "127.0.0.1:64299:64299"
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
## Map Data Service
map_data:
@ -226,7 +226,7 @@ services:
- /opt/tpot/etc/compose/elk_environment
stop_signal: SIGKILL
tty: true
image: "dtagdevsec/map_server:2203"
image: "dtagdevsec/map:2203"
#### /ELK
# Ewsposter service