Skip to content

Commit b39dec0

Browse files
authored
Centos 8 support (#422)
* base centos 8 image * py23 image centos 8 * py23 image and makefile centos 8 * Support for createdefaults.py py2/py3
1 parent d192f93 commit b39dec0

File tree

8 files changed

+190
-21
lines changed

8 files changed

+190
-21
lines changed

Makefile

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ansible:
5858
@cat splunk-ansible/version.txt
5959

6060
##### Base images #####
61-
base: base-debian-9 base-debian-10 base-centos-7 base-redhat-8 base-windows-2016
61+
base: base-debian-9 base-debian-10 base-centos-7 base-centos-8 base-redhat-8 base-windows-2016
6262

6363
base-debian-10:
6464
docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} -t base-debian-10:${IMAGE_VERSION} ./base/debian-10
@@ -69,14 +69,17 @@ base-debian-9:
6969
base-centos-7:
7070
docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} -t base-centos-7:${IMAGE_VERSION} ./base/centos-7
7171

72+
base-centos-8:
73+
docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} -t base-centos-8:${IMAGE_VERSION} ./base/centos-8
74+
7275
base-redhat-8:
7376
docker build ${DOCKER_BUILD_FLAGS} --build-arg SCLOUD_URL=${SCLOUD_URL} --label version=${SPLUNK_VERSION} -t base-redhat-8:${IMAGE_VERSION} ./base/redhat-8
7477

7578
base-windows-2016:
7679
docker build ${DOCKER_BUILD_FLAGS} -t base-windows-2016:${IMAGE_VERSION} ./base/windows-2016
7780

7881
##### Minimal images #####
79-
minimal: minimal-debian-9 minimal-debian-10 minimal-centos-7 minimal-redhat-8
82+
minimal: minimal-debian-9 minimal-debian-10 minimal-centos-7 minimal-centos-8 minimal-redhat-8
8083

8184
minimal-debian-9: base-debian-9
8285
docker build ${DOCKER_BUILD_FLAGS} \
@@ -99,6 +102,13 @@ minimal-centos-7: base-centos-7
99102
--build-arg SPLUNK_BUILD_URL=${SPLUNK_LINUX_BUILD_URL} \
100103
--target minimal -t minimal-centos-7:${IMAGE_VERSION} .
101104

105+
minimal-centos-8: base-centos-8
106+
docker build ${DOCKER_BUILD_FLAGS} \
107+
-f splunk/common-files/Dockerfile \
108+
--build-arg SPLUNK_BASE_IMAGE=base-centos-8 \
109+
--build-arg SPLUNK_BUILD_URL=${SPLUNK_LINUX_BUILD_URL} \
110+
--target minimal -t minimal-centos-8:${IMAGE_VERSION} .
111+
102112
minimal-redhat-8: base-redhat-8
103113
docker build ${DOCKER_BUILD_FLAGS} \
104114
-f splunk/common-files/Dockerfile \
@@ -107,7 +117,7 @@ minimal-redhat-8: base-redhat-8
107117
--target minimal -t minimal-redhat-8:${IMAGE_VERSION} .
108118

109119
##### Bare images #####
110-
bare: bare-debian-9 bare-debian-10 bare-centos-7 bare-redhat-8
120+
bare: bare-debian-9 bare-debian-10 bare-centos-7 bare-centos-8 bare-redhat-8
111121

112122
bare-debian-9: base-debian-9
113123
docker build ${DOCKER_BUILD_FLAGS} \
@@ -128,7 +138,14 @@ bare-centos-7: base-centos-7
128138
-f splunk/common-files/Dockerfile \
129139
--build-arg SPLUNK_BASE_IMAGE=base-centos-7 \
130140
--build-arg SPLUNK_BUILD_URL=${SPLUNK_LINUX_BUILD_URL} \
131-
--target bare -t bare-centos-7:${IMAGE_VERSION} .
141+
--target bare -t bare-centos-7:${IMAGE_VERSION} .
142+
143+
bare-centos-8: base-centos-7
144+
docker build ${DOCKER_BUILD_FLAGS} \
145+
-f splunk/common-files/Dockerfile \
146+
--build-arg SPLUNK_BASE_IMAGE=base-centos-8 \
147+
--build-arg SPLUNK_BUILD_URL=${SPLUNK_LINUX_BUILD_URL} \
148+
--target bare -t bare-centos-8:${IMAGE_VERSION} .
132149

