Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MISP Docker container with on an updated Ubuntu 16.04.02 LTS, MariaDB 10, PHP7 #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
# # docker build -t <tag> --build-arg MYSQL_ROOT_PASSWORD=<mysql_root_pw> .

# We are based on Ubuntu:trusty
FROM ubuntu:trusty
MAINTAINER Xavier Mertens <[email protected]>
FROM ubuntu:xenial

# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
Expand All @@ -22,7 +21,7 @@ RUN echo "DEBUG"
# Upgrade Ubuntu
RUN \
apt-get update && \
apt-get dist-upgrade -y && \
# apt-get dist-upgrade -y && \
apt-get autoremove -y && \
apt-get clean

Expand All @@ -39,15 +38,15 @@ RUN \
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Preconfigure setting for packages
RUN echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
RUN echo "mariadb-server-10.0 mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
RUN echo "mariadb-server-10.0 mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
#RUN echo "postfix postfix/main_mailer_type string Local only" | debconf-set-selections
#RUN echo "postfix postfix/mailname string localhost.localdomain" | debconf-set-selections

# Install packages
RUN \
apt-get install -y libjpeg8-dev apache2 curl git less libapache2-mod-php5 make mysql-common-5.6 mysql-client-5.6 mysql-server-5.6 php5-gd \
php5-mysql php5-dev php-pear postfix redis-server sudo tree vim zip openssl gnupg gnupg-agent \
apt-get install -y libjpeg8-dev apache2 curl git less libapache2-mod-php make mariadb-server mariadb-client php-gd \
php-mysql php-dev php7.0-mbstring php-pear postfix redis-server sudo tree vim zip openssl gnupg gnupg-agent \
whois && \
apt-get clean

Expand Down Expand Up @@ -107,12 +106,12 @@ RUN \

# CakeResque normally uses phpredis to connect to redis, but it has a (buggy) fallback connector through Redisent.
# It is highly advised to install phpredis
RUN pecl install redis-2.2.8
RUN apt-get install -y php5-redis
RUN pecl install redis-3.1.1
RUN apt-get install -y php-redis

# After installing it, enable it in your php.ini file
# add the following line
RUN echo "extension=redis.so" >> /etc/php5/apache2/php.ini
RUN echo "extension=redis.so" >> /etc/php/7.0/apache2/php.ini

# To use the scheduler worker for scheduled tasks, do the following
RUN cp -fa /var/www/MISP/INSTALL/setup/config.php /var/www/MISP/app/Plugin/CakeResque/Config/config.php
Expand Down
14 changes: 7 additions & 7 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [ -r /.firstboot.tmp ]; then
service mysql start >/dev/null 2>&1
sleep 5

ret=`echo 'SHOW DATABASES;' | mysql -u root --password="$MYSQL_ROOT_PASSWORD" -h 127.0.0.1 -P 3306 # 2>&1`
ret=`echo 'SHOW DATABASES;' | mysql -u root # 2>&1`

if [ $? -eq 0 ]; then
echo "Connected to database successfully!"
Expand All @@ -48,12 +48,12 @@ create database misp;
grant usage on *.* to misp identified by "$MYSQL_MISP_PASSWORD";
grant all privileges on misp.* to misp;
EOSQL
ret=`mysql -u root --password="$MYSQL_ROOT_PASSWORD" -h 127.0.0.1 -P 3306 2>&1 < /tmp/create_misp_database.sql`
ret=`mysql -u root 2>&1 < /tmp/create_misp_database.sql`
if [ $? -eq 0 ]; then
echo "Created database misp successfully!"

echo "Importing /var/www/MISP/INSTALL/MYSQL.sql ..."
ret=`mysql -u misp --password="$MYSQL_MISP_PASSWORD" misp -h 127.0.0.1 -P 3306 2>&1 < /var/www/MISP/INSTALL/MYSQL.sql`
ret=`mysql -u misp --password="$MYSQL_MISP_PASSWORD" misp 2>&1 < /var/www/MISP/INSTALL/MYSQL.sql`
if [ $? -eq 0 ]; then
echo "Imported /var/www/MISP/INSTALL/MYSQL.sql successfully"
else
Expand Down Expand Up @@ -95,10 +95,10 @@ EOSQL

# Fix php.ini with recommended settings
echo "Optimizing php.ini (based on MISP recommendations) ..."
sed -i "s/max_execution_time = 30/max_execution_time = 300/" /etc/php5/apache2/php.ini
sed -i "s/memory_limit = 128M/memory_limit = 512M/" /etc/php5/apache2/php.ini
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 50M/" /etc/php5/apache2/php.ini
sed -i "s/post_max_size = 8M/post_max_size = 50M/" /etc/php5/apache2/php.ini
sed -i "s/max_execution_time = 30/max_execution_time = 300/" /etc/php/7.0/apache2/php.ini
sed -i "s/memory_limit = 128M/memory_limit = 512M/" /etc/php/7.0/apache2/php.ini
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 50M/" /etc/php/7.0/apache2/php.ini
sed -i "s/post_max_size = 8M/post_max_size = 50M/" /etc/php/7.0/apache2/php.ini

# Generate the admin user PGP key
if [ -z "$MISP_ADMIN_EMAIL" -o -z "$MISP_ADMIN_PASSPHRASE" ]; then
Expand Down