mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
backend: user domain vesta ssl certificate support
This commit is contained in:
parent
f456afec60
commit
8edf965375
8 changed files with 307 additions and 20 deletions
75
bin/v-delete-sys-mail-ssl
Executable file
75
bin/v-delete-sys-mail-ssl
Executable file
|
@ -0,0 +1,75 @@
|
|||
#!/bin/bash
|
||||
# info: delete sys vesta user ssl certificate
|
||||
# options: NONE
|
||||
#
|
||||
# The script disables user domain ssl synchronization
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable & Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/conf/vesta.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
vst_crt="$VESTA/ssl/certificate.crt"
|
||||
vst_key="$VESTA/ssl/certificate.key"
|
||||
|
||||
# Updating mail certificate
|
||||
case $MAIL_SYSTEM in
|
||||
exim) conf='/etc/exim/exim.conf';;
|
||||
exim4) conf='/etc/exim4/exim4.conf.template';;
|
||||
esac
|
||||
if [ -e "$conf" ]; then
|
||||
sed -e "s|^tls_certificate.*|tls_certificate = $vst_crt|" \
|
||||
-e "s|^tls_privatekey.*|tls_privatekey = $vst_key|" -i $conf
|
||||
fi
|
||||
|
||||
# Updating imap certificate
|
||||
conf="/etc/dovecot/conf.d/10-ssl.conf"
|
||||
if [ ! -z "$IMAP_SYSTEM" ] && [ -e "$conf" ]; then
|
||||
sed -e "s|ssl_cert.*|ssl_cert = <$vst_crt|" \
|
||||
-e "s|ssl_key.*|ssl_key = <$vst_key|" -i $conf
|
||||
fi
|
||||
|
||||
# Moving old certificates
|
||||
if [ -e "$VESTA/ssl/mail.crt" ]; then
|
||||
mv -f $VESTA/ssl/mail.crt $VESTA/ssl/mail.crt.old
|
||||
fi
|
||||
if [ -e "VESTA/ssl/mail.key" ]; then
|
||||
mv $VESTA/ssl/mail.key VESTA/ssl/mail.key.old
|
||||
fi
|
||||
|
||||
# Updating vesta.conf value
|
||||
sed -i "/MAIL_CERTIFICATE=/ d" $VESTA/conf/vesta.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Restarting services
|
||||
if [ "$restart" != 'no' ]; then
|
||||
if [ ! -z "$MAIL_SYSTEM" ]; then
|
||||
$BIN/v-restart-service $MAIL_SYSTEM
|
||||
fi
|
||||
if [ ! -z "$IMAP_SYSTEM" ]; then
|
||||
$BIN/v-restart-service $IMAP_SYSTEM
|
||||
fi
|
||||
fi
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$ARGUMENTS"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue