misp-docker/web/Dockerfile

84 lines
2.5 KiB
Docker
Raw Normal View History

2020-01-09 04:25:25 +01:00
2022-04-26 15:29:10 +02:00
FROM ubuntu:focal
2020-10-21 13:47:56 +02:00
2018-06-20 12:55:34 +02:00
# Install core components
ENV DEBIAN_FRONTEND noninteractive
2021-03-05 15:34:37 +01:00
RUN apt-get update && \
apt-get dist-upgrade -y && apt-get upgrade && apt-get autoremove -y && apt-get clean && \
2021-03-05 15:34:37 +01:00
apt-get install -y software-properties-common && \
apt-get install -y postfix && \
2021-03-05 20:58:54 +01:00
apt-get install -y mysql-client curl gcc git gnupg-agent \
make openssl redis-server sudo vim zip locales wget iproute2 supervisor cron
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get -y install python3.9 python3-pip
RUN pip3 install --upgrade pip
2021-03-05 15:40:49 +01:00
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
2021-03-08 22:58:54 +01:00
RUN useradd misp && usermod -aG sudo misp
2021-03-05 15:34:37 +01:00
# Install script
COPY --chown=misp:misp INSTALL_NODB.sh* ./
2021-03-05 17:39:03 +01:00
RUN chmod +x INSTALL_NODB.sh
2021-03-08 23:25:03 +01:00
RUN echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER misp
2021-03-08 22:36:58 +01:00
RUN bash INSTALL_NODB.sh -A -u
2020-10-21 13:47:56 +02:00
2021-03-08 23:25:03 +01:00
USER root
RUN pip3 list -o | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip3 install -U ; exit 0 #Hack error code
2020-10-21 13:47:56 +02:00
# Supervisord Setup
RUN ( \
echo '[supervisord]'; \
echo 'nodaemon = true'; \
echo ''; \
echo '[program:postfix]'; \
echo 'process_name = master'; \
echo 'directory = /etc/postfix'; \
echo 'command = /usr/sbin/postfix -c /etc/postfix start'; \
echo 'startsecs = 0'; \
echo 'autorestart = false'; \
echo ''; \
echo '[program:redis-server]'; \
echo 'command=redis-server /etc/redis/redis.conf'; \
echo 'user=redis'; \
2020-10-21 13:47:56 +02:00
echo ''; \
echo '[program:apache2]'; \
echo 'command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -D FOREGROUND"'; \
echo ''; \
echo '[program:resque]'; \
echo 'command=/bin/bash /var/www/MISP/app/Console/worker/start.sh'; \
echo 'startsecs = 0'; \
echo 'autorestart = false'; \
echo 'user=www-data'; \
2020-10-21 13:47:56 +02:00
echo ''; \
echo '[program:misp-modules]'; \
2021-03-09 16:41:03 +01:00
echo 'command=/bin/bash -c "/var/www/MISP/venv/bin/misp-modules -l 127.0.0.1 -s"'; \
2020-10-21 13:47:56 +02:00
echo 'startsecs = 0'; \
echo 'autorestart = false'; \
echo 'user=www-data'; \
) >> /etc/supervisor/conf.d/supervisord.conf
2020-10-21 13:47:56 +02:00
# Add run script
# Trigger to perform first boot operations
ADD run.sh /run.sh
RUN mv /etc/apache2/sites-available/misp-ssl.conf /etc/apache2/sites-available/misp-ssl.conf.bak
ADD misp-ssl.conf /etc/apache2/sites-available/misp-ssl.conf
2020-10-21 13:47:56 +02:00
RUN chmod 0755 /run.sh && touch /.firstboot.tmp
# Make a backup of /var/www/MISP to restore it to the local moint point at first boot
WORKDIR /var/www/MISP
RUN tar czpf /root/MISP.tgz .
VOLUME /var/www/MISP
EXPOSE 80
2018-06-20 12:55:34 +02:00
ENTRYPOINT ["/run.sh"]