Bump misp and misp-modules

pull/1/head
Stefano Ortolani 2023-05-16 15:26:20 +01:00
parent 0f158150a0
commit 5c78c3492c
4 changed files with 72 additions and 68 deletions

View File

@ -1,10 +1,12 @@
ARG DOCKER_HUB_PROXY=""
FROM "${DOCKER_HUB_PROXY}python:3.9-slim-bullseye" as builder
ENV DEBIAN_FRONTEND noninteractive
ARG MODULES_TAG
ARG MODULES_COMMIT
# Install development environment
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
git \
@ -18,13 +20,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
# Build MISP Modules
RUN mkdir /wheel
WORKDIR /srv
RUN if [ ! -z ${MODULES_COMMIT} ]; then \
git clone https://github.com/MISP/misp-modules.git /srv/misp-modules && cd /srv/misp-modules && git checkout ${MODULES_COMMIT}; \
else git clone --branch ${MODULES_TAG} --depth 1 https://github.com/MISP/misp-modules.git /srv/misp-modules; fi
RUN cd /srv/misp-modules; \
echo "pyeti" >> REQUIREMENTS; \
echo "git+https://github.com/abenassi/Google-Search-API" >> REQUIREMENTS; \
@ -42,6 +44,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
FROM "${DOCKER_HUB_PROXY}python:3.9-slim-bullseye"
# Install runtime environment
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libzbar0 \
@ -56,11 +59,11 @@ COPY --from=builder /usr/local/lib/libfaupl* /usr/local/lib/
RUN pip install --use-deprecated=legacy-resolver /wheel/*.whl; ldconfig
# Since we compile faup ourselves and lua is not required anymore, we can load our own library
# and skip the pre-compiled blob to improve compatibility with other architectures like arm
# and skip the pre-compiled blob to improve compatibility with other architectures like ARM
RUN sed -i s/LoadLibrary\(LOAD_LIB\)/LoadLibrary\(\"\\/usr\\/local\\/lib\\/libfaupl.so\"\)/ \
/usr/local/lib/python3.9/site-packages/pyfaup/__init__.py
# Remove double logging
# Remove double logging configuration from 'apiosintDS'
RUN sed -i "/logging.basicConfig/d" \
/usr/local/lib/python3.9/site-packages/apiosintDS/apiosintDS.py; \
sed -i "/logging.basicConfig/d" \
@ -68,4 +71,8 @@ RUN sed -i "/logging.basicConfig/d" \
sed -i "/logging.basicConfig/d" \
/usr/local/lib/python3.9/site-packages/apiosintDS/modules/listutils.py
# Disable (all) warnings raised when using 'future'
RUN sed -i '/import sys/a import warnings\nwarnings.warn = lambda *args, **kwargs: None' \
/usr/local/bin/misp-modules
ENTRYPOINT [ "/usr/local/bin/misp-modules", "-l", "0.0.0.0"]

View File

@ -73,6 +73,8 @@ FROM "${DOCKER_HUB_PROXY}debian:bullseye-slim" as python-build
echo "-e ." > requirements.txt; pip3 wheel -r requirements.txt --no-cache-dir -w /wheels/
# install PyMISP
# note: when using poetry the missing wheels are installed at installation time
# which is something we might need to fix
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr/local/ python3 -
RUN git clone --depth 1 https://github.com/MISP/PyMISP.git; \
cd PyMISP || exit; poetry build -f wheel; cp dist/*.whl /wheels/
@ -97,7 +99,6 @@ ARG PHP_VER
# OS Packages
RUN apt-get update; apt-get install -y --no-install-recommends \
# Requirements:
procps \
sudo \
nginx \
@ -136,7 +137,6 @@ ARG PHP_VER
curl jq \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
# MISP code
# Download MISP using git in the /var/www/ directory.
RUN if [ ! -z ${MISP_COMMIT} ]; then \
git clone https://github.com/MISP/MISP.git /var/www/MISP && cd /var/www/MISP && git checkout ${MISP_COMMIT}; \
@ -149,8 +149,7 @@ ARG PHP_VER
COPY --from=python-build /wheels /wheels
RUN pip3 install --no-cache-dir /wheels/*.whl && rm -rf /wheels
# PHP
# Install prebuilt libraries, latest composer, then install the app's PHP deps
# PHP: install prebuilt libraries, latest composer, then install the app's PHP deps
COPY --from=php-build /usr/lib/php/${PHP_VER}/ssdeep.so /usr/lib/php/${PHP_VER}/ssdeep.so
COPY --from=php-build /usr/lib/php/${PHP_VER}/rdkafka.so /usr/lib/php/${PHP_VER}/rdkafka.so
COPY --from=php-build /usr/lib/php/${PHP_VER}/brotli.so /usr/lib/php/${PHP_VER}/brotli.so
@ -172,7 +171,6 @@ ARG PHP_VER
# Make a copy of the file store, so we can sync from it
RUN cp -R /var/www/MISP/app/files /var/www/MISP/app/files.dist
# Make a copy of the configurations, so we can sync from it
RUN cp -R /var/www/MISP/app/Config /var/www/MISP/app/Config.dist

View File

@ -117,7 +117,7 @@ init_user() {
sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q "Security.password_policy_complexity" ${PASSWORD_POLICY}
sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q "Security.password_policy_length" ${PASSWORD_LENGTH}
else
echo "... leaving admin password as-is"
echo "... setting adming password skipped"
fi
echo 'UPDATE misp.users SET change_pw = 0 WHERE id = 1;' | ${MYSQLCMD}
}
@ -199,15 +199,14 @@ create_sync_servers() {
if [[ -z "$ORG_ID" ]]; then
# Add remote organization if missing
echo "... adding missing organization ${UUID}"
add_organization ${HOSTNAME} ${ADMIN_KEY} ${NAME} false ${UUID}
add_organization ${HOSTNAME} ${ADMIN_KEY} ${NAME} false ${UUID} > /dev/null
ORG_ID=$(get_organization ${HOSTNAME} ${ADMIN_KEY} ${UUID})
fi
# Add sync server
echo "... adding new sync server ${NAME} with organization id ${ORG_ID}"
JSON_DATA=$(echo "${!DATA}" | jq --arg org_id ${ORG_ID} 'del(.remote_org_uuid) | . + {remote_org_id: $org_id}')
echo "... adding new sync server ${JSON_DATA}"
add_server ${HOSTNAME} ${ADMIN_KEY} "$JSON_DATA"
add_server ${HOSTNAME} ${ADMIN_KEY} "$JSON_DATA" > /dev/null
done
}

View File

@ -1,5 +1,5 @@
MISP_TAG=v2.4.170
MODULES_TAG=v2.4.170
MISP_TAG=v2.4.171
MODULES_TAG=v2.4.171
PHP_VER=20190902
# MISP_COMMIT takes precedence over MISP_TAG
# MISP_COMMIT=c56d537