133150
bare-redhat-8: base-redhat-8
134151
docker build ${DOCKER_BUILD_FLAGS} \
@@ -138,7 +155,7 @@ bare-redhat-8: base-redhat-8
138155
--target bare -t bare-redhat-8:${IMAGE_VERSION} .
139156

140157
##### Splunk images #####
141-
splunk: ansible splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8
158+
splunk: ansible splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-centos-8 splunk-redhat-8
142159

143160
splunk-debian-9: base-debian-9 ansible
144161
docker build ${DOCKER_BUILD_FLAGS} \
@@ -161,6 +178,13 @@ splunk-centos-7: base-centos-7 ansible
161178
--build-arg SPLUNK_BUILD_URL=${SPLUNK_LINUX_BUILD_URL} \
162179
-t splunk-centos-7:${IMAGE_VERSION} .
163180

181+
splunk-centos-8: base-centos-8 ansible
182+
docker build ${DOCKER_BUILD_FLAGS} \
183+
-f splunk/common-files/Dockerfile \
184+
--build-arg SPLUNK_BASE_IMAGE=base-centos-8 \
185+
--build-arg SPLUNK_BUILD_URL=${SPLUNK_LINUX_BUILD_URL} \
186+
-t splunk-centos-8:${IMAGE_VERSION} .
187+
164188
splunk-redhat-8: base-redhat-8 ansible
165189
docker build ${DOCKER_BUILD_FLAGS} \
166190
-f splunk/common-files/Dockerfile \
@@ -176,7 +200,7 @@ splunk-windows-2016: base-windows-2016 ansible
176200
-t splunk-windows-2016:${IMAGE_VERSION} .
177201

178202
##### UF images #####
179-
uf: ansible uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8
203+
uf: ansible uf-debian-9 uf-debian-10 uf-centos-7 uf-centos-8 uf-redhat-8
180204

181205
ufbare-debian-9: base-debian-9 ansible
182206
docker build ${DOCKER_BUILD_FLAGS} \
@@ -213,6 +237,13 @@ uf-centos-7: base-centos-7 ansible
213237
--build-arg SPLUNK_BUILD_URL=${UF_LINUX_BUILD_URL} \
214238
-t uf-centos-7:${IMAGE_VERSION} .
215239

240+
uf-centos-8: base-centos-8 ansible
241+
docker build ${DOCKER_BUILD_FLAGS} \
242+
-f uf/common-files/Dockerfile \
243+
--build-arg SPLUNK_BASE_IMAGE=base-centos-8 \
244+
--build-arg SPLUNK_BUILD_URL=${UF_LINUX_BUILD_URL} \
245+
-t uf-centos-8:${IMAGE_VERSION} .
246+
216247
uf-redhat-8: base-redhat-8 ansible
217248
docker build ${DOCKER_BUILD_FLAGS} \
218249
-f uf/common-files/Dockerfile \
@@ -229,7 +260,7 @@ uf-windows-2016: base-windows-2016 ansible
229260

230261

231262
##### Python 3 support #####
232-
splunk-py23: splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8
263+
splunk-py23: splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-centos-8 splunk-py23-redhat-8
233264

234265
splunk-py23-debian-9: splunk-debian-9
235266
docker build ${DOCKER_BUILD_FLAGS} \
@@ -249,6 +280,12 @@ splunk-py23-centos-7: splunk-centos-7
249280
--build-arg SPLUNK_PRODUCT=splunk \
250281
-t splunk-py23-centos-7:${IMAGE_VERSION} .
251282

283+
splunk-py23-centos-8: splunk-centos-8
284+
docker build ${DOCKER_BUILD_FLAGS} \
285+
-f py23-image/centos-8/Dockerfile \
286+
--build-arg SPLUNK_PRODUCT=splunk \
287+
-t splunk-py23-centos-8:${IMAGE_VERSION} .
288+
252289
splunk-py23-redhat-8: splunk-redhat-8
253290
docker build ${DOCKER_BUILD_FLAGS} \
254291
-f py23-image/redhat-8/Dockerfile \
@@ -275,6 +312,12 @@ uf-py23-centos-7: uf-centos-7
275312
--build-arg SPLUNK_PRODUCT=uf \
276313
-t uf-py23-centos-7:${IMAGE_VERSION} .
277314

