|
@@ -1,65 +0,0 @@
|
|
|
-#!/bin/bash
|
|
|
|
|
-# info: rebuild system user
|
|
|
|
|
-# options: USER [RESTART]
|
|
|
|
|
-#
|
|
|
|
|
-# The function rebuilds mail domain SSL configuration
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-# Variable&Function #
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-
|
|
|
|
|
-# Argument definition
|
|
|
|
|
-user=$1
|
|
|
|
|
-domain=$2
|
|
|
|
|
-restart=$3
|
|
|
|
|
-
|
|
|
|
|
-# Includes
|
|
|
|
|
-source $HESTIA/func/main.sh
|
|
|
|
|
-source $HESTIA/func/rebuild.sh
|
|
|
|
|
-source $HESTIA/conf/hestia.conf
|
|
|
|
|
-
|
|
|
|
|
-# Export sbin
|
|
|
|
|
-export PATH=$PATH:/usr/sbin
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-# Verifications #
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-
|
|
|
|
|
-check_args '2' "$#" 'USER DOMAIN [RESTART]'
|
|
|
|
|
-is_format_valid 'user' 'domain'
|
|
|
|
|
-is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
|
|
|
|
|
-is_object_valid 'user' 'USER' "$user"
|
|
|
|
|
-is_object_unsuspended 'user' 'USER' "$user"
|
|
|
|
|
-is_object_valid 'mail' 'DOMAIN' "$domain"
|
|
|
|
|
-is_object_unsuspended 'mail' 'DOMAIN' "$domain"
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-# Action #
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-
|
|
|
|
|
-# Rebuild SSL configuration
|
|
|
|
|
-del_mail_ssl_config
|
|
|
|
|
-add_mail_ssl_config
|
|
|
|
|
-
|
|
|
|
|
-# Increase value for domain
|
|
|
|
|
-increase_user_value "$user" '$U_MAIL_SSL'
|
|
|
|
|
-
|
|
|
|
|
-# Set SSL as enabled in configuration
|
|
|
|
|
-update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "yes"
|
|
|
|
|
-
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-# Hestia #
|
|
|
|
|
-#----------------------------------------------------------#
|
|
|
|
|
-
|
|
|
|
|
-# Restarting mail server
|
|
|
|
|
-$BIN/v-restart-mail $restart
|
|
|
|
|
-$BIN/v-restart-service $IMAP_SYSTEM $restart
|
|
|
|
|
-check_result $? "Mail restart failed" >/dev/null
|
|
|
|
|
-
|
|
|
|
|
-# Logging
|
|
|
|
|
-log_event "$OK" "$ARGUMENTS"
|
|
|
|
|
-
|
|
|
|
|
-exit
|
|
|