mirror of
https://github.com/myvesta/vesta
synced 2025-07-15 01:23:23 -07:00
replaced underscore with dash in api syscalls
This commit is contained in:
parent
7ed705cee7
commit
b6b7eacadb
283 changed files with 438 additions and 412 deletions
81
bin/v-list-web-domain-ssl
Executable file
81
bin/v-list-web-domain-ssl
Executable file
|
@ -0,0 +1,81 @@
|
|||
#!/bin/bash
|
||||
# info: list web domain ssl certificate
|
||||
# options: user domain [format]
|
||||
#
|
||||
# The function of obtaining domain ssl files.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
domain=$2
|
||||
format=${3-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_ssl() {
|
||||
i='1' # iterator
|
||||
echo '{'
|
||||
echo -e "\t\"$domain\": {"
|
||||
echo " \"CRT\": \"$crt\","
|
||||
echo " \"KEY\": \"$key\","
|
||||
echo " \"CA\": \"$ca\""
|
||||
echo -e "\t}\n}"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_ssl() {
|
||||
if [ ! -z "$crt" ]; then
|
||||
echo -e "$crt"
|
||||
fi
|
||||
if [ ! -z "$key" ]; then
|
||||
echo -e "\n$key"
|
||||
fi
|
||||
if [ ! -z "$ca" ]; then
|
||||
echo -e "\n$ca"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '2' "$#" 'user domain [format]'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
if [ -e "$USER_DATA/ssl/$domain.crt" ]; then
|
||||
crt=$(cat $USER_DATA/ssl/$domain.crt |sed -e ':a;N;$!ba;s/\n/\\n/g' )
|
||||
fi
|
||||
|
||||
if [ -e "$USER_DATA/ssl/$domain.key" ]; then
|
||||
key=$(cat $USER_DATA/ssl/$domain.key |sed -e ':a;N;$!ba;s/\n/\\n/g' )
|
||||
fi
|
||||
|
||||
if [ -e "$USER_DATA/ssl/$domain.ca" ]; then
|
||||
ca=$(cat $USER_DATA/ssl/$domain.ca |sed -e ':a;N;$!ba;s/\n/\\n/g' )
|
||||
fi
|
||||
|
||||
# Listing domains
|
||||
case $format in
|
||||
json) json_list_ssl ;;
|
||||
plain) nohead=1; shell_list_ssl ;;
|
||||
shell) shell_list_ssl ;;
|
||||
*) check_args '1' '0' '[format]'
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue