vesta/bin/v_del_ssl_certificate
2011-06-14 00:22:25 +03:00

58 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: adding ssl certificate
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user="$1"
cert="$2"
# Importing variables
source $VESTA/conf/vars.conf
source $V_FUNC/shared_func.sh
source $V_FUNC/cert_func.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user certificate'
# Checking argument format
format_validation 'user' 'certificate'
# Checking user
is_user_valid
# Checking user is active
is_user_suspended
# Checking ssl ceritificate
is_cert_valid "$V_USERS/$user/cert"
# Checking certificate
is_cert_used
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Deleting certificate
rm -f $V_USERS/$user/cert/$cert.*
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_history "$V_EVENT"
log_event 'system' "$V_EVENT"
exit $OK