|
|
|
@ -3,9 +3,9 @@ |
|
|
|
# Simple script to deploy certificates for Weechat relay servers |
|
|
|
# |
|
|
|
# Configuration: |
|
|
|
# export WEECHAT_PEM (or set in access.conf) to the PEM file you have your weechat client |
|
|
|
# export DEPLOY_WEECHAT_PEM (or set in access.conf) to the PEM file you have your weechat client |
|
|
|
# set to load. |
|
|
|
# Optionally configure WEECHAT_HOME if you would like to attempt to reload the certificate |
|
|
|
# Optionally configure DEPLOY_WEECHAT_HOME if you would like to attempt to reload the certificate |
|
|
|
# on a successful deploy. |
|
|
|
# This deploy script attempts to guess sane defaults in the absence of either |
|
|
|
|
|
|
|
@ -33,28 +33,28 @@ weechat_deploy() { |
|
|
|
_debug _cfullchain "$_cfullchain" |
|
|
|
|
|
|
|
_info "Deploying $_cdomain to weechat" |
|
|
|
if [ -z "$WEECHAT_HOME" ]; then |
|
|
|
_info "WEECHAT_HOME not set, defaulting to ${HOME}/.weechat" |
|
|
|
WEECHAT_HOME="${HOME}/.weechat" |
|
|
|
if [ -z "$DEPLOY_WEECHAT_HOME" ]; then |
|
|
|
_info "DEPLOY_WEECHAT_HOME not set, defaulting to ${HOME}/.weechat" |
|
|
|
DEPLOY_WEECHAT_HOME="${HOME}/.weechat" |
|
|
|
fi |
|
|
|
if [ -z "$WEECHAT_PEM" ]; then |
|
|
|
_info "WEECHAT_PEM not set, defaulting to ${HOME}/.weechat/ssl/relay.pem" |
|
|
|
WEECHAT_PEM="${HOME}/.weechat/ssl/relay.pem" |
|
|
|
if [ -z "$DEPLOY_WEECHAT_PEM" ]; then |
|
|
|
_info "DEPLOY_WEECHAT_PEM not set, defaulting to ${HOME}/.weechat/ssl/relay.pem" |
|
|
|
DEPLOY_WEECHAT_PEM="${HOME}/.weechat/ssl/relay.pem" |
|
|
|
fi |
|
|
|
if [ -w "$WEECHAT_PEM" ]; then |
|
|
|
_info "$WEECHAT_PEM exists and is writable, backing up and overwriting" |
|
|
|
cp "$WEECHAT_PEM" "$WEECHAT_PEM.bak" |
|
|
|
cat "$_ckey" "$_cfullchain" >"$WEECHAT_PEM" |
|
|
|
if [ -w "$DEPLOY_WEECHAT_PEM" ]; then |
|
|
|
_info "$DEPLOY_WEECHAT_PEM exists and is writable, backing up and overwriting" |
|
|
|
cp "$DEPLOY_WEECHAT_PEM" "$WEECHAT_PEM.bak" |
|
|
|
cat "$_ckey" "$_cfullchain" >"$DEPLOY_WEECHAT_PEM" |
|
|
|
_info "Deployed $_cdomain to weechat" |
|
|
|
_debug "Attempting to issue /relay sslcertky to weechat via fifo" |
|
|
|
for fifo in $WEECHAT_HOME/weechat_fifo_*; do |
|
|
|
for fifo in $DEPLOY_WEECHAT_HOME/weechat_fifo_*; do |
|
|
|
_info "Issuing reload to weechat via $fifo" |
|
|
|
printf '%b' '*/relay sslcertkey\n' >"$fifo" |
|
|
|
done |
|
|
|
exit 0 |
|
|
|
else |
|
|
|
_err "$WEECHAT_PEM does not exist or is not writable. If this is a first run \ |
|
|
|
please issue \'touch $WEECHAT_PEM\' and retry." |
|
|
|
_err "$DEPLOY_WEECHAT_PEM does not exist or is not writable. If this is a first run \ |
|
|
|
please issue \'touch $DEPLOY_WEECHAT_PEM\' and retry." |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
} |