Issue#36: .deb deploys default TLS certificate and private key (#39)
* issue#36: Generating TLS key and self-signed cert after installing/upgrading the package * issue#36: Updated libstdc++.a dependency to v10 * issue#36: Generate self-signed certs after install/upgrade * issue#36: Updated dependencies * issue#36: Check for pre-existence of key/cert
This commit is contained in:
+15
-2
@@ -1,6 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
ETC='/opt/key-networks/ztncui/etc'
|
||||
echo "Copying default password file..."
|
||||
cp -pv $ETC/default.passwd $ETC/passwd
|
||||
if [ -f ${ETC}/passwd ]; then
|
||||
echo "Password file aready exists"
|
||||
else
|
||||
echo "Copying default password file..."
|
||||
cp -pv ${ETC}/default.passwd ${ETC}/passwd
|
||||
fi
|
||||
if [ -f /opt/key-networks/ztncui/etc/tls/privkey.pem ] && [ -f /opt/key-networks/ztncui/etc/tls/fullchain.pem ]; then
|
||||
echo "TLS key and certificate already exist"
|
||||
else
|
||||
echo "Generating new TLS key and self-signed certificate..."
|
||||
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout /opt/key-networks/ztncui/etc/tls/privkey.pem -out /opt/key-networks/ztncui/etc/tls/fullchain.pem -subj "/C=XX/ST=YY/L=ZZ/O=Security/OU=SelfSigned/CN=example.com"
|
||||
fi
|
||||
chown ztncui.ztncui /opt/key-networks/ztncui/etc/tls/*
|
||||
echo "Enabling and starting ztncui service..."
|
||||
systemctl enable ztncui
|
||||
systemctl start ztncui
|
||||
|
||||
Reference in New Issue
Block a user