From 2d57f349c10aafa0cfc024c791adcc109c4d0961 Mon Sep 17 00:00:00 2001 From: James Rigassio Date: Thu, 25 Jun 2020 10:34:59 -0700 Subject: [PATCH 01/10] install scloud with splunk --- splunk/common-files/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/splunk/common-files/Dockerfile b/splunk/common-files/Dockerfile index 0f00308a..6d993ea0 100644 --- a/splunk/common-files/Dockerfile +++ b/splunk/common-files/Dockerfile @@ -109,7 +109,10 @@ RUN sed -i -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL\nans && chgrp ${ANSIBLE_GROUP} ${SPLUNK_ANSIBLE_HOME} ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \ && chmod 775 ${SPLUNK_ANSIBLE_HOME} \ && chmod 664 ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \ - && chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh + && chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh \ + # Install scloud + && wget -P /usr/local/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz \ + && tar -xf scloud_v3.0.0_linux_amd64.tar.gz USER ${ANSIBLE_USER} HEALTHCHECK --interval=30s --timeout=30s --start-period=3m --retries=5 CMD /sbin/checkstate.sh || exit 1 From 2f990774b76947b9ddf6854470a7500f3d7b964c Mon Sep 17 00:00:00 2001 From: James Rigassio Date: Thu, 25 Jun 2020 10:35:20 -0700 Subject: [PATCH 02/10] update copyright year --- splunk/common-files/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/splunk/common-files/Dockerfile b/splunk/common-files/Dockerfile index 6d993ea0..a9f8e22f 100644 --- a/splunk/common-files/Dockerfile +++ b/splunk/common-files/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2018 Splunk +# Copyright 2020 Splunk # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 977de276a202939254e2834ea221250aabe3842c Mon Sep 17 00:00:00 2001 From: James Rigassio Date: Thu, 25 Jun 2020 10:48:51 -0700 Subject: [PATCH 03/10] fix /usr/local/bin path error --- splunk/common-files/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/splunk/common-files/Dockerfile b/splunk/common-files/Dockerfile index a9f8e22f..aac2f26d 100644 --- a/splunk/common-files/Dockerfile +++ b/splunk/common-files/Dockerfile @@ -112,7 +112,7 @@ RUN sed -i -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL\nans && chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh \ # Install scloud && wget -P /usr/local/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz \ - && tar -xf scloud_v3.0.0_linux_amd64.tar.gz + && tar -xf /usr/local/bin/scloud_v3.0.0_linux_amd64.tar.gz /usr/local/bin/ USER ${ANSIBLE_USER} HEALTHCHECK --interval=30s --timeout=30s --start-period=3m --retries=5 CMD /sbin/checkstate.sh || exit 1 From 3ced28e3429a8b61d460b89d762cd27c739c7723 Mon Sep 17 00:00:00 2001 From: James Rigassio Date: Thu, 25 Jun 2020 10:49:49 -0700 Subject: [PATCH 04/10] -c flag tar --- splunk/common-files/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/splunk/common-files/Dockerfile b/splunk/common-files/Dockerfile index aac2f26d..78a3886a 100644 --- a/splunk/common-files/Dockerfile +++ b/splunk/common-files/Dockerfile @@ -112,7 +112,7 @@ RUN sed -i -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL\nans && chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh \ # Install scloud && wget -P /usr/local/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz \ - && tar -xf /usr/local/bin/scloud_v3.0.0_linux_amd64.tar.gz /usr/local/bin/ + && tar -xf /usr/local/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/local/bin/ USER ${ANSIBLE_USER} HEALTHCHECK --interval=30s --timeout=30s --start-period=3m --retries=5 CMD /sbin/checkstate.sh || exit 1 From 305f55fee23eca702453cc2b625adbcf274f629d Mon Sep 17 00:00:00 2001 From: Nelson Wang Date: Thu, 25 Jun 2020 13:25:04 -0700 Subject: [PATCH 05/10] Changing scloud location --- splunk/common-files/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/splunk/common-files/Dockerfile b/splunk/common-files/Dockerfile index 78a3886a..18f713f4 100644 --- a/splunk/common-files/Dockerfile +++ b/splunk/common-files/Dockerfile @@ -111,8 +111,9 @@ RUN sed -i -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL\nans && chmod 664 ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \ && chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh \ # Install scloud - && wget -P /usr/local/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz \ - && tar -xf /usr/local/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/local/bin/ + && wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz \ + && tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ \ + && rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz USER ${ANSIBLE_USER} HEALTHCHECK --interval=30s --timeout=30s --start-period=3m --retries=5 CMD /sbin/checkstate.sh || exit 1 From 6b071eeb7e73405972cc621e4af62d43a9221796 Mon Sep 17 00:00:00 2001 From: James Rigassio Date: Thu, 25 Jun 2020 14:58:18 -0700 Subject: [PATCH 06/10] include toml pypi module --- base/debian-10/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/debian-10/install.sh b/base/debian-10/install.sh index 1e2f7d0e..92284dce 100755 --- a/base/debian-10/install.sh +++ b/base/debian-10/install.sh @@ -33,7 +33,7 @@ apt update # put back tools for customer support apt-get install -y --no-install-recommends curl sudo libgssapi-krb5-2 busybox procps acl gcc libpython-dev libffi-dev libssl-dev apt-get install -y --no-install-recommends python-pip python-setuptools python-requests python-yaml -pip --no-cache-dir install ansible +pip --no-cache-dir install ansible toml apt-get remove -y gcc libffi-dev libssl-dev libpython-dev apt-get autoremove -y From 52c30a3e0ba2693197d6c23dbb9e65f2e447b674 Mon Sep 17 00:00:00 2001 From: Nelson Wang Date: Thu, 25 Jun 2020 15:55:40 -0700 Subject: [PATCH 07/10] Adding jmespath --- base/debian-10/install.sh | 2 +- base/redhat-8/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/debian-10/install.sh b/base/debian-10/install.sh index 1e2f7d0e..3dc8f161 100755 --- a/base/debian-10/install.sh +++ b/base/debian-10/install.sh @@ -33,7 +33,7 @@ apt update # put back tools for customer support apt-get install -y --no-install-recommends curl sudo libgssapi-krb5-2 busybox procps acl gcc libpython-dev libffi-dev libssl-dev apt-get install -y --no-install-recommends python-pip python-setuptools python-requests python-yaml -pip --no-cache-dir install ansible +pip --no-cache-dir install ansible jmespath apt-get remove -y gcc libffi-dev libssl-dev libpython-dev apt-get autoremove -y diff --git a/base/redhat-8/install.sh b/base/redhat-8/install.sh index b679bcaf..568b1200 100755 --- a/base/redhat-8/install.sh +++ b/base/redhat-8/install.sh @@ -34,7 +34,7 @@ wget -O /bin/busybox https://busybox.net/downloads/binaries/1.28.1-defconfig-mul chmod +x /bin/busybox microdnf -y --nodocs update gnutls kernel-headers microdnf -y --nodocs install python2-pip python2-devel redhat-rpm-config gcc libffi-devel openssl-devel -pip2 --no-cache-dir install requests ansible +pip2 --no-cache-dir install requests ansible jmespath microdnf -y remove gcc openssl-devel redhat-rpm-config python2-devel device-mapper-libs device-mapper trousers systemd systemd-pam \ dwz dbus dbus-common dbus-daemon dbus-tools dbus-libs go-srpm-macros iptables-libs annobin cryptsetup-libs \ ocaml-srpm-macros openblas-srpm-macros qt5-srpm-macros perl-srpm-macros rust-srpm-macros ghc-srpm-macros \ From 948e954b349d0f1dc976c85de9d295d157f8516d Mon Sep 17 00:00:00 2001 From: Nelson Wang Date: Tue, 7 Jul 2020 15:46:05 -0700 Subject: [PATCH 08/10] Adding scloud to base images to interact with SCS --- base/centos-7/install.sh | 5 +++++ base/debian-10/install.sh | 5 +++++ base/debian-9/install.sh | 5 +++++ base/redhat-8/install.sh | 5 +++++ splunk/common-files/Dockerfile | 6 +----- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/base/centos-7/install.sh b/base/centos-7/install.sh index 3bf831a1..543a64c7 100755 --- a/base/centos-7/install.sh +++ b/base/centos-7/install.sh @@ -21,6 +21,11 @@ export LANG=en_US.utf8 yum -y update && yum -y install wget sudo epel-release yum -y install busybox ansible python-requests +# Install scloud +wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz +tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ +rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz + cd /bin ln -s busybox killall ln -s busybox netstat diff --git a/base/debian-10/install.sh b/base/debian-10/install.sh index c54586c1..cb5fec2a 100755 --- a/base/debian-10/install.sh +++ b/base/debian-10/install.sh @@ -37,6 +37,11 @@ pip --no-cache-dir install ansible toml jmespath apt-get remove -y gcc libffi-dev libssl-dev libpython-dev apt-get autoremove -y +# Install scloud +wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz +tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ +rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz + cd /bin ln -s busybox killall ln -s busybox netstat diff --git a/base/debian-9/install.sh b/base/debian-9/install.sh index 9c591ead..66d625ce 100755 --- a/base/debian-9/install.sh +++ b/base/debian-9/install.sh @@ -37,6 +37,11 @@ apt-cache show ansible apt-get install -y --no-install-recommends ansible curl sudo libgssapi-krb5-2 busybox procps acl apt-get install -y --no-install-recommends python-requests +# Install scloud +wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz +tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ +rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz + cd /bin ln -s busybox diff ln -s busybox killall diff --git a/base/redhat-8/install.sh b/base/redhat-8/install.sh index 6e12b703..63d6ba55 100755 --- a/base/redhat-8/install.sh +++ b/base/redhat-8/install.sh @@ -44,6 +44,11 @@ microdnf -y remove gcc openssl-devel redhat-rpm-config python2-devel device-mapp libfdisk libpcap libseccomp libselinux-devel libutempter binutils libxcrypt-devel cpp glibc-devel glibc-headers \ krb5-devel libkadm5 platform-python-pip +# Install scloud +wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz +tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ +rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz + cd /bin ln -s python2 python || true ln -s busybox diff || true diff --git a/splunk/common-files/Dockerfile b/splunk/common-files/Dockerfile index 18f713f4..25c87eca 100644 --- a/splunk/common-files/Dockerfile +++ b/splunk/common-files/Dockerfile @@ -109,11 +109,7 @@ RUN sed -i -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL\nans && chgrp ${ANSIBLE_GROUP} ${SPLUNK_ANSIBLE_HOME} ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \ && chmod 775 ${SPLUNK_ANSIBLE_HOME} \ && chmod 664 ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \ - && chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh \ - # Install scloud - && wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz \ - && tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ \ - && rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz + && chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh USER ${ANSIBLE_USER} HEALTHCHECK --interval=30s --timeout=30s --start-period=3m --retries=5 CMD /sbin/checkstate.sh || exit 1 From db093e33573df8d04d4c28b394313b48f5a06452 Mon Sep 17 00:00:00 2001 From: Nelson Wang Date: Tue, 7 Jul 2020 15:58:51 -0700 Subject: [PATCH 09/10] Adding jmespath to all base images --- base/centos-7/install.sh | 2 +- base/debian-10/install.sh | 2 +- base/debian-9/install.sh | 2 +- base/redhat-8/install.sh | 2 +- splunk/common-files/Dockerfile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base/centos-7/install.sh b/base/centos-7/install.sh index 543a64c7..71a965a6 100755 --- a/base/centos-7/install.sh +++ b/base/centos-7/install.sh @@ -19,7 +19,7 @@ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 export LANG=en_US.utf8 yum -y update && yum -y install wget sudo epel-release -yum -y install busybox ansible python-requests +yum -y install busybox ansible python-requests python-jmespath # Install scloud wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz diff --git a/base/debian-10/install.sh b/base/debian-10/install.sh index cb5fec2a..3ea9c3bd 100755 --- a/base/debian-10/install.sh +++ b/base/debian-10/install.sh @@ -33,7 +33,7 @@ apt update # put back tools for customer support apt-get install -y --no-install-recommends curl sudo libgssapi-krb5-2 busybox procps acl gcc libpython-dev libffi-dev libssl-dev apt-get install -y --no-install-recommends python-pip python-setuptools python-requests python-yaml -pip --no-cache-dir install ansible toml jmespath +pip --no-cache-dir install ansible jmespath apt-get remove -y gcc libffi-dev libssl-dev libpython-dev apt-get autoremove -y diff --git a/base/debian-9/install.sh b/base/debian-9/install.sh index 66d625ce..fba1f027 100755 --- a/base/debian-9/install.sh +++ b/base/debian-9/install.sh @@ -35,7 +35,7 @@ apt-get update # put back tools for customer support apt-cache show ansible apt-get install -y --no-install-recommends ansible curl sudo libgssapi-krb5-2 busybox procps acl -apt-get install -y --no-install-recommends python-requests +apt-get install -y --no-install-recommends python-requests python-jmespath # Install scloud wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz diff --git a/base/redhat-8/install.sh b/base/redhat-8/install.sh index 63d6ba55..987db358 100755 --- a/base/redhat-8/install.sh +++ b/base/redhat-8/install.sh @@ -34,7 +34,7 @@ wget -O /bin/busybox https://busybox.net/downloads/binaries/1.28.1-defconfig-mul chmod +x /bin/busybox microdnf -y --nodocs update gnutls kernel-headers microdnf -y --nodocs install python2-pip python2-devel redhat-rpm-config gcc libffi-devel openssl-devel -pip2 --no-cache-dir install requests ansible toml jmespath +pip2 --no-cache-dir install requests ansible jmespath microdnf -y remove gcc openssl-devel redhat-rpm-config python2-devel device-mapper-libs device-mapper trousers systemd systemd-pam \ dwz dbus dbus-common dbus-daemon dbus-tools dbus-libs go-srpm-macros iptables-libs annobin cryptsetup-libs \ ocaml-srpm-macros openblas-srpm-macros qt5-srpm-macros perl-srpm-macros rust-srpm-macros ghc-srpm-macros \ diff --git a/splunk/common-files/Dockerfile b/splunk/common-files/Dockerfile index 25c87eca..c9701c90 100644 --- a/splunk/common-files/Dockerfile +++ b/splunk/common-files/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020 Splunk +# Copyright 2018-2020 Splunk # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From f62ca83e0c5b06b220f283318c196ec70a6aa780 Mon Sep 17 00:00:00 2001 From: Nelson Wang Date: Wed, 8 Jul 2020 15:10:29 -0700 Subject: [PATCH 10/10] Adding URL to Makefile; adding a few tests --- Makefile | 10 ++++++---- base/centos-7/Dockerfile | 3 +++ base/centos-7/install.sh | 6 +++--- base/debian-10/Dockerfile | 3 +++ base/debian-10/install.sh | 6 +++--- base/debian-9/Dockerfile | 3 +++ base/debian-9/install.sh | 6 +++--- base/redhat-8/Dockerfile | 3 +++ base/redhat-8/install.sh | 6 +++--- tests/test_docker_splunk.py | 30 +++++++++++++++++------------- 10 files changed, 47 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index fbfa95bb..062df46c 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,8 @@ SPLUNK_WIN_FILENAME ?= splunk-${SPLUNK_VERSION}-${SPLUNK_BUILD}-x64-release.msi SPLUNK_WIN_BUILD_URL ?= https://download.splunk.com/products/${SPLUNK_PRODUCT}/releases/${SPLUNK_VERSION}/windows/${SPLUNK_WIN_FILENAME} UF_WIN_FILENAME ?= splunkforwarder-${SPLUNK_VERSION}-${SPLUNK_BUILD}-x64-release.msi UF_WIN_BUILD_URL ?= https://download.splunk.com/products/universalforwarder/releases/${SPLUNK_VERSION}/windows/${UF_WIN_FILENAME} +# Splunk Cloud SDK binary +SCLOUD_URL ?= https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.7.0/scloud_v4.0.0_linux_amd64.tar.gz # Security Scanner Variables SCANNER_DATE := `date +%Y-%m-%d` @@ -59,16 +61,16 @@ ansible: base: base-debian-9 base-debian-10 base-centos-7 base-redhat-8 base-windows-2016 base-debian-10: - docker build ${DOCKER_BUILD_FLAGS} -t base-debian-10:${IMAGE_VERSION} ./base/debian-10 + docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} -t base-debian-10:${IMAGE_VERSION} ./base/debian-10 base-debian-9: - docker build ${DOCKER_BUILD_FLAGS} -t base-debian-9:${IMAGE_VERSION} ./base/debian-9 + docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} -t base-debian-9:${IMAGE_VERSION} ./base/debian-9 base-centos-7: - docker build ${DOCKER_BUILD_FLAGS} -t base-centos-7:${IMAGE_VERSION} ./base/centos-7 + docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} -t base-centos-7:${IMAGE_VERSION} ./base/centos-7 base-redhat-8: - docker build ${DOCKER_BUILD_FLAGS} --label version=${SPLUNK_VERSION} -t base-redhat-8:${IMAGE_VERSION} ./base/redhat-8 + docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} --label version=${SPLUNK_VERSION} -t base-redhat-8:${IMAGE_VERSION} ./base/redhat-8 base-windows-2016: docker build ${DOCKER_BUILD_FLAGS} -t base-windows-2016:${IMAGE_VERSION} ./base/windows-2016 diff --git a/base/centos-7/Dockerfile b/base/centos-7/Dockerfile index 53f7dd55..9421d5f5 100644 --- a/base/centos-7/Dockerfile +++ b/base/centos-7/Dockerfile @@ -15,5 +15,8 @@ FROM centos:7 LABEL maintainer="support@splunk.com" +ARG SCLOUD_URL +ENV SCLOUD_URL ${SCLOUD_URL} + COPY install.sh /install.sh RUN /install.sh && rm -rf /install.sh diff --git a/base/centos-7/install.sh b/base/centos-7/install.sh index 71a965a6..7de4088b 100755 --- a/base/centos-7/install.sh +++ b/base/centos-7/install.sh @@ -22,9 +22,9 @@ yum -y update && yum -y install wget sudo epel-release yum -y install busybox ansible python-requests python-jmespath # Install scloud -wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz -tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ -rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz +wget -O /usr/bin/scloud.tar.gz ${SCLOUD_URL} +tar -xf /usr/bin/scloud.tar.gz -C /usr/bin/ +rm /usr/bin/scloud.tar.gz cd /bin ln -s busybox killall diff --git a/base/debian-10/Dockerfile b/base/debian-10/Dockerfile index 1f3d0755..b8387264 100644 --- a/base/debian-10/Dockerfile +++ b/base/debian-10/Dockerfile @@ -15,6 +15,9 @@ FROM debian:buster-slim LABEL maintainer="support@splunk.com" +ARG SCLOUD_URL +ENV SCLOUD_URL ${SCLOUD_URL} + ENV DEBIAN_FRONTEND=noninteractive COPY install.sh /install.sh diff --git a/base/debian-10/install.sh b/base/debian-10/install.sh index 3ea9c3bd..a2033e53 100755 --- a/base/debian-10/install.sh +++ b/base/debian-10/install.sh @@ -38,9 +38,9 @@ apt-get remove -y gcc libffi-dev libssl-dev libpython-dev apt-get autoremove -y # Install scloud -wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz -tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ -rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz +wget -O /usr/bin/scloud.tar.gz ${SCLOUD_URL} +tar -xf /usr/bin/scloud.tar.gz -C /usr/bin/ +rm /usr/bin/scloud.tar.gz cd /bin ln -s busybox killall diff --git a/base/debian-9/Dockerfile b/base/debian-9/Dockerfile index 9b8f867a..9ecb89f2 100644 --- a/base/debian-9/Dockerfile +++ b/base/debian-9/Dockerfile @@ -15,6 +15,9 @@ FROM debian:stretch-slim LABEL maintainer="support@splunk.com" +ARG SCLOUD_URL +ENV SCLOUD_URL ${SCLOUD_URL} + ENV DEBIAN_FRONTEND=noninteractive COPY install.sh /install.sh diff --git a/base/debian-9/install.sh b/base/debian-9/install.sh index fba1f027..2f04be36 100755 --- a/base/debian-9/install.sh +++ b/base/debian-9/install.sh @@ -38,9 +38,9 @@ apt-get install -y --no-install-recommends ansible curl sudo libgssapi-krb5-2 bu apt-get install -y --no-install-recommends python-requests python-jmespath # Install scloud -wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz -tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ -rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz +wget -O /usr/bin/scloud.tar.gz ${SCLOUD_URL} +tar -xf /usr/bin/scloud.tar.gz -C /usr/bin/ +rm /usr/bin/scloud.tar.gz cd /bin ln -s busybox diff diff --git a/base/redhat-8/Dockerfile b/base/redhat-8/Dockerfile index 69cb834d..912f2650 100644 --- a/base/redhat-8/Dockerfile +++ b/base/redhat-8/Dockerfile @@ -24,6 +24,9 @@ LABEL name="splunk" \ summary="UBI 8 Docker image of Splunk Enterprise" \ description="Splunk Enterprise is a platform for operational intelligence. Our software lets you collect, analyze, and act upon the untapped value of big data that your technology infrastructure, security systems, and business applications generate. It gives you insights to drive operational performance and business results." +ARG SCLOUD_URL +ENV SCLOUD_URL ${SCLOUD_URL} + COPY install.sh /install.sh RUN mkdir /licenses \ diff --git a/base/redhat-8/install.sh b/base/redhat-8/install.sh index 987db358..2bb08447 100755 --- a/base/redhat-8/install.sh +++ b/base/redhat-8/install.sh @@ -45,9 +45,9 @@ microdnf -y remove gcc openssl-devel redhat-rpm-config python2-devel device-mapp krb5-devel libkadm5 platform-python-pip # Install scloud -wget -P /usr/bin/ https://github.com/splunk/splunk-cloud-sdk-go/releases/download/v1.6.0/scloud_v3.0.0_linux_amd64.tar.gz -tar -xf /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz -C /usr/bin/ -rm /usr/bin/scloud_v3.0.0_linux_amd64.tar.gz +wget -O /usr/bin/scloud.tar.gz ${SCLOUD_URL} +tar -xf /usr/bin/scloud.tar.gz -C /usr/bin/ +rm /usr/bin/scloud.tar.gz cd /bin ln -s python2 python || true diff --git a/tests/test_docker_splunk.py b/tests/test_docker_splunk.py index 2bad7bbe..12cd39d9 100644 --- a/tests/test_docker_splunk.py +++ b/tests/test_docker_splunk.py @@ -402,7 +402,7 @@ def test_splunk_entrypoint_no_provision(self): if cid: self.client.remove_container(cid, v=True, force=True) - def test_splunk_uid_gid(self): + def test_splunk_scloud(self): cid = None try: # Run container @@ -412,11 +412,13 @@ def test_splunk_uid_gid(self): # Wait a bit time.sleep(5) # If the container is still running, we should be able to exec inside - # Check that the git SHA exists in /opt/ansible - exec_command = self.client.exec_create(cid, "id", user="splunk") + # Check that the version returns successfully for multiple users + exec_command = self.client.exec_create(cid, "scloud version", user="splunk") std_out = self.client.exec_start(exec_command) - assert "uid=41812" in std_out - assert "gid=41812" in std_out + assert "scloud version " in std_out + exec_command = self.client.exec_create(cid, "scloud version", user="ansible") + std_out = self.client.exec_start(exec_command) + assert "scloud version " in std_out except Exception as e: self.logger.error(e) raise e @@ -434,7 +436,7 @@ def test_splunk_uid_gid(self): # Wait a bit time.sleep(5) # If the container is still running, we should be able to exec inside - # Check that the git SHA exists in /opt/ansible + # Check that the uid/gid is correct exec_command = self.client.exec_create(cid, "id", user="splunk") std_out = self.client.exec_start(exec_command) assert "uid=41812" in std_out @@ -506,8 +508,8 @@ def test_uf_entrypoint_no_provision(self): finally: if cid: self.client.remove_container(cid, v=True, force=True) - - def test_uf_uid_gid(self): + + def test_uf_scloud(self): cid = None try: # Run container @@ -517,11 +519,13 @@ def test_uf_uid_gid(self): # Wait a bit time.sleep(5) # If the container is still running, we should be able to exec inside - # Check that the git SHA exists in /opt/ansible - exec_command = self.client.exec_create(cid, "id", user="splunk") + # Check that the version returns successfully for multiple users + exec_command = self.client.exec_create(cid, "scloud version", user="splunk") std_out = self.client.exec_start(exec_command) - assert "uid=41812" in std_out - assert "gid=41812" in std_out + assert "scloud version " in std_out + exec_command = self.client.exec_create(cid, "scloud version", user="ansible") + std_out = self.client.exec_start(exec_command) + assert "scloud version " in std_out except Exception as e: self.logger.error(e) raise e @@ -539,7 +543,7 @@ def test_uf_uid_gid(self): # Wait a bit time.sleep(5) # If the container is still running, we should be able to exec inside - # Check that the git SHA exists in /opt/ansible + # Check that the uid/gid is correct exec_command = self.client.exec_create(cid, "id", user="splunk") std_out = self.client.exec_start(exec_command) assert "uid=41812" in std_out