Skip to content

Commit c23d5b4

Browse files
committed
Add certificate creation scripts
1 parent c336b47 commit c23d5b4

File tree

6 files changed

+70
-0
lines changed

6 files changed

+70
-0
lines changed

test/bkp_default.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,12 @@ splunk:
2727
useLocalAuth: false
2828
auditLogsLookupBackTime: -2h
2929
timewait: 30
30+
- key: server
31+
value:
32+
directory: /opt/splunk/etc/system/local/
33+
content:
34+
sslConfig:
35+
enableSplunkdSSL: true
36+
serverCert: /cert_dir/splunk_sh.pem
37+
sslRootCAPath: /cert_dir/ca.crt
38+
sslPassword: password

test/certificates/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM alpine:latest
2+
3+
RUN apk update && \
4+
apk add --no-cache openssl bash && \
5+
rm -rf "/var/cache/apk/*"
6+
7+
COPY createca.sh createcerts.sh entrypoint.sh /scripts/
8+
9+
ENTRYPOINT [ "bash", "/scripts/entrypoint.sh" ]

test/certificates/createcerts.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ mkdir -p $dir/certs
6060
[ ! -f $dir/index.txt ] && touch $dir/index.txt
6161
# SIGN Request
6262
openssl ca \
63+
-batch \
6364
-in ${CSR} \
6465
-out ${CERT} \
6566
-extensions ${CRT_TYPE} \

test/certificates/entrypoint.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
set -e
3+
echo "Starting Certificate Creation"
4+
mkdir -p /cert_dir
5+
cd /cert_dir
6+
sh /scripts/createca.sh
7+
while read -r line; do
8+
# Get the string before = (the var name)
9+
name="${line%=*}"
10+
eval value="\$$name"
11+
if [[ $name = 'CERTIFICATE'* ]]
12+
then
13+
echo "name: ${name}, value: ${value}"
14+
bash /scripts/createcerts.sh ${value}
15+
fi
16+
done <<EOF
17+
$(env)
18+
EOF
19+
20+
21+
echo $(env)

test/docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ networks:
55
attachable: true
66

77
services:
8+
certificates:
9+
build: certificates
10+
hostname: certificates
11+
container_name: certificates
12+
volumes:
13+
- cert_dir:/cert_dir
14+
environment:
15+
CERTIFICATE_0: "splunk_moc 127.0.0.1 server_cert"
16+
CERTIFICATE_1: "splunk_sh 127.0.0.1 server_cert"
17+
818
splunk_sh:
919
networks:
1020
splunknet:
@@ -27,7 +37,11 @@ services:
2737
- ../metadata:/opt/splunk/etc/apps/SplunkVersionControl/metadata
2838
- ../README:/opt/splunk/etc/apps/SplunkVersionControl/README
2939
- ../static:/opt/splunk/etc/apps/SplunkVersionControl/static
40+
- ../lookups/splunkversioncontrol_globalexclusionlist.csv:/opt/splunk/etc/apps/SplunkVersionControl/lookups/splunkversioncontrol_globalexclusionlist.csv
3041
- ../test/sh_default.yml:/tmp/defaults/default.yml
42+
- cert_dir:/cert_dir
43+
depends_on:
44+
- certificates
3145

3246
splunk_moc:
3347
networks:
@@ -57,5 +71,12 @@ services:
5771
- ../metadata:/opt/splunk/etc/apps/SplunkVersionControl/metadata
5872
- ../README:/opt/splunk/etc/apps/SplunkVersionControl/README
5973
- ../static:/opt/splunk/etc/apps/SplunkVersionControl/static
74+
- ../lookups/splunkversioncontrol_globalexclusionlist.csv:/opt/splunk/etc/apps/SplunkVersionControl/lookups/splunkversioncontrol_globalexclusionlist.csv
6075
- ../test/bkp_default.yml:/tmp/defaults/default.yml
6176
- ../test/custom_init.sh:/usr/sbin/custom_init.sh
77+
- cert_dir:/cert_dir
78+
depends_on:
79+
- certificates
80+
81+
volumes:
82+
cert_dir: {}

test/sh_default.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ splunk:
1212
sslVerify:
1313
definiton: false
1414
# definition: /opt/splunk/etc/apps/SplunkVersionControl/auth/ca.pem
15+
- key: server
16+
value:
17+
directory: /opt/splunk/etc/system/local/
18+
content:
19+
sslConfig:
20+
enableSplunkdSSL: true
21+
serverCert: /cert_dir/splunk_sh.pem
22+
sslRootCAPath: /cert_dir/ca.crt
23+
sslPassword: password

0 commit comments

Comments
 (0)