mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-01-08 20:13:01 -08:00
58 lines
1.3 KiB
Bash
Executable File
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
|