Support Custom Certs

This commit is contained in:
Stefan Schallenberg
2020-03-15 14:36:36 +01:00
parent 6c7369cc8b
commit 570d3fc8a4
3 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -40,6 +40,6 @@ COPY entrypoint.sh /entrypoint.sh
WORKDIR /opt/tplink/EAPController
EXPOSE 8088 8043 27001/udp 27002 29810/udp 29811 29812 29813
HEALTHCHECK --start-period=5m CMD wget --quiet --tries=1 --no-check-certificate -O /dev/null --server-response --timeout=5 https://127.0.0.1:8043/login || exit 1
VOLUME ["/opt/tplink/EAPController/data","/opt/tplink/EAPController/work","/opt/tplink/EAPController/logs"]
VOLUME ["/opt/tplink/EAPController/data","/opt/tplink/EAPController/work","/opt/tplink/EAPController/logs","/cert"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/opt/tplink/EAPController/jre/bin/java","-server","-Xms128m","-Xmx1024m","-XX:MaxHeapFreeRatio=60","-XX:MinHeapFreeRatio=30","-XX:+HeapDumpOnOutOfMemoryError","-XX:-UsePerfData","-Deap.home=/opt/tplink/EAPController","-cp","/opt/tplink/EAPController/lib/*:","com.tp_link.eap.start.EapLinuxMain"]
+3
View File
@@ -83,3 +83,6 @@ If you utilize bind mounts instead of Docker named volumes (e.g. - `-v /path/to/
chown -R 508:508 /data/omada/data /data/omada/work /data/omada/logs
```
## Custom Certificates
By default, Omada software uses self-signed certificates. If however you want to use custom certificates you can mount them in /cert/tls.key and /cert/tls.crt. This is compatible with kubernetes TLS secrets. Entrypoint script will convert them into Java Keystore used by jetty inside the Omada SW.
+24
View File
@@ -42,5 +42,29 @@ then
echo "done"
fi
set -x ###############
# Import a cert from a possibly mounted kubernetes secret at /cert
if [ -f /cert/tls.key ] && [ -f /cert/tls.crt ]
then
echo "INFO: Importing Cert from /cert/tls.[key|crt]"
#./certbot-auto certonly --standalone --preferred-challenges http -d mydomain.net
openssl pkcs12 -export \
-inkey /cert/tls.key \
-in /cert/tls.crt \
-certfile /cert/tls.crt \
-name eap \
-out /opt/tplink/EAPController/keystore/cert.p12 \
-passout pass:tplink
#delete the existing keystore
rm /opt/tplink/EAPController/keystore/eap.keystore
/opt/tplink/EAPController/jre/bin/keytool -importkeystore \
-deststorepass tplink \
-destkeystore /opt/tplink/EAPController/keystore/eap.keystore \
-srckeystore /opt/tplink/EAPController/keystore/cert.p12 \
-srcstoretype PKCS12 \
-srcstorepass tplink
fi
echo "INFO: Starting Omada Controller as user omada"
exec gosu omada "${@}"