Skip to content

Commit e3a1982

Browse files
committed
flatten efforts to fix the pkg/*/Dockerfiles
1 parent 2fd4f76 commit e3a1982

37 files changed

+407
-233
lines changed

optional-requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
azure==4.0.0
3+
azure-storage-common==2.1.0
4+
azure-storage-blob==2.1.0
5+
6+
boto3
7+
botocore

pkg/debian7/Dockerfile pkg/abandoned/debian7/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ RUN apt-get install -y ruby ruby-dev rubygems gcc make \
199199
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
200200
#use the following variables to choose the version of hubble
201201
ARG HUBBLE_CHECKOUT=v4.0.0
202-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
202+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
203203
ENV HUBBLE_VERSION=4.0.0
204204
ENV HUBBLE_ITERATION=1
205205
ENV HUBBLE_URL=https://github.com/hubblestack/hubble

pkg/dev/debian7/pyinstaller-requirements.txt pkg/abandoned/debian7/pyinstaller-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
pyinstaller==3.3.1
22
Tornado>=4.0.0,<5.0.0
3-
Crypto
3+
crypto
4+
pycryptodome
5+
cryptography
46
pyopenssl>=16.2.0
57
argparse
68
requests>=2.13.0

pkg/amazonlinux2016.09/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ ENV HUBBLE_ITERATION=1
167167
ENV HUBBLE_URL=https://github.com/hubblestack/hubble
168168
ENV HUBBLE_DESCRIPTION="Hubble is a modular, open-source, security & compliance auditing framework which is built in python, using SaltStack as a library."
169169
ENV HUBBLE_SUMMARY="Profile based on-demand auditing and monitoring tool"
170-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
170+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
171171
ENV HUBBLE_SRC_PATH=/hubble_src
172172
ENV _HOOK_DIR="./pkg/"
173173
ENV _BINARY_LOG_LEVEL="INFO"

pkg/amazonlinux2016.09/pyinstaller-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pyinstaller==3.3.1
2-
Crypto
2+
crypto
3+
pycryptodome
4+
cryptography
35
pyopenssl>=16.2.0
46
argparse
57
requests>=2.13.0

pkg/centos6/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ ENV HUBBLE_ITERATION=1
167167
ENV HUBBLE_URL=https://github.com/hubblestack/hubble
168168
ENV HUBBLE_DESCRIPTION="Hubble is a modular, open-source, security & compliance auditing framework which is built in python, using SaltStack as a library."
169169
ENV HUBBLE_SUMMARY="Profile based on-demand auditing and monitoring tool"
170-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
170+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
171171
ENV HUBBLE_SRC_PATH=/hubble_src
172172
ENV _HOOK_DIR="./pkg/"
173173
ENV _BINARY_LOG_LEVEL="INFO"

pkg/centos6/pyinstaller-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pyinstaller==3.3.1
2-
Crypto
2+
crypto
3+
pycryptodome
4+
cryptography
35
pyopenssl>=16.2.0
46
argparse
57
requests>=2.13.0

pkg/centos7/Dockerfile

+17-54
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,17 @@ RUN mkdir -p "$LIBGIT2TEMP" \
134134
&& make \
135135
&& make install
136136

137+
#fpm package making requirements start
138+
RUN yum install -y ruby ruby-devel rpmbuild rpm-build rubygems gcc make \
139+
&& gem install --no-ri --no-rdoc fpm
140+
141+
# things we may need to build a python
142+
RUN yum install -y bzip2-devel
143+
137144
# use pyenv
138145
ARG PYENV_VERSION=3.6.10
139146
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
140-
ENV PYENV_ROOT=/usr/local/pyenv
147+
ENV PYENV_ROOT=/opt/pyenv
141148
ENV PATH=$PYENV_ROOT/bin:$PATH
142149
RUN umask 022 \
143150
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
@@ -147,14 +154,8 @@ RUN umask 022 \
147154
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
148155
&& pyenv global $PYENV_VERSION
149156

150-
COPY pyinstaller-requirements.txt /
151157
RUN eval "$(pyenv init -)" \
152-
&& pip -v install --upgrade pip \
153-
&& pip -v install -r pyinstaller-requirements.txt
154-
155-
#fpm package making requirements start
156-
RUN yum install -y ruby ruby-devel rpmbuild rpm-build rubygems gcc make \
157-
&& gem install --no-ri --no-rdoc fpm
158+
&& pip -v install --upgrade pip
158159

159160
#pyinstaller start
160161
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
@@ -165,62 +166,24 @@ ENV HUBBLE_ITERATION=1
165166
ENV HUBBLE_URL=https://github.com/hubblestack/hubble
166167
ENV HUBBLE_DESCRIPTION="Hubble is a modular, open-source, security & compliance auditing framework which is built in python, using SaltStack as a library."
167168
ENV HUBBLE_SUMMARY="Profile based on-demand auditing and monitoring tool"
168-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
169+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
169170
ENV HUBBLE_SRC_PATH=/hubble_src
170171
ENV _HOOK_DIR="./pkg/"
171172
ENV _BINARY_LOG_LEVEL="INFO"
172173
ENV _INCLUDE_PATH=""
173174
ENV LD_LIBRARY_PATH=/opt/hubble/lib:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
174-
RUN git clone "$HUBBLE_GIT_URL" "$HUBBLE_SRC_PATH" \
175+
RUN set -x; git clone "$HUBBLE_GIT_URL" "$HUBBLE_SRC_PATH" \
175176
&& cd "$HUBBLE_SRC_PATH" \
176177
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
177178
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
178179
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
179180
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
181+
RUN eval "$(pyenv init -)" \
182+
&& cd "$HUBBLE_SRC_PATH" \
183+
&& python setup.py egg_info \
184+
&& pip install --upgrade -r hubblestack.egg-info/requires.txt -r optional-requirements.txt
180185
RUN mkdir /data
181186
VOLUME /data
182187
WORKDIR /hubble_build
183-
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
184-
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
185-
&& eval \"$(pyenv init -)\" \
186-
&& pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py \
187-
&& mkdir -p /var/log/hubble_osquery/backuplogs \
188-
# hubble default configuration file
189-
&& cp -rf /hubble_build/conf/hubble /etc/hubble/ \
190-
&& cp -rf /hubble_build/conf/hubble-profile.sh /etc/profile.d/ \
191-
&& cp -pr /hubble_build/dist/hubble /opt/hubble/hubble-libs \
192-
&& ln -s /opt/hubble/hubble-libs/hubble /opt/hubble/hubble \
193-
# make sure rpm shared libs are taken out to avoid mismatch between rpm database and shared libs that pyinstaller includes
194-
&& rm -rf /opt/hubble/hubble-libs/librpm* \
195-
#rpm pkg start
196-
&& tar -cPvzf /data/hubblestack-${HUBBLE_VERSION}.tar.gz /etc/hubble /opt/hubble /opt/osquery /etc/profile.d/hubble-profile.sh /var/log/hubble_osquery/backuplogs \
197-
&& mkdir -p /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION} \
198-
&& tar -xzvf /data/hubblestack-${HUBBLE_VERSION}.tar.gz -C /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION} \
199-
&& mkdir -p /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/usr/lib/systemd/system \
200-
&& cp /hubble_build/pkg/hubble.service /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/usr/lib/systemd/system/ \
201-
&& cp -f /hubble_build/conf/hubble /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/etc/hubble/ \
202-
#during container run, if a configuration file exists in a /data copy it over the existing one so it would be
203-
#possile to optionally include a custom one with the package
204-
&& if [ -f /data/hubble ] ; then cp /data/hubble /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/etc/hubble/ ; fi \
205-
#also bring in anything from a /data/opt/ directory so we can bundle other executables if needed
206-
&& if [ -d /data/opt ] ; then cp -r /data/opt/* /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/opt/ ; fi \
207-
&& cd /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION} \
208-
&& mkdir -p usr/bin \
209-
#symlink to have hubble binary in path
210-
&& ln -s /opt/hubble/hubble usr/bin/hubble \
211-
#fpm start
212-
&& fpm -s dir -t rpm \
213-
-n hubblestack \
214-
-v ${HUBBLE_VERSION} \
215-
--iteration ${HUBBLE_ITERATION} \
216-
--url ${HUBBLE_URL} \
217-
--description \"${HUBBLE_DESCRIPTION}\" \
218-
--rpm-summary \"${HUBBLE_SUMMARY}\" \
219-
--after-install /hubble_build/conf/afterinstall-systemd.sh \
220-
--after-upgrade /hubble_build/conf/afterupgrade-systemd.sh \
221-
--before-remove /hubble_build/conf/beforeremove.sh \
222-
etc/hubble opt usr /var/log/hubble_osquery/backuplogs \
223-
#edit to change iteration number, if necessary
224-
&& cp hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.x86_64.rpm /data/hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.el7.x86_64.rpm \
225-
&& openssl dgst -sha256 /data/hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.el7.x86_64.rpm \
226-
> /data/hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.el7.x86_64.rpm.sha256" ]
188+
COPY entrypoint.sh /entrypoint.sh
189+
ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ]

pkg/centos7/entrypoint.sh

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
3+
# use the global pyenv version
4+
eval "$(pyenv init -)"
5+
6+
# if ENTRYPOINT is given a CMD other than nothing
7+
# abort here and do that other CMD
8+
if [ $# -gt 0 ]
9+
then exec "$@"
10+
fi
11+
12+
# from now on, exit on error (rather than && every little thing)
13+
set -x -e
14+
15+
cp -rf "$HUBBLE_SRC_PATH"/* /hubble_build/
16+
17+
# possibly replace the version file
18+
if [ -f /data/hubble_buildinfo ]; then
19+
echo >> /hubble_build/hubblestack/__init__.py
20+
cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py
21+
fi
22+
23+
24+
cd /hubble_build || exit 1 # we already exit by set -e, but ...
25+
26+
pip install --upgrade -r optional-requirements.txt
27+
pip install .
28+
29+
ln -svf $(pyenv prefix)/bin/hubble /opt/hubble/hubble
30+
31+
mkdir -p /var/log/hubble_osquery/backuplogs
32+
33+
rm -rf /opt/hubble/hubble-libs/librpm*
34+
rm -rf /opt/pyenv/.git
35+
36+
# rpm pkg start
37+
tar -cPvvzf /data/hubblestack-${HUBBLE_VERSION}.tar.gz /etc/hubble \
38+
/opt/hubble /opt/osquery /etc/profile.d/hubble-profile.sh \
39+
/var/log/hubble_osquery/backuplogs \
40+
/opt/pyenv 2>&1 \
41+
| tee /hubble_build/rpm-pkg-start-tar.log
42+
43+
mkdir -p /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}
44+
tar -xzvvf /data/hubblestack-${HUBBLE_VERSION}.tar.gz -C \
45+
/hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}
46+
47+
mkdir -p /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/usr/lib/systemd/system
48+
cp /hubble_build/pkg/hubble.service \
49+
/hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/usr/lib/systemd/system/
50+
cp -f /hubble_build/conf/hubble \
51+
/hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/etc/hubble/
52+
53+
# during container run, if a configuration file exists in a /data copy it over
54+
# the existing one so it would be possile to optionally include a custom one
55+
# with the package
56+
if [ -f /data/hubble ]
57+
then cp /data/hubble /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/etc/hubble/
58+
fi
59+
60+
# also bring in anything from a /data/opt/ directory so we can bundle other executables if needed
61+
if [ -d /data/opt ]
62+
then cp -r /data/opt/* /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}/opt/
63+
fi
64+
65+
# symlink to have hubble binary in path
66+
cd /hubble_build/debbuild/hubblestack-${HUBBLE_VERSION}
67+
mkdir -p usr/bin
68+
ln -s /opt/hubble/hubble usr/bin/hubble
69+
70+
# fpm start
71+
fpm -s dir -t rpm \
72+
-n hubblestack \
73+
-v ${HUBBLE_VERSION} \
74+
--iteration ${HUBBLE_ITERATION} \
75+
--url ${HUBBLE_URL} \
76+
--description "${HUBBLE_DESCRIPTION}" \
77+
--rpm-summary "${HUBBLE_SUMMARY}" \
78+
--after-install /hubble_build/conf/afterinstall-systemd.sh \
79+
--after-upgrade /hubble_build/conf/afterupgrade-systemd.sh \
80+
--before-remove /hubble_build/conf/beforeremove.sh \
81+
etc/hubble opt usr /var/log/hubble_osquery/backuplogs
82+
83+
# edit to change iteration number, if necessary
84+
cp hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.x86_64.rpm \
85+
/data/hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.el7.x86_64.rpm
86+
87+
openssl dgst -sha256 /data/hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.el7.x86_64.rpm \
88+
> /data/hubblestack-${HUBBLE_VERSION}-${HUBBLE_ITERATION}.el7.x86_64.rpm.sha256

pkg/centos7/pyinstaller-requirements.txt

-20
This file was deleted.

pkg/coreos/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ RUN eval "$(pyenv init -)" \
174174
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
175175
#use the following variables to choose the version of hubble
176176
ARG HUBBLE_CHECKOUT=v4.0.0
177-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
177+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
178178
ENV HUBBLE_VERSION=4.0.0
179179
ENV HUBBLE_ITERATION=1
180180
ENV HUBBLE_SRC_PATH=/hubble_src

pkg/coreos/pyinstaller-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pyinstaller==3.3.1
2-
Crypto
2+
crypto
3+
pycryptodome
4+
cryptography
35
pyopenssl>=16.2.0
46
argparse
57
requests>=2.13.0

pkg/debian10/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ RUN apt-get install -y ruby ruby-dev rubygems gcc make \
178178
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
179179
#use the following variables to choose the version of hubble
180180
ARG HUBBLE_CHECKOUT=v4.0.0
181-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
181+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
182182
ENV HUBBLE_VERSION=4.0.0
183183
ENV HUBBLE_ITERATION=1
184184
ENV HUBBLE_URL=https://github.com/hubblestack/hubble

pkg/debian10/pyinstaller-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pyinstaller==3.3.1
2-
Crypto
2+
crypto
3+
pycryptodome
4+
cryptography
35
pyopenssl>=16.2.0
46
argparse
57
requests>=2.13.0

pkg/debian8/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ RUN apt-get install -y ruby ruby-dev rubygems gcc make \
180180
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
181181
#use the following variables to choose the version of hubble
182182
ARG HUBBLE_CHECKOUT=v4.0.0
183-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
183+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
184184
ENV HUBBLE_VERSION=4.0.0
185185
ENV HUBBLE_ITERATION=1
186186
ENV HUBBLE_URL=https://github.com/hubblestack/hubble

pkg/debian8/pyinstaller-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pyinstaller==3.3.1
2-
Crypto
2+
crypto
3+
pycryptodome
4+
cryptography
35
pyopenssl>=16.2.0
46
argparse
57
requests>=2.13.0

pkg/debian9/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ RUN apt-get install -y ruby ruby-dev rubygems gcc make \
178178
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
179179
#use the following variables to choose the version of hubble
180180
ARG HUBBLE_CHECKOUT=v4.0.0
181-
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
181+
ARG HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
182182
ENV HUBBLE_VERSION=4.0.0
183183
ENV HUBBLE_ITERATION=1
184184
ENV HUBBLE_URL=https://github.com/hubblestack/hubble

pkg/debian9/pyinstaller-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pyinstaller==3.3.1
2-
Crypto
2+
crypto
3+
pycryptodome
4+
cryptography
35
pyopenssl>=16.2.0
46
argparse
57
requests>=2.13.0

0 commit comments

Comments
 (0)