mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 06:14:07 +02:00
Update and rename 30-keygen to 29-ssl_config
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
#Check if files exist
|
||||
if bashio::config.true 'use_own_certs'; then
|
||||
bashio::log.info "Using referenced ssl certificates..."
|
||||
CERTFILE=$(bashio::config 'certfile')
|
||||
KEYFILE=$(bashio::config 'keyfile')
|
||||
|
||||
#Check if files exist
|
||||
[ ! -f /ssl/$CERTFILE ] && bashio::log.fatal "... Certificate /ssl/$CERTFILE not found" && exit 1
|
||||
[ ! -f /ssl/$KEYFILE ] && bashio::log.fatal "... Certificate /ssl/$KEYFILE not found" && exit 1
|
||||
|
||||
#Sets certificates
|
||||
LINE=$(sed -n '/cert.crt/=' /defaults/default)
|
||||
sed -i "$LINE a ssl_certificate ${CERTFILE};" /defaults/default
|
||||
sed -i "$LINE d" /defaults/default
|
||||
|
||||
LINE=$(sed -n '/cert.key/=' /defaults/default)
|
||||
sed -i "$LINE a ssl_certificate_key ${CERTFILE};" /defaults/default
|
||||
sed -i "$LINE d" /defaults/default
|
||||
|
||||
bashio::log.info "... done"
|
||||
|
||||
else
|
||||
bashio::log.info "No ssl certificates set. Auto generating ones."
|
||||
SUBJECT="/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*"
|
||||
if [[ -f /ssl/nextcloud/keys/cert.key && -f /ssl/nextcloud/keys/cert.crt ]]; then
|
||||
bashio::log.info "using keys found in /ssl/nextcloud/keys"
|
||||
else
|
||||
bashio::log.info "generating self-signed keys in /ssl/nextcloud/keys, you can replace these with your own keys if required"
|
||||
openssl req -new -x509 -days 3650 -nodes -out /ssl/nextcloud/keys/cert.crt -keyout /ssl/nextcloud/keys/cert.key -subj "$SUBJECT"
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user