315+
uf-py23-centos-8: uf-centos-8
316+
docker build ${DOCKER_BUILD_FLAGS} \
317+
-f py23-image/centos-8/Dockerfile \
318+
--build-arg SPLUNK_PRODUCT=uf \
319+
-t uf-py23-centos-8:${IMAGE_VERSION} .
320+
278321
uf-py23-redhat-8: uf-redhat-8
279322
docker build ${DOCKER_BUILD_FLAGS} \
280323
-f py23-image/redhat-8/Dockerfile \

base/centos-7/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Splunk
1+
# Copyright 2018-2020 Splunk
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

base/centos-7/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright 2018 Splunk
2+
# Copyright 2018-2020 Splunk
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

base/centos-8/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2018-2020 Splunk
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM centos:8
16+
LABEL maintainer="support@splunk.com"
17+
18+
ARG SCLOUD_URL
19+
ENV SCLOUD_URL ${SCLOUD_URL}
20+
21+
COPY install.sh /install.sh
22+
RUN /install.sh && rm -rf /install.sh

base/centos-8/install.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# Copyright 2018-2020 Splunk
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -e
17+
18+
yum -y install glibc-locale-source glibc-langpack-en
19+
20+
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
21+
export LANG=en_US.utf8
22+
23+
yum -y update && yum -y install wget sudo epel-release make
24+
yum -y install ansible python3-requests python3-jmespath
25+
26+
# Install busybox
27+
wget -O /bin/busybox https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-`arch`
28+
chmod +x /bin/busybox
29+
30+
# Install scloud
31+
wget -O /usr/bin/scloud.tar.gz ${SCLOUD_URL}
32+
tar -xf /usr/bin/scloud.tar.gz -C /usr/bin/
33+
rm /usr/bin/scloud.tar.gz
34+
35+
cd /bin
36+
ln -s busybox killall
37+
ln -s busybox netstat
38+
ln -s busybox nslookup
39+
ln -s busybox readline
40+
ln -s busybox route
41+
ln -s busybox syslogd
42+
ln -s busybox traceroute
43+
chmod u+s /bin/ping
44+
groupadd sudo
45+
46+
echo "
47+
## Allows people in group sudo to run all commands
48+
%sudo ALL=(ALL) ALL" >> /etc/sudoers
49+
50+
# symlink for python3
51+
ln -s /bin/python3 /bin/python
52+
53+
# Clean
54+
yum clean all
55+
rm -rf /install.sh /anaconda-post.log /var/log/anaconda/*

py23-image/centos-8/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ARG SPLUNK_PRODUCT=splunk
2+
FROM ${SPLUNK_PRODUCT}-centos-8:latest
3+
USER root
4+
5+
RUN yum -y update
6+
RUN yum -y install gcc openssl-devel bzip2-devel libffi-devel python3-pip python2 python2-pip
7+
8+
# manual installation of python 3.7 as default distro version is 3.6
9+
RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \
10+
&& tar xzf Python-3.7.4.tgz \
11+
&& cd Python-3.7.4 \
12+
&& ./configure --enable-optimizations --prefix=/usr \
13+
&& make install \
14+
&& cd .. \
15+
&& rm Python-3.7.4.tgz \
16+
&& rm -r Python-3.7.4 \
17+
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
18+
&& python3.7 get-pip.py \
19+
&& rm -f get-pip.py \
20+
# pip version is not automatically "fixed", unlike debian-based
21+
&& ln -sf /usr/bin/pip2 /usr/bin/pip \
22+
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip3
23+
# add python alias
24+
# && ln -s /bin/python3 /bin/python
25+
26+
RUN yum remove -y --setopt=tsflags=noscripts gcc openssl-devel bzip2-devel libffi-devel \
27+
&& yum autoremove -y \
28+
&& yum clean all
29+
RUN pip3 --no-cache-dir install ansible requests

splunk/common-files/createdefaults.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/python
2-
# Copyright 2018 Splunk
2+
# Copyright 2018-2020 Splunk
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
import os
16+
import six
1617
import sys
1718
import uuid
1819
import random
@@ -32,10 +33,14 @@
3233
def random_generator(size=24):
3334
# Use System Random for
3435
rng = random.SystemRandom()
35-
bytes = [chr(rng.randrange(256)) for i in range(size)]
36-
s = ''.join(bytes)
36+
b = [chr(rng.randrange(256)) for i in range(size)]
37+
s = ''.join(b)
38+
if six.PY2:
39+
s = base64.b64encode(s)
40+
else:
41+
s = base64.b64encode(s.encode()).decode()
42+
return s
3743

38-
return base64.b64encode(s)
3944

4045
# if there are no environment vars set, lets make some safe defaults
4146
if not splunk_hec_token:

uf/common-files/createdefaults.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/python
2-
# Copyright 2018 Splunk
2+
# Copyright 2018-2020 Splunk
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
import os
16+
import six
1617
import sys
1718
import uuid
1819
import random
@@ -25,26 +26,40 @@
2526
splunk_hec_token = os.environ.get("SPLUNK_HEC_TOKEN", None)
2627
splunk_password = os.environ.get("SPLUNK_PASSWORD", None)
2728
splunk_idxc_secret = os.environ.get("SPLUNK_IDXC_SECRET", None)
29+
splunk_idxc_pass4SymmKey = os.environ.get("SPLUNK_IDXC_PASS4SYMMKEY", None)
2830
splunk_shc_secret = os.environ.get("SPLUNK_SHC_SECRET", None)
31+
splunk_shc_pass4SymmKey = os.environ.get("SPLUNK_SHC_PASS4SYMMKEY", None)
2932

3033
def random_generator(size=24):
3134
# Use System Random for
3235
rng = random.SystemRandom()
33-
bytes = [chr(rng.randrange(256)) for i in range(size)]
34-
s = ''.join(bytes)
36+
b = [chr(rng.randrange(256)) for i in range(size)]
37+
s = ''.join(b)
38+
if six.PY2:
39+
s = base64.b64encode(s)
40+
else:
41+
s = base64.b64encode(s.encode()).decode()
42+
return s
3543

36-
return base64.b64encode(s)
3744

3845
# if there are no environment vars set, lets make some safe defaults
3946
if not splunk_hec_token:
4047
tempuuid=uuid.uuid4()
4148
os.environ["SPLUNK_HEC_TOKEN"] = str(tempuuid)
4249
if not splunk_password:
4350
os.environ["SPLUNK_PASSWORD"] = random_generator()
44-
if not splunk_idxc_secret:
45-
os.environ["SPLUNK_IDXC_SECRET"] = random_generator()
46-
if not splunk_shc_secret:
47-
os.environ["SPLUNK_SHC_SECRET"] = random_generator()
51+
if splunk_idxc_pass4SymmKey:
52+
os.environ["SPLUNK_IDXC_PASS4SYMMKEY"] = os.environ["SPLUNK_IDXC_SECRET"] = splunk_idxc_pass4SymmKey
53+
elif splunk_idxc_secret:
54+
os.environ["SPLUNK_IDXC_PASS4SYMMKEY"] = os.environ["SPLUNK_IDXC_SECRET"] = splunk_idxc_secret
55+
else:
56+
os.environ["SPLUNK_IDXC_PASS4SYMMKEY"] = os.environ["SPLUNK_IDXC_SECRET"] = random_generator()
57+
if splunk_shc_secret:
58+
os.environ["SPLUNK_SHC_PASS4SYMMKEY"] = os.environ["SPLUNK_SHC_SECRET"] = splunk_shc_pass4SymmKey
59+
elif splunk_shc_pass4SymmKey:
60+
os.environ["SPLUNK_SHC_PASS4SYMMKEY"] = os.environ["SPLUNK_SHC_SECRET"] = splunk_shc_secret
61+
else:
62+
os.environ["SPLUNK_SHC_PASS4SYMMKEY"] = os.environ["SPLUNK_SHC_SECRET"] = random_generator()
4863
sys.argv.append("--write-to-stdout")
4964
import environ
5065
environ.main()

0 commit comments

Comments
 (0)