added default ssl cert

This commit is contained in:
ElevenNotes
2023-09-21 17:08:55 +02:00
parent 03b3cd2a1d
commit 245634ccc8
4 changed files with 19 additions and 6 deletions

View File

@@ -10,15 +10,16 @@
apk --no-cache add \ apk --no-cache add \
curl \ curl \
tzdata \ tzdata \
shadow; \ shadow \
apk --no-cache upgrade; \ openssl; \
apk cache clear; apk --no-cache upgrade;
# :: prepare image # :: prepare image
RUN set -ex; \ RUN set -ex; \
mkdir -p ${APP_ROOT}; \ mkdir -p ${APP_ROOT}; \
mkdir -p ${APP_ROOT}/etc; \ mkdir -p ${APP_ROOT}/etc; \
mkdir -p ${APP_ROOT}/var; \ mkdir -p ${APP_ROOT}/var; \
mkdir -p ${APP_ROOT}/ssl; \
rm -f /etc/defaults/influxdb2/config.yml; \ rm -f /etc/defaults/influxdb2/config.yml; \
ln -s ${APP_ROOT}/etc/config.yml /etc/defaults/influxdb2/config.yml; \ ln -s ${APP_ROOT}/etc/config.yml /etc/defaults/influxdb2/config.yml; \
mv /entrypoint.sh /usr/local/bin; mv /entrypoint.sh /usr/local/bin;
@@ -47,4 +48,4 @@
# :: Start # :: Start
USER docker USER docker
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/entrypoint.custom.sh"]

View File

@@ -1,3 +1,4 @@
bolt-path: /influxdb/var/influxd.bolt bolt-path: /influxdb/var/influxd.bolt
engine-path: /influxdb/var/engine engine-path: /influxdb/var/engine
nats-port: 4222 tls-cert: "/influxdb/ssl/cert.pem"
tls-key: "/influxdb/ssl/key.pem"

View File

@@ -0,0 +1,11 @@
#!/bin/ash
if [ ! -f "${APP_ROOT}/ssl/cert.pem" ]; then
openssl req -x509 -newkey rsa:4096 -subj "/C=XX/ST=XX/L=XX/O=XX/OU=XX/CN=XX" \
-keyout "${APP_ROOT}/ssl/key.pem" \
-out "${APP_ROOT}/ssl/cert.pem" \
-days 3650 -nodes -sha256 &> /dev/null
fi
sed -i s#INFLUXD_TLS_CERT='' INFLUXD_TLS_KEY=''## /usr/local/bin/entrypoint.sh
/usr/local/bin/entrypoint.sh

View File

@@ -1,2 +1,2 @@
#!/bin/ash #!/bin/ash
curl --max-time 5 -kILs --fail http://localhost:8086/ping curl --max-time 5 -kILs --fail https://localhost:8086/ping