From 53409d64380f30e1f527e29493a7c62eb774034f Mon Sep 17 00:00:00 2001 From: Nat Date: Thu, 7 Oct 2021 22:19:27 +0530 Subject: [PATCH 1/5] FIX: Install otxv2 module using pip3 AlienVault OTX Collector bot fails without the otxv2 python module. --- .docker/intelmq-full/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/intelmq-full/Dockerfile b/.docker/intelmq-full/Dockerfile index f035b46..b441fb4 100644 --- a/.docker/intelmq-full/Dockerfile +++ b/.docker/intelmq-full/Dockerfile @@ -60,7 +60,7 @@ RUN useradd -d /etc/intelmq -U -s /bin/bash intelmq \ ### Install IntelMQ RUN cd /etc/intelmq \ - && pip3 install hug url-normalize geolib imbox jinja2 pyasn textx tld time-machine \ + && pip3 install hug url-normalize geolib imbox jinja2 pyasn textx tld time-machine otxv2 \ && pip3 install --force pymisp[fileobjects,openioc,virustotal] \ && pip3 install --no-cache-dir -e . \ && intelmqsetup From 39c3f9c5710cbea03808094822fecee4759863f0 Mon Sep 17 00:00:00 2001 From: Sebastian Waldbauer Date: Mon, 10 Jan 2022 12:55:14 +0100 Subject: [PATCH 2/5] FIX: fatal error of git describe, using --always Signed-off-by: Sebastian Waldbauer --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 8124607..7259538 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,9 @@ #!/bin/bash build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -git_ref_core=$(cd ./intelmq && git describe --long) -git_ref_manager=$(cd ./intelmq-manager && git describe --long) -git_ref_api=$(cd ./intelmq-api && git describe --long) -build_version=$(cd ./intelmq && git describe) +git_ref_core=$(cd ./intelmq && git describe --long --always) +git_ref_manager=$(cd ./intelmq-manager && git describe --long --always) +git_ref_api=$(cd ./intelmq-api && git describe --long --always) +build_version=$(cd ./intelmq && git describe --always) echo Building new IntelMQ-Image v$build_version echo Core : $git_ref_core From 251f61d419d029cbf70f2a204bf5d800dde22313 Mon Sep 17 00:00:00 2001 From: Sebastian Waldbauer Date: Mon, 31 Jan 2022 16:12:41 +0100 Subject: [PATCH 3/5] FIX: Docker build Signed-off-by: Sebastian Waldbauer --- .docker/intelmq-full/Dockerfile | 36 ++++++++++++++++----------------- entrypoint.sh | 4 ++-- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.docker/intelmq-full/Dockerfile b/.docker/intelmq-full/Dockerfile index b441fb4..7983b50 100644 --- a/.docker/intelmq-full/Dockerfile +++ b/.docker/intelmq-full/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye +FROM debian:bullseye-slim ENV LANG C.UTF-8 ARG BUILD_DATE @@ -14,13 +14,8 @@ LABEL maintainer="IntelMQ Team " \ org.opencontainers.image.documentation="https://intelmq.readthedocs.io/en/latest/" \ org.opencontainers.image.vendor="intelmq-team" - ### # libfuzzy-dev is used for pydeep -# -# -# -# RUN apt-get update \ && apt-get install -y --no-install-recommends \ sudo \ @@ -46,33 +41,36 @@ LABEL org.opencontainers.image.created=$BUILD_DATE \ org.opencontainers.image.revision=$VCS_REF \ org.opencontainers.image.version=$BUILD_VERSION -WORKDIR /opt +COPY ./intelmq /opt/intelmq +COPY ./intelmq-api /opt/intelmq-api -COPY ./intelmq /etc/intelmq -COPY ./intelmq-api /etc/intelmq-api - -RUN useradd -d /etc/intelmq -U -s /bin/bash intelmq \ +RUN useradd -d /opt/intelmq -U -s /bin/bash intelmq \ && adduser intelmq sudo \ - && echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ - && sudo chown -R intelmq:intelmq /etc/intelmq \ + && echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /opt/sudoers \ + && sudo chown -R intelmq:intelmq /opt/intelmq \ && mkdir -p /opt/intelmq_persistence \ && sudo chown -R intelmq:intelmq /opt/intelmq_persistence ### Install IntelMQ -RUN cd /etc/intelmq \ - && pip3 install hug url-normalize geolib imbox jinja2 pyasn textx tld time-machine otxv2 \ - && pip3 install --force pymisp[fileobjects,openioc,virustotal] \ - && pip3 install --no-cache-dir -e . \ +RUN pip3 install hug url-normalize geolib imbox jinja2 pyasn textx tld time-machine otxv2 \ + && pip3 install --force pymisp[fileobjects,openioc,virustotal] + +RUN cd /opt/intelmq \ + && pip3 install . + +RUN cd /opt/intelmq \ && intelmqsetup ### Install IntelMQ-API -RUN cd /etc/intelmq-api \ +RUN cd /opt/intelmq-api \ && python3 setup.py install ADD entrypoint.sh /opt/entrypoint.sh RUN chmod +x /opt/entrypoint.sh \ && chown intelmq:intelmq /opt/entrypoint.sh -USER intelmq:intelmq +WORKDIR /opt + +#USER intelmq:intelmq ENTRYPOINT [ "/opt/entrypoint.sh" ] diff --git a/entrypoint.sh b/entrypoint.sh index d296ff4..1652e84 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -14,7 +14,7 @@ intelmq-api-adduser --user "$intelmq_user" --password "$intelmq_pass" if [[ $1 == "selftest" ]] then export INTELMQ_TEST_EXOTIC=1 - nosetests3 /etc/intelmq/intelmq/tests + nosetests3 /opt/intelmq/intelmq/tests else - cd /etc/intelmq-api && hug -m intelmq_api.serve -p8080 + cd /opt/intelmq-api && hug -m intelmq_api.serve -p8080 fi From 7f81bf2651a81d458ed345144df953be5ffeaf52 Mon Sep 17 00:00:00 2001 From: Sebastian Waldbauer Date: Tue, 1 Feb 2022 10:34:18 +0100 Subject: [PATCH 4/5] FIX: Simplify git describe in build.sh Signed-off-by: Sebastian Waldbauer --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 7259538..5463161 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,9 @@ #!/bin/bash build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -git_ref_core=$(cd ./intelmq && git describe --long --always) -git_ref_manager=$(cd ./intelmq-manager && git describe --long --always) -git_ref_api=$(cd ./intelmq-api && git describe --long --always) -build_version=$(cd ./intelmq && git describe --always) +git_ref_core=$(git -C ./intelmq describe --long --always) +git_ref_manager=$(git -C ./intelmq-manager describe --long --always) +git_ref_api=$(git -C ./intelmq-api describe --long --always) +build_version=$(git -C ./intelmq describe --always) echo Building new IntelMQ-Image v$build_version echo Core : $git_ref_core From a865cbcf47cba8e61a9e273975a75ac8b0fe4657 Mon Sep 17 00:00:00 2001 From: Sebastian Waldbauer Date: Tue, 1 Feb 2022 11:13:13 +0100 Subject: [PATCH 5/5] FIX: Keep html directory after build Signed-off-by: Sebastian Waldbauer --- build.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 5463161..b9eb3d3 100755 --- a/build.sh +++ b/build.sh @@ -12,9 +12,7 @@ echo Api : $git_ref_api echo Build_date: $build_date # build static html -cd ./intelmq-manager \ - && python3 setup.py build \ - && cd .. +cd ./intelmq-manager && python3 setup.py build && cd .. docker build --build-arg BUILD_DATE=$build_date \ --build-arg VCS_REF="IntelMQ-Manager=$git_ref_manager" \ @@ -27,7 +25,3 @@ docker build --build-arg BUILD_DATE=$build_date \ --build-arg BUILD_VERSION=$build_version \ -f ./.docker/intelmq-full/Dockerfile \ -t intelmq-full:latest . - -cd ./intelmq-manager \ - && rm -r html \ - && cd ..