Created
October 17, 2019 21:42
-
-
Save danie1k/333c2bb5fab9de80d65af967dae57ed6 to your computer and use it in GitHub Desktop.
Update QNAP SSL Certificate via CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -e | |
# Based on https://www.hozed.net/?p=538 | |
SSH_STRING="" | |
SSH_PORT="22" | |
# FYI: Assuming, that cert files are present and named: cert.key & cert.cert | |
scp -P $SSH_PORT cert.key $SSH_STRING:/etc/stunnel/backup.key &>/dev/null | |
wait | |
scp -P $SSH_PORT cert.cert $SSH_STRING:/etc/stunnel/backup.cert &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT 'cat /etc/stunnel/backup.key > /etc/stunnel/stunnel.pem' &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT 'cat /etc/stunnel/backup.cert >> /etc/stunnel/stunnel.pem' &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT 'chmod 600 /etc/stunnel/backup.cert' &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT 'chmod 600 /etc/stunnel/backup.cert' &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT 'chmod 600 /etc/stunnel/stunnel.pem' &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT '/etc/init.d/stunnel.sh stop' &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT '/etc/init.d/stunnel.sh reload' &>/dev/null | |
wait | |
ssh $SSH_STRING -p $SSH_PORT '/etc/init.d/stunnel.sh start' &>/dev/null | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment