diff --git a/docker/heimdall/Dockerfile b/docker/heimdall/Dockerfile index 151ecce9..07229b75 100644 --- a/docker/heimdall/Dockerfile +++ b/docker/heimdall/Dockerfile @@ -33,33 +33,40 @@ RUN sed -i 's/dl-cdn/dl-2/g' /etc/apk/repositories && \ cd /var/lib/nginx/html && \ cp .env.example .env && \ php artisan key:generate && \ +# ## Add previously configured content mkdir -p /var/lib/nginx/html/storage/app/public/backgrounds/ && \ cp /root/dist/app/bg1.jpg /var/lib/nginx/html/public/img/bg1.jpg && \ cp /root/dist/app/t-pot.png /var/lib/nginx/html/public/img/heimdall-icon-small.png && \ cp /root/dist/app/app.sqlite /var/lib/nginx/html/database/app.sqlite && \ cp /root/dist/app/cyberchef.png /var/lib/nginx/html/storage/app/public/icons/ZotKKZA2QKplZhdoF3WLx4UdKKhLFamf3lSMcLkr.png && \ + cp /root/dist/app/eshead.png /var/lib/nginx/html/storage/app/public/icons/77KqFv4YIshXUDLDoOvZ1NUbsKDtsMAjJvg4sYqN.png && \ cp /root/dist/app/tsec.png /var/lib/nginx/html/storage/app/public/icons/RHwXCfCeGNDdhYgzlShL9o4NBFL2LHZWajgyeL0a.png && \ - cp /root/dist/app/spiderfoot.png /var/lib/nginx/html/storage/app/public/icons/eIllmzavE52rNpg9CBoMg1tymHjEOgUnSTHuBwzc.png && \ + cp /root/dist/app/spiderfoot.png /var/lib/nginx/html/storage/app/public/icons/s7uPe1frJqjv76oI6SNqNbWUsgU1GHYqRALMlwYb.png && \ cp /root/dist/html/*.html /var/lib/nginx/html/public/ && \ cp /root/dist/html/favicon.ico /var/lib/nginx/html/public/favicon-16x16.png && \ cp /root/dist/html/favicon.ico /var/lib/nginx/html/public/favicon-32x32.png && \ cp /root/dist/html/favicon.ico /var/lib/nginx/html/public/favicon-96x96.png && \ cp /root/dist/html/favicon.ico /var/lib/nginx/html/public/favicon.ico && \ +# ## Change ownership, permissions chown root:www-data -R /var/lib/nginx/html && \ chmod 775 -R /var/lib/nginx/html/storage && \ chmod 775 -R /var/lib/nginx/html/database && \ sed -i "s/user = nobody/user = nginx/g" /etc/php7/php-fpm.d/www.conf && \ sed -i "s/group = nobody/group = nginx/g" /etc/php7/php-fpm.d/www.conf && \ + sed -i "s#;upload_tmp_dir =#upload_tmp_dir = /var/lib/nginx/tmp#g" /etc/php7/php.ini && \ sed -i "s/9000/64304/g" /etc/php7/php-fpm.d/www.conf && \ sed -i "s/APP_NAME=Heimdall/APP_NAME=T-Pot/g" /var/lib/nginx/html/.env && \ - #mkdir -p /run/nginx && \ ## Add Nginx / T-Pot specific configs rm -rf /etc/nginx/conf.d/* /usr/share/nginx/html/* && \ cp /root/dist/conf/nginx.conf /etc/nginx/ && \ cp -R /root/dist/conf/ssl /etc/nginx/ && \ cp /root/dist/conf/tpotweb.conf /etc/nginx/conf.d/ && \ + cp /root/dist/start.sh / && \ +## Pack database for first time usage + cd /var/lib/nginx && \ + tar cvfz first.tgz /var/lib/nginx/html/database /var/lib/nginx/html/storage && \ # # Clean up apk del --purge \ @@ -68,4 +75,4 @@ RUN sed -i 's/dl-cdn/dl-2/g' /etc/apk/repositories && \ rm -rf /var/cache/apk/* # # Start nginx -CMD php-fpm7 && exec nginx -g 'daemon off;' +CMD /start.sh && php-fpm7 && exec nginx -g 'daemon off;' diff --git a/docker/heimdall/dist/app/app.sqlite b/docker/heimdall/dist/app/app.sqlite index 0afe0628..5447bd06 100755 Binary files a/docker/heimdall/dist/app/app.sqlite and b/docker/heimdall/dist/app/app.sqlite differ diff --git a/docker/heimdall/dist/app/bg1.jpg b/docker/heimdall/dist/app/bg1.jpg index a0be4e9b..1130ed2e 100644 Binary files a/docker/heimdall/dist/app/bg1.jpg and b/docker/heimdall/dist/app/bg1.jpg differ diff --git a/docker/heimdall/dist/app/eshead.png b/docker/heimdall/dist/app/eshead.png new file mode 100644 index 00000000..55cf04c5 Binary files /dev/null and b/docker/heimdall/dist/app/eshead.png differ diff --git a/docker/heimdall/dist/app/spiderfoot.png b/docker/heimdall/dist/app/spiderfoot.png index d145db8b..f2ac38f5 100644 Binary files a/docker/heimdall/dist/app/spiderfoot.png and b/docker/heimdall/dist/app/spiderfoot.png differ diff --git a/docker/heimdall/dist/start.sh b/docker/heimdall/dist/start.sh new file mode 100755 index 00000000..6e986628 --- /dev/null +++ b/docker/heimdall/dist/start.sh @@ -0,0 +1,10 @@ +#!/bin/ash +if [ "$(ls /var/lib/nginx/html/database)" = "" ] && [ "$HEIMDALL_PERSIST" = "YES" ]; + then + tar xvfz /var/lib/nginx/first.tgz -C / +fi +if [ "$HEIMDALL_PERSIST" = "YES" ]; + then + chmod 770 -R /var/lib/nginx/html/database /var/lib/nginx/html/storage + chown root:www-data -R /var/lib/nginx/html/database /var/lib/nginx/html/storage +fi diff --git a/docker/heimdall/docker-compose.yml b/docker/heimdall/docker-compose.yml index 3ce5a630..6fb399a3 100644 --- a/docker/heimdall/docker-compose.yml +++ b/docker/heimdall/docker-compose.yml @@ -7,6 +7,10 @@ services: build: . container_name: nginx restart: always + environment: + ### If set to YES all changes within Heimdall will remain for the next start + ### Make sure to uncomment the corresponding volume statements below, or the setting will prevent a successful start of T-Pot. + - HEIMDALL_PERSIST=NO tmpfs: - /var/tmp/nginx/client_body - /var/tmp/nginx/proxy @@ -15,7 +19,7 @@ services: - /var/tmp/nginx/scgi - /run - /var/log/php7/ - - /var/lib/nginx/tmp/:uid=100,gid=82 + - /var/lib/nginx/tmp:uid=100,gid=82 - /var/lib/nginx/html/storage/logs:uid=100,gid=82 - /var/lib/nginx/html/storage/framework/views:uid=100,gid=82 network_mode: "host" @@ -28,3 +32,6 @@ services: - /data/nginx/cert/:/etc/nginx/cert/:ro - /data/nginx/conf/nginxpasswd:/etc/nginx/nginxpasswd:ro - /data/nginx/log/:/var/log/nginx/ + ### Enable the following volumes if you set HEIMDALL_PERSIST=YES + # - /data/nginx/heimdall/database:/var/lib/nginx/html/database + # - /data/nginx/heimdall/storage:/var/lib/nginx/html/storage diff --git a/iso/installer/install.sh b/iso/installer/install.sh index 8b0a3408..cb92db9b 100755 --- a/iso/installer/install.sh +++ b/iso/installer/install.sh @@ -791,7 +791,7 @@ mkdir -p /data/adbhoney/downloads /data/adbhoney/log \ /data/honeypy/log \ /data/mailoney/log \ /data/medpot/log \ - /data/nginx/log \ + /data/nginx/log /data/nginx/heimdall \ /data/emobility/log \ /data/ews/conf \ /data/rdpy/log \ diff --git a/update.sh b/update.sh index ac62513a..fffaa35e 100755 --- a/update.sh +++ b/update.sh @@ -226,7 +226,7 @@ mkdir -p /data/adbhoney/downloads /data/adbhoney/log \ /data/honeypy/log \ /data/mailoney/log \ /data/medpot/log \ - /data/nginx/log \ + /data/nginx/log /data/nginx/heimdall \ /data/emobility/log \ /data/ews/conf \ /data/rdpy/log \