mirror of
https://github.com/myvesta/vesta
synced 2025-07-13 00:23:35 -07:00
export from svn
This commit is contained in:
commit
641ed97fdd
340 changed files with 32404 additions and 0 deletions
90
bin/v_add_db_base
Executable file
90
bin/v_add_db_base
Executable file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding data base
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
database="$user"_"$2"
|
||||||
|
db_user="$user"_"$3"
|
||||||
|
db_password="$4"
|
||||||
|
type="$5"
|
||||||
|
host=$6
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '5' "$#" 'user db db_user db_password type [host]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'database' 'db_user' 'db_password'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking db type
|
||||||
|
is_type_valid 'db' "$type"
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking db existance
|
||||||
|
is_db_new
|
||||||
|
|
||||||
|
# Checking db host
|
||||||
|
if [ -z "$host" ]; then
|
||||||
|
host=$(get_next_db_host)
|
||||||
|
fi
|
||||||
|
is_db_host_valid
|
||||||
|
|
||||||
|
# Checking package
|
||||||
|
is_package_full 'db_base'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Switching on db type
|
||||||
|
case $type in
|
||||||
|
mysql) create_db_mysql ;;
|
||||||
|
pgsql) create_db_pgsql ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Increasing db value
|
||||||
|
increase_db_value
|
||||||
|
|
||||||
|
# Increasing domain value
|
||||||
|
increase_user_value "$user" '$U_DATABASES'
|
||||||
|
|
||||||
|
# Adding db to db conf
|
||||||
|
v_str="DB='$database' USER='$db_user' HOST='$host' TYPE='$type'"
|
||||||
|
v_str="$v_str U_DISK='0' SUSPEND='no' DATE='$V_DATE'"
|
||||||
|
echo "$v_str">>$V_USERS/$user/db.conf
|
||||||
|
|
||||||
|
# Hiding password
|
||||||
|
V_EVENT=$(echo $V_EVENT | sed -e "s/$db_password/xxxxxx/g")
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_db_base $user $database"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
83
bin/v_add_db_host
Executable file
83
bin/v_add_db_host
Executable file
|
@ -0,0 +1,83 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding data base server
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
type="$1"
|
||||||
|
host="$2"
|
||||||
|
port="$3"
|
||||||
|
db_user="$4"
|
||||||
|
db_password="$5"
|
||||||
|
max_usr="${6-300}"
|
||||||
|
max_db="${7-300}"
|
||||||
|
template="${8-template1}"
|
||||||
|
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
args_usage='type host port db_user db_password [max_usr] [max_db] [tpl]'
|
||||||
|
check_args '5' "$#" "$args_usage"
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'host' 'port' 'db_user' 'db_password' 'max_usr' 'max_db'
|
||||||
|
format_validation 'template'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking db type
|
||||||
|
is_type_valid 'db' "$type"
|
||||||
|
|
||||||
|
# Checking host existance
|
||||||
|
is_db_host_new
|
||||||
|
|
||||||
|
# Checking host connection
|
||||||
|
case $type in
|
||||||
|
mysql) is_mysql_host_alive ;;
|
||||||
|
pgsql) is_pgsql_host_alive ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Concatentating db host string
|
||||||
|
case $type in
|
||||||
|
mysql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'";
|
||||||
|
new_str="$new_str PORT='$port' MAX_USERS='$max_usr'";
|
||||||
|
new_str="$new_str MAX_DB='$max_db' U_SYS_USERS=''";
|
||||||
|
new_str="$new_str U_DB_BASES='0' ACTIVE='yes' DATE='$V_DATE'";;
|
||||||
|
pgsql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'";
|
||||||
|
new_str="$new_str PORT='$port' TPL='$tpl'";
|
||||||
|
new_str="$new_str MAX_USERS='$max_usr' MAX_DB='$max_db'";
|
||||||
|
new_str="$new_str U_SYS_USERS=''";
|
||||||
|
new_str="$new_str U_DB_BASES='0' ACTIVE='yes' DATE='$V_DATE'";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Adding host to conf
|
||||||
|
echo "$new_str" >> $V_DB/$type.conf
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Hidding db pass
|
||||||
|
V_EVENT=$(echo $V_EVENT | sed -e "s/$db_password/xxxxxx/g")
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
109
bin/v_add_dns_domain
Executable file
109
bin/v_add_dns_domain
Executable file
|
@ -0,0 +1,109 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding dns domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
ip="$3"
|
||||||
|
template="${4-default}"
|
||||||
|
next_year=$(date +%d-%m-%y -d "+ 1 year")
|
||||||
|
exp="${5-$next_year}"
|
||||||
|
soa="$6"
|
||||||
|
ttl="${7-14400}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain ip [template] [exp] [soa] [ttl]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'ip' 'template' 'exp' 'ttl'
|
||||||
|
|
||||||
|
# Checking dns system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain
|
||||||
|
is_domain_new 'quiet'
|
||||||
|
if [ $? -ne $OK ]; then
|
||||||
|
|
||||||
|
# Checking domain owner
|
||||||
|
is_domain_owner
|
||||||
|
|
||||||
|
# Checking domain service
|
||||||
|
is_dns_domain_free
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking package
|
||||||
|
is_package_full 'dns'
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
is_template_valid 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining variables
|
||||||
|
ns1=$(get_user_value '$NS1')
|
||||||
|
ns2=$(get_user_value '$NS2')
|
||||||
|
if [ -z "$soa" ]; then
|
||||||
|
soa="$ns1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding zone to zones dir
|
||||||
|
cat $V_DNSTPL/$template.tpl |\
|
||||||
|
sed -e "s/%ip%/$ip/g" \
|
||||||
|
-e "s/%domain_idn%/$domain_idn/g" \
|
||||||
|
-e "s/%domain%/$domain/g" \
|
||||||
|
-e "s/%ns1%/$ns1/g" \
|
||||||
|
-e "s/%ns2%/$ns2/g" \
|
||||||
|
-e "s/%date%/$V_DATE/g" > $V_USERS/$user/zones/$domain
|
||||||
|
|
||||||
|
# Adding dns.conf record
|
||||||
|
dns_rec="DOMAIN='$domain' IP='$ip' TPL='$template' TTL='$ttl' EXP='$exp'"
|
||||||
|
dns_rec="$dns_rec SOA='$soa' SUSPEND='no' DATE='$V_DATE'"
|
||||||
|
echo "$dns_rec" >> $V_USERS/$user/dns.conf
|
||||||
|
|
||||||
|
# Adding zone in named.conf
|
||||||
|
named="zone \"$domain_idn\" {type master; file \"/etc/namedb/$domain.db\";};"
|
||||||
|
echo "$named" >> /etc/named.conf
|
||||||
|
|
||||||
|
# Updating domain dns zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Increasing domain value
|
||||||
|
increase_user_value "$user" '$U_DNS_DOMAINS'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_dns_domain $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
90
bin/v_add_dns_domain_record
Executable file
90
bin/v_add_dns_domain_record
Executable file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding dns domain record
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
record=$(idn -t --quiet -u "$3" )
|
||||||
|
rtype=$(echo "$4"| tr '[:lower:]' '[:upper:]')
|
||||||
|
value=$(idn -t --quiet -u "$5" )
|
||||||
|
id="$6"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '5' "$#" 'user domain record type value [id]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'record' 'rtype'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is active
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
# Defining if emtpy
|
||||||
|
if [ -z "$id"] ; then
|
||||||
|
id=$(get_next_dns_record)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking id format
|
||||||
|
format_validation 'id'
|
||||||
|
|
||||||
|
# Checking id
|
||||||
|
is_dns_record_free
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining zone path
|
||||||
|
zone="$V_USERS/$user/zones/$domain"
|
||||||
|
|
||||||
|
# Adding record
|
||||||
|
dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$value'"
|
||||||
|
dns_rec="$dns_rec SUSPEND='no' DATE='$V_DATE'"
|
||||||
|
echo "$dns_rec" >> $zone
|
||||||
|
|
||||||
|
# Sorting records
|
||||||
|
sort_dns_records
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_dns_domain_record $user $domain $id"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
57
bin/v_add_ssl_certificate
Executable file
57
bin/v_add_ssl_certificate
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/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 certificate name
|
||||||
|
is_cert_free
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
is_cert_valid "$V_TMP"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding certificate to user dir
|
||||||
|
cp $V_TMP/$cert.crt $V_USERS/$user/cert/
|
||||||
|
cp $V_TMP/$cert.key $V_USERS/$user/cert/
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_ssl_certificate $user $cert"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
82
bin/v_add_sys_cron
Executable file
82
bin/v_add_sys_cron
Executable file
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding cron job
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
min="$2"
|
||||||
|
hour="$3"
|
||||||
|
day="$4"
|
||||||
|
month="$5"
|
||||||
|
wday="$6"
|
||||||
|
command="$7"
|
||||||
|
job="$8"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '7' "$#" 'user min hour day month wday command [job]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'min' 'hour' 'day' 'month' 'wday' 'command'
|
||||||
|
|
||||||
|
# Checking cron system
|
||||||
|
is_system_enabled 'cron'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Get str position
|
||||||
|
if [ -z "$job" ]; then
|
||||||
|
job=$(get_next_cron_string)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking id format
|
||||||
|
format_validation 'job'
|
||||||
|
|
||||||
|
# Checking job id
|
||||||
|
is_cron_job_free
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Concatenating cron string
|
||||||
|
command=$(echo $command|sed -e "s/'/%quote%/g" -e "s/:/%dots%/g")
|
||||||
|
v_str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month"
|
||||||
|
v_str="$v_str' WDAY='$wday' CMD='$command' SUSPEND='no' DATE='$V_DATE'"
|
||||||
|
|
||||||
|
# Adding to crontab
|
||||||
|
echo "$v_str">>$V_USERS/$user/crontab.conf
|
||||||
|
|
||||||
|
# Sorting jobs by id
|
||||||
|
sort_cron_jobs
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_sys_cron $user $job"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
100
bin/v_add_sys_ip
Executable file
100
bin/v_add_sys_ip
Executable file
|
@ -0,0 +1,100 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding system ip
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
ip="$1"
|
||||||
|
mask="$2"
|
||||||
|
interface="${3-eth0}"
|
||||||
|
owner="${4-vesta}"
|
||||||
|
ip_status="${5-shared}"
|
||||||
|
ip_name="$6"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh # for namehosting
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'ip mask [interface] [owner] [ip_status] [ip_name]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'ip' 'mask' 'interface'
|
||||||
|
|
||||||
|
# Checking system ip
|
||||||
|
is_sys_ip_free
|
||||||
|
|
||||||
|
# Checking owner
|
||||||
|
if [ ! -z "$owner" ]; then
|
||||||
|
format_validation 'user'
|
||||||
|
is_user_valid "$owner"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking ip_status
|
||||||
|
if [ ! -z "$ip_status" ]; then
|
||||||
|
format_validation 'ip_status'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking ip_name
|
||||||
|
if [ ! -z "$ip_name" ] ; then
|
||||||
|
format_validation 'ip_name'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get interface number
|
||||||
|
i_number=$(get_next_interface_number)
|
||||||
|
iface="$interface$i_number"
|
||||||
|
|
||||||
|
# Defining config paths
|
||||||
|
conf='/etc/httpd/conf.d/vesta.conf'
|
||||||
|
nconf='/etc/nginx/conf.d/vesta_ip.conf'
|
||||||
|
iconf='/etc/sysconfig/network-scripts/ifcfg'
|
||||||
|
rconf='/etc/httpd/conf.d/rpaf.conf'
|
||||||
|
|
||||||
|
# Adding ip
|
||||||
|
ifconfig "$iface" "$ip" netmask "$mask"
|
||||||
|
|
||||||
|
# Adding startup script
|
||||||
|
ip_add_startup
|
||||||
|
|
||||||
|
# Adding vesta ip
|
||||||
|
ip_add_vesta
|
||||||
|
|
||||||
|
# Importing main config
|
||||||
|
source $V_CONF/vesta.conf
|
||||||
|
|
||||||
|
# Adding namehosting support
|
||||||
|
namehost_ip_support
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Updating user conf
|
||||||
|
if [ ! -z "$owner" ]; then
|
||||||
|
user="$owner"
|
||||||
|
increase_user_value "$user" '$IP_OWNED'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
if [ "$web_restart" = 'yes' ]; then
|
||||||
|
restart_schedule 'web'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
191
bin/v_add_sys_user
Executable file
191
bin/v_add_sys_user
Executable file
|
@ -0,0 +1,191 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding system user
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
password="$2"
|
||||||
|
email="$3"
|
||||||
|
role="$4"
|
||||||
|
owner="${5-vesta}"
|
||||||
|
package="${6-default}"
|
||||||
|
ns1=$7
|
||||||
|
ns2=$8
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '5' "$#" 'user password email role owner [package] [ns1] [ns2]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'password' 'email' 'role' 'owner' 'package'
|
||||||
|
format_validation 'ns1' 'ns2'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_free "$user"
|
||||||
|
|
||||||
|
# Checking 'vesta' user creation
|
||||||
|
if [ "$user" != 'vesta' ]; then
|
||||||
|
# Checking owner
|
||||||
|
is_user_valid "$owner"
|
||||||
|
|
||||||
|
# Checking owner role
|
||||||
|
is_user_privileged "$owner"
|
||||||
|
|
||||||
|
# Checking owner permission
|
||||||
|
is_user_privileged "$owner" "$role"
|
||||||
|
|
||||||
|
# Checking package
|
||||||
|
is_package_valid "$package"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Importing main config
|
||||||
|
source $V_CONF/vesta.conf
|
||||||
|
|
||||||
|
# Parsing package data
|
||||||
|
package_data=$(cat $V_PKG/$package.pkg)
|
||||||
|
|
||||||
|
# Checking shell
|
||||||
|
shell_conf=$(echo "$package_data"|grep 'SHELL'|cut -f 2 -d \')
|
||||||
|
case $shell_conf in
|
||||||
|
nologin) shell='/sbin/nologin' ;;
|
||||||
|
bash) shell='/bin/bash' ;;
|
||||||
|
*) shell='/sbin/nologin' ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Adding user
|
||||||
|
/usr/sbin/adduser "$user" -s "$shell" -c "$email" -m -d "$V_HOME/$user"
|
||||||
|
|
||||||
|
# Adding password
|
||||||
|
echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Building directory tree
|
||||||
|
if [ ! -z "$BACKUP_SYSTEM" ] && [ "$BACKUP_SYSTEM" != 'no' ]; then
|
||||||
|
mkdir $V_HOME/$user/backup
|
||||||
|
chmod 751 $V_HOME/$user/backup
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
|
||||||
|
mkdir $V_HOME/$user/conf
|
||||||
|
mkdir $V_HOME/$user/domains
|
||||||
|
mkdir $V_HOME/$user/tmp
|
||||||
|
chmod 751 $V_HOME/$user/conf
|
||||||
|
chmod 751 $V_HOME/$user/domains
|
||||||
|
chmod 777 $V_HOME/$user/tmp
|
||||||
|
chown $user:$user $V_HOME/$user/domains
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
|
||||||
|
mkdir $V_HOME/$user/mail
|
||||||
|
chmod 751 $V_HOME/$user/mail
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
|
chmod -R a+x $V_HOME/$user
|
||||||
|
|
||||||
|
# Checking quota
|
||||||
|
if [ ! -z "$DISK_QUOTA" ] && [ "$DISK_QUOTA" != 'off' ]; then
|
||||||
|
DISK_QUOTA=$(echo "$package_data"|grep 'DISK_QUOTA' | cut -f 2 -d \')
|
||||||
|
set_quota "$user" "$DISK_QUOTA"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding user dir
|
||||||
|
mkdir $V_USERS/$user
|
||||||
|
|
||||||
|
# Creating configuration files and pipes
|
||||||
|
touch $V_USERS/$user/user.conf
|
||||||
|
echo "v_upd_sys_user_disk $user" >> $V_QUEUE/disk.pipe
|
||||||
|
|
||||||
|
if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
|
||||||
|
mkdir $V_USERS/$user/cert
|
||||||
|
touch $V_USERS/$user/web_domains.conf
|
||||||
|
echo "v_upd_web_domains_traff $user" >> $V_QUEUE/traffic.pipe
|
||||||
|
echo "v_upd_web_domains_disk $user" >> $V_QUEUE/disk.pipe
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
|
||||||
|
touch $V_USERS/$user/dns.conf
|
||||||
|
mkdir $V_USERS/$user/zones
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
|
||||||
|
touch $V_USERS/$user/mail_domains.conf
|
||||||
|
touch $V_USERS/$user/mail_boxes.conf
|
||||||
|
echo "v_upd_mail_domains_disk $user" >> $V_QUEUE/disk.pipe
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
|
||||||
|
touch $V_USERS/$user/db.conf
|
||||||
|
echo "v_upd_db_bases_disk $user" >> $V_QUEUE/disk.pipe
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then
|
||||||
|
touch $V_USERS/$user/crontab.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$BACKUP_SYSTEM" ] && [ "$BACKUP_SYSTEM" != 'no' ]; then
|
||||||
|
echo "v_backup_sys_user $user" >> $V_QUEUE/backup.pipe
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rewriting nameservers
|
||||||
|
if [ ! -z "$ns1" ]; then
|
||||||
|
package_data=$(echo "$package_data" | sed -e "s/NS1=.*$/NS1='$ns1'/g")
|
||||||
|
fi
|
||||||
|
if [ ! -z "$ns2" ]; then
|
||||||
|
package_data=$(echo "$package_data" | sed -e "s/NS2=.*$/NS2='$ns2'/g")
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Filling user config
|
||||||
|
echo "PACKAGE='$package'
|
||||||
|
$package_data
|
||||||
|
SUSPENDED='no'
|
||||||
|
OWNER='$owner'
|
||||||
|
ROLE='$role'
|
||||||
|
CONTACT='$email'
|
||||||
|
REPORTS='yes'
|
||||||
|
IP_OWNED='0'
|
||||||
|
U_CHILDS='0'
|
||||||
|
U_DISK='0'
|
||||||
|
U_BANDWIDTH='0'
|
||||||
|
U_WEB_DOMAINS='0'
|
||||||
|
U_WEB_SSL='0'
|
||||||
|
U_DNS_DOMAINS='0'
|
||||||
|
U_DATABASES='0'
|
||||||
|
U_MAIL_DOMAINS='0'
|
||||||
|
DATE='$V_DATE'" > $V_USERS/$user/user.conf
|
||||||
|
|
||||||
|
# Filling owner config
|
||||||
|
ROLE=$(echo "$role" | tr "[:lower:]" "[:upper:]")
|
||||||
|
if [ "$user" != 'vesta' ]; then
|
||||||
|
echo "$ROLE='$user'" >> $V_USERS/$owner/reseller.conf
|
||||||
|
increase_user_value "$owner" 'U_CHILDS'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Hiding password
|
||||||
|
V_EVENT=$(echo $V_EVENT | sed -e "s/$password/xxxxxx/g")
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
67
bin/v_add_sys_user_ip
Executable file
67
bin/v_add_sys_user_ip
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: addding ip to user
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
ip="$2"
|
||||||
|
ip_status="${3-exclusive}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user ip [ip_status]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'ip' 'ip_status'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking system ip
|
||||||
|
is_sys_ip_valid
|
||||||
|
|
||||||
|
# Checking webdomains on ip
|
||||||
|
is_ip_key_empty '$U_WEB_DOMAINS'
|
||||||
|
|
||||||
|
# Checking users on ip
|
||||||
|
is_ip_key_empty '$U_SYS_USERS'
|
||||||
|
|
||||||
|
# Checking ip owner
|
||||||
|
is_ip_key_empty '$OWNER'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding ip to user
|
||||||
|
update_sys_ip_value '$OWNER' "$user"
|
||||||
|
update_sys_ip_value '$STATUS' "$ip_status"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Updating user conf
|
||||||
|
increase_user_value "$user" '$IP_OWNED'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
59
bin/v_add_sys_user_reports
Executable file
59
bin/v_add_sys_user_reports
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding user reports
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking reports existance
|
||||||
|
is_user_key_empty '$REPORTS'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing user report value
|
||||||
|
update_user_value "$user" '$REPORTS' 'yes'
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_sys_user_reports $user"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
187
bin/v_add_web_domain
Executable file
187
bin/v_add_web_domain
Executable file
|
@ -0,0 +1,187 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
ip="$3"
|
||||||
|
template=${4-default}
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain ip [template]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'ip' 'template'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain
|
||||||
|
is_domain_new 'quiet'
|
||||||
|
if [ $? -ne $OK ]; then
|
||||||
|
|
||||||
|
# Checking domain owner
|
||||||
|
is_domain_owner
|
||||||
|
|
||||||
|
# Checking domain service
|
||||||
|
is_web_domain_free
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking ip
|
||||||
|
is_ip_avalable
|
||||||
|
|
||||||
|
# Checking package
|
||||||
|
is_package_full 'web_domain'
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
templates=$(get_user_value '$TEMPLATES')
|
||||||
|
is_template_valid "web"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining domain aliases
|
||||||
|
ip_name=$(get_ip_name)
|
||||||
|
ip_name_idn=$(idn -t --quiet -a "$ip_name")
|
||||||
|
domain_alias="www.$domain"
|
||||||
|
domain_alias_idn="www.$domain_idn"
|
||||||
|
if [ ! -z "$ip_name" ]; then
|
||||||
|
domain_alias_dash="${domain//./-}.$ip_name"
|
||||||
|
domain_alias_dash_idn="${domain_idn//./-}.$ip_name_idn"
|
||||||
|
aliases="$domain_alias,$domain_alias_dash"
|
||||||
|
aliases_idn="$domain_alias_idn,$domain_alias_dash_idn"
|
||||||
|
else
|
||||||
|
aliases="$domain_alias"
|
||||||
|
aliases_idn="$domain_alias_idn"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defining vars for httpd_add_config function
|
||||||
|
port=$(get_web_port)
|
||||||
|
group="$user"
|
||||||
|
email="$user@$domain"
|
||||||
|
docroot="$V_HOME/$user/domains/$domain/public_html"
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
tpl_file="$V_WEBTPL/apache_$template.tpl"
|
||||||
|
|
||||||
|
# Adding domain to the httpd.conf
|
||||||
|
httpd_add_config
|
||||||
|
|
||||||
|
# Building directory tree
|
||||||
|
mkdir $V_HOME/$user/domains/$domain \
|
||||||
|
$V_HOME/$user/domains/$domain/public_html \
|
||||||
|
$V_HOME/$user/domains/$domain/public_shtml \
|
||||||
|
$V_HOME/$user/domains/$domain/document_errors \
|
||||||
|
$V_HOME/$user/domains/$domain/cgi-bin \
|
||||||
|
$V_HOME/$user/domains/$domain/private \
|
||||||
|
$V_HOME/$user/domains/$domain/stats \
|
||||||
|
$V_HOME/$user/domains/$domain/logs
|
||||||
|
|
||||||
|
# Adding domain logs
|
||||||
|
touch /var/log/httpd/domains/$domain.bytes \
|
||||||
|
/var/log/httpd/domains/$domain.log \
|
||||||
|
/var/log/httpd/domains/$domain.error_log
|
||||||
|
|
||||||
|
# Adding symlink for logs
|
||||||
|
ln -s /var/log/httpd/domains/$domain.*log $V_HOME/$user/domains/$domain/logs/
|
||||||
|
|
||||||
|
# Adding domain skeleton
|
||||||
|
cp -r $V_WEBTPL/skel/public_html/ $V_HOME/$user/domains/$domain/
|
||||||
|
cp -r $V_WEBTPL/skel/public_shtml/ $V_HOME/$user/domains/$domain/
|
||||||
|
cp -r $V_WEBTPL/skel/document_errors/ $V_HOME/$user/domains/$domain/
|
||||||
|
cp -r $V_WEBTPL/skel/cgi-bin/ $V_HOME/$user/domains/$domain/
|
||||||
|
|
||||||
|
# Changing tpl values
|
||||||
|
for file in $(find "$V_HOME/$user/domains/$domain/" -type f); do
|
||||||
|
sed -i "s/%domain%/$domain/g" $file
|
||||||
|
done
|
||||||
|
|
||||||
|
# Changing file owner
|
||||||
|
chown -R $user:$user $V_HOME/$user/domains/$domain
|
||||||
|
chown root:$user /var/log/httpd/domains/$domain.*
|
||||||
|
|
||||||
|
# Changing file permissions
|
||||||
|
chmod 551 $V_HOME/$user/domains/$domain
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/private
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/cgi-bin
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/public_html
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/public_shtml
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/document_errors
|
||||||
|
chmod -f -R 775 $V_HOME/$user/domains/$domain/cgi-bin/*
|
||||||
|
chmod -f -R 775 $V_HOME/$user/domains/$domain/public_html/*
|
||||||
|
chmod -f -R 775 $V_HOME/$user/domains/$domain/document_errors/*
|
||||||
|
chmod 551 $V_HOME/$user/domains/$domain/stats
|
||||||
|
chmod 551 $V_HOME/$user/domains/$domain/logs
|
||||||
|
chmod 640 /var/log/httpd/domains/$domain.*
|
||||||
|
|
||||||
|
# Running template post setup file
|
||||||
|
if [ -e $V_WEBTPL/apache_$template.sh ]; then
|
||||||
|
$V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking main vesta httpd config
|
||||||
|
main_conf='/etc/httpd/conf.d/vesta.conf'
|
||||||
|
main_conf_check=$(grep "$conf" $main_conf )
|
||||||
|
if [ -z "$main_conf_check" ]; then
|
||||||
|
echo "Include $conf" >>$main_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Increasing ip value
|
||||||
|
increase_ip_value
|
||||||
|
|
||||||
|
# Increasing domain value
|
||||||
|
increase_user_value "$user" '$U_WEB_DOMAINS'
|
||||||
|
|
||||||
|
# Defining domain variables
|
||||||
|
template_data=$(cat $V_WEBTPL/apache_$template.descr|grep -v '#')
|
||||||
|
v_str="DOMAIN='$domain'"
|
||||||
|
v_str="$v_str IP='$ip'"
|
||||||
|
v_str="$v_str U_DISK='0'"
|
||||||
|
v_str="$v_str U_BANDWIDTH='0'"
|
||||||
|
v_str="$v_str TPL='$template'"
|
||||||
|
v_str="$v_str ALIAS='$aliases'"
|
||||||
|
v_str="$v_str $template_data" # Inserting PHP,CGI and ELOG keys
|
||||||
|
v_str="$v_str STATS='' STATS_AUTH=''"
|
||||||
|
v_str="$v_str SSL='no' SSL_HOME='' SSL_CERT=''"
|
||||||
|
v_str="$v_str NGINX='' NGINX_EXT='' SUSPEND='no' DATE='$V_DATE'"
|
||||||
|
|
||||||
|
# Registering domain
|
||||||
|
echo "$v_str" >>$V_USERS/$user/web_domains.conf
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
119
bin/v_add_web_domain_alias
Executable file
119
bin/v_add_web_domain_alias
Executable file
|
@ -0,0 +1,119 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding web domain alias
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
dom_alias=$(idn -t --quiet -u "$3" )
|
||||||
|
dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain dom_alias'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'dom_alias'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking alias on the server
|
||||||
|
is_domain_new 'quiet' "$dom_alias"
|
||||||
|
if [ $? -ne $OK ]; then
|
||||||
|
|
||||||
|
# Checking alias owner
|
||||||
|
is_domain_owner "$dom_alias"
|
||||||
|
|
||||||
|
# Checking alias service
|
||||||
|
is_web_domain_free "$dom_alias"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking package
|
||||||
|
is_package_full 'web_alias'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ServerAlias'
|
||||||
|
|
||||||
|
# Defining new alias string
|
||||||
|
curr_alias=$(get_web_domain_value '$ALIAS')
|
||||||
|
if [ -z "$curr_alias" ]; then
|
||||||
|
new_alias="$dom_alias"
|
||||||
|
new_alias_idn="$dom_alias_idn"
|
||||||
|
else
|
||||||
|
new_alias="$curr_alias,$dom_alias"
|
||||||
|
new_alias_idn=$(idn -t --quiet -a "$curr_alias,$dom_alias")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" ServerAlias ${new_alias_idn//,/ }"
|
||||||
|
|
||||||
|
# Adding alias
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Checking ssl domain
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Defining ssl template
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining ssl config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Adding alias
|
||||||
|
httpd_change_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding new alias
|
||||||
|
update_web_domain_value '$ALIAS' "$new_alias"
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain_alias $user $domain $dom_alias"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
122
bin/v_add_web_domain_cgi
Executable file
122
bin/v_add_web_domain_cgi
Executable file
|
@ -0,0 +1,122 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding cgi for domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking cgi is not added
|
||||||
|
is_web_domain_key_empty '$CGI'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ScriptAlias '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin/"
|
||||||
|
|
||||||
|
# Adding cgi-bin support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='Options '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=' Options +Includes -Indexes +ExecCGI'
|
||||||
|
|
||||||
|
# Adding execscgi support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Get ssl template name
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining ssl config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ScriptAlias '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin/"
|
||||||
|
|
||||||
|
# Adding cgi-bin support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='Options '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=' Options +Includes -Indexes +ExecCGI'
|
||||||
|
|
||||||
|
# Adding execscgi support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding elog in config
|
||||||
|
update_web_domain_value '$CGI' 'yes'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain_cgi $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
98
bin/v_add_web_domain_elog
Executable file
98
bin/v_add_web_domain_elog
Executable file
|
@ -0,0 +1,98 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding error log for domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking errorlog is not added
|
||||||
|
is_web_domain_key_empty '$ELOG'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ErrorLog '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" ErrorLog /var/log/httpd/domains/$domain.error.log"
|
||||||
|
|
||||||
|
# Adding errolog support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Get ssl template name
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining ssl config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Adding errolog support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding elog in config
|
||||||
|
update_web_domain_value '$ELOG' 'yes'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain_elog $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
112
bin/v_add_web_domain_nginx
Executable file
112
bin/v_add_web_domain_nginx
Executable file
|
@ -0,0 +1,112 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding web domain nginx integration
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
template="${3-default}"
|
||||||
|
default_extentions="jpg jpeg gif png ico css zip tgz gz rar bz2 doc xls exe\
|
||||||
|
pdf ppt txt tar wav bmp rtf js mp3 avi mpeg"
|
||||||
|
extentions="${4-$default_extentions}"
|
||||||
|
extentions=${extentions// /|} # replacing spaces with pipe char
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain [template] [extentions] [conn]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'template' 'extentions'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'proxy'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Check nginx is not added
|
||||||
|
is_web_domain_key_empty '$NGINX'
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
is_template_valid "proxy"
|
||||||
|
|
||||||
|
|
||||||
|
exit
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/$package-$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ServerAlias'
|
||||||
|
|
||||||
|
# Defining new alias string
|
||||||
|
curr_alias=$(get_web_domain_value '$ALIAS')
|
||||||
|
if [ -z "$curr_alias" ]; then
|
||||||
|
new_alias="$dom_alias"
|
||||||
|
else
|
||||||
|
new_alias="$curr_alias,$dom_alias"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" ServerAlias ${new_alias//,/ }"
|
||||||
|
|
||||||
|
# Adding alias
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Checking ssl domain
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Defining ssl template
|
||||||
|
tpl_file="$V_WEBTPL/$package-$tpl_name.ssl.tpl"
|
||||||
|
|
||||||
|
# Defining ssl config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Adding alias
|
||||||
|
httpd_change_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding new alias
|
||||||
|
update_web_domain_value '$ALIAS' "$new_alias"
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain_alias $user $domain $dom_alias"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
120
bin/v_add_web_domain_ssl
Executable file
120
bin/v_add_web_domain_ssl
Executable file
|
@ -0,0 +1,120 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding ssl for domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
cert="$3"
|
||||||
|
tpl_option="${4-single}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain certificate [sslhome]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'certificate'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking package
|
||||||
|
is_package_full 'web_ssl'
|
||||||
|
|
||||||
|
# Check ssl is not added
|
||||||
|
is_web_domain_key_empty '$SSL'
|
||||||
|
|
||||||
|
# Checking ssl certificate
|
||||||
|
is_web_domain_cert_valid
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
templates=$(get_user_value '$TEMPLATES')
|
||||||
|
template=$(get_web_domain_value '$TPL')
|
||||||
|
is_template_valid 'web'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining variables for template replace
|
||||||
|
port=$(get_web_port_ssl)
|
||||||
|
ip=$(get_web_domain_value '$IP')
|
||||||
|
aliases=$(get_web_domain_value '$ALIAS')
|
||||||
|
aliases_idn=$(idn -t --quiet -a "$aliases")
|
||||||
|
email="$user@$domain"
|
||||||
|
ssl_cert="$V_HOME/$user/conf/$cert.crt"
|
||||||
|
ssl_key="$V_HOME/$user/conf/$cert.key"
|
||||||
|
case $tpl_option in
|
||||||
|
single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
|
||||||
|
same) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
|
||||||
|
*) check_args '3' "$#" 'user domain certificate [sslhome]'
|
||||||
|
esac
|
||||||
|
group="$user"
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
tpl_file="$V_WEBTPL/apache_$template.stpl"
|
||||||
|
|
||||||
|
# Adding domain to the httpd.conf
|
||||||
|
httpd_add_config
|
||||||
|
|
||||||
|
# Adding certificate to user dir
|
||||||
|
if [ ! -e "$ssl_cert" ]; then
|
||||||
|
cp -f $V_USERS/$user/cert/$cert.crt $ssl_cert
|
||||||
|
cp -f $V_USERS/$user/cert/$cert.key $ssl_key
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Running template post setup file
|
||||||
|
if [ -e $V_WEBTPL/apache_$template.sh ]; then
|
||||||
|
$V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking main vesta httpd config
|
||||||
|
main_conf='/etc/httpd/conf.d/vesta.conf'
|
||||||
|
main_conf_check=$(grep "$conf" $main_conf )
|
||||||
|
if [ -z "$main_conf_check" ]; then
|
||||||
|
echo "Include $conf" >>$main_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Increasing domain value
|
||||||
|
increase_user_value "$user" '$U_WEB_SSL'
|
||||||
|
|
||||||
|
# Adding ssl values
|
||||||
|
update_web_domain_value '$SSL' 'yes'
|
||||||
|
update_web_domain_value '$SSL_HOME' "$tpl_option"
|
||||||
|
update_web_domain_value '$SSL_CERT' "$cert"
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain_ssl $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
89
bin/v_add_web_domain_stat
Executable file
89
bin/v_add_web_domain_stat
Executable file
|
@ -0,0 +1,89 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding stats for domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
type="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain type'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
check_func_result $?
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid "$user"
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking statistic type
|
||||||
|
is_type_valid 'stat' "$type"
|
||||||
|
|
||||||
|
# Check statistic is not added
|
||||||
|
is_web_domain_key_empty '$STATS'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding statistic config
|
||||||
|
cat $V_WEBTPL/$type.tpl |\
|
||||||
|
sed -e "s/%ip%/$ip/g" | \
|
||||||
|
sed -e "s/%port%/$port/g" | \
|
||||||
|
sed -e "s/%domain_idn%/$domain_idn/g" | \
|
||||||
|
sed -e "s/%domain%/$domain/g" | \
|
||||||
|
sed -e "s/%user%/$user/g" | \
|
||||||
|
sed -e "s/%home%/${V_HOME////\/}/g" | \
|
||||||
|
sed -e "s/%alias%/$domain_aliases/g" \
|
||||||
|
>$V_HOME/$user/conf/$type.$domain.conf
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Switching on command string for pipe
|
||||||
|
case $type in
|
||||||
|
webalizer) command="webalizer -c $V_HOME/$user/conf/$type.$domain.conf";;
|
||||||
|
awstats ) command="" # FIXME awstats command;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Adding command to pipe
|
||||||
|
echo "$command" >> $V_QUEUE/stats.pipe
|
||||||
|
|
||||||
|
# Adding stats in config
|
||||||
|
update_web_domain_value '$STATS' "$type"
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain_stat $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
99
bin/v_add_web_domain_stat_auth
Executable file
99
bin/v_add_web_domain_stat_auth
Executable file
|
@ -0,0 +1,99 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
auth_user="$3"
|
||||||
|
auth_pass="$4"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '4' "$#" 'user domain auth_user auth_password'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'auth_user' 'auth_pass'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Definining statistic dir
|
||||||
|
stat_dir="$V_HOME/$user/domains/$domain/stats"
|
||||||
|
|
||||||
|
# Adding htaccess file
|
||||||
|
if [ ! -e "$stat_dir/.htaccess" ]; then
|
||||||
|
echo "AuthUserFile $stat_dir/.htpasswd" > $stat_dir/.htaccess
|
||||||
|
echo "AuthName \"Only for admins\"" >> $stat_dir/.htaccess
|
||||||
|
echo "AuthType Basic" >> $stat_dir/.htaccess
|
||||||
|
echo "Require valid-user" >> $stat_dir/.htaccess
|
||||||
|
echo "" >> $stat_dir/.htaccess
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generating htaccess user and password
|
||||||
|
if [ ! -e "$stat_dir/.htpasswd" ]; then
|
||||||
|
htpasswd -bc $stat_dir/.htpasswd "$auth_user" "$auth_pass" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
htpasswd -b $stat_dir/.htpasswd "$auth_user" "$auth_pass" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get current value
|
||||||
|
curr_val=$(get_web_domain_value '$STATS_AUTH')
|
||||||
|
check_uniq=$(echo "$curr_val" | grep -w "$auth_user")
|
||||||
|
|
||||||
|
# Checking current users
|
||||||
|
if [ -z "$curr_val" ] || [ "$curr_val" = 'no' ]; then
|
||||||
|
a_users="$auth_user"
|
||||||
|
else
|
||||||
|
if [ -z "$check_uniq" ]; then
|
||||||
|
a_users="$curr_val,$auth_user"
|
||||||
|
else
|
||||||
|
a_users="$curr_val"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding stats user in config
|
||||||
|
update_web_domain_value '$STATS_AUTH' "$a_users"
|
||||||
|
|
||||||
|
# Hiding password
|
||||||
|
V_EVENT=$(echo $V_EVENT | sed -e "s/$auth_pass/xxxxxx/g")
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_del_web_domain_stat_auth $user $domain $auth_user"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
71
bin/v_change_db_password
Executable file
71
bin/v_change_db_password
Executable file
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing userdb password
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
database="$2"
|
||||||
|
db_password="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user db_name db_password'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'database' 'db_password'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking db existance
|
||||||
|
is_db_valid
|
||||||
|
|
||||||
|
# Checking db is active
|
||||||
|
is_db_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Define database variables
|
||||||
|
db_user=$(get_db_value '$USER')
|
||||||
|
host=$(get_db_value '$HOST')
|
||||||
|
type=$(get_db_value '$TYPE')
|
||||||
|
|
||||||
|
# Switching on db type
|
||||||
|
case $type in
|
||||||
|
mysql) change_db_mysql_password ;;
|
||||||
|
pgsql) change_db_pgsql_password ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Hiding password
|
||||||
|
V_EVENT=$(echo $V_EVENT | sed -e "s/$db_password/xxxxxx/g")
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
65
bin/v_change_dns_domain_exp
Executable file
65
bin/v_change_dns_domain_exp
Executable file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing dns domain exp date
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
exp="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain exp'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'exp'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old expiriation date
|
||||||
|
old_exp=$(get_dns_domain_value '$EXP')
|
||||||
|
|
||||||
|
# Changing exp
|
||||||
|
update_dns_domain_value '$EXP' "$exp"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_exp"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
73
bin/v_change_dns_domain_ip
Executable file
73
bin/v_change_dns_domain_ip
Executable file
|
@ -0,0 +1,73 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing dns domain ip
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
ip="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain ip'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'ip'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old ip
|
||||||
|
old_ip=$(get_dns_domain_value '$IP')
|
||||||
|
|
||||||
|
# Changing ip
|
||||||
|
update_dns_domain_value '$IP' "$ip"
|
||||||
|
|
||||||
|
# Changing records
|
||||||
|
sed -i "s/$old_ip/$ip/g" $V_USERS/$user/zones/$domain
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ip"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
87
bin/v_change_dns_domain_record
Executable file
87
bin/v_change_dns_domain_record
Executable file
|
@ -0,0 +1,87 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing dns domain record
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
id="$3"
|
||||||
|
record=$(idn -t --quiet -u "$4" )
|
||||||
|
rtype=$(echo "$5"| tr '[:lower:]' '[:upper:]')
|
||||||
|
value=$(idn -t --quiet -u "$6" )
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '5' "$#" 'user domain id record type value'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'id' 'record' 'rtype'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
# Checking record valid
|
||||||
|
is_dns_record_valid
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining zone path
|
||||||
|
zone="$V_USERS/$user/zones/$domain"
|
||||||
|
|
||||||
|
# Deleting old record
|
||||||
|
rm_string=$(grep -n "^ID='$id'" $zone|cut -d : -f 1)
|
||||||
|
if [ ! -z "$rm_string" ]; then
|
||||||
|
sed -i "$rm_string d" $zone
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding record
|
||||||
|
dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$value'"
|
||||||
|
dns_rec="$dns_rec SUSPEND='no' DATE='$V_DATE'"
|
||||||
|
echo "$dns_rec" >> $zone
|
||||||
|
|
||||||
|
# Sorting records
|
||||||
|
sort_dns_records
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
70
bin/v_change_dns_domain_soa
Executable file
70
bin/v_change_dns_domain_soa
Executable file
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing dns domain soa
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
soa="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain soa'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'soa'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old soa
|
||||||
|
old_soa=$(get_dns_domain_value '$SOA')
|
||||||
|
|
||||||
|
# Changing soa
|
||||||
|
update_dns_domain_value '$SOA' "$soa"
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_soa"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
84
bin/v_change_dns_domain_tpl
Executable file
84
bin/v_change_dns_domain_tpl
Executable file
|
@ -0,0 +1,84 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing dns domain template
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
template="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain template'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'template'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
is_template_valid 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get vals
|
||||||
|
old_tpl=$(get_dns_domain_value '$TPL')
|
||||||
|
ip=$(get_dns_domain_value '$IP')
|
||||||
|
ns1=$(get_user_value '$NS1')
|
||||||
|
ns2=$(get_user_value '$NS2')
|
||||||
|
|
||||||
|
# Changing tpl
|
||||||
|
update_dns_domain_value '$TPL' "$template"
|
||||||
|
|
||||||
|
cat $V_DNSTPL/$template.tpl |\
|
||||||
|
sed -e "s/%ip%/$ip/g" \
|
||||||
|
-e "s/%domain_idn%/$domain_idn/g" \
|
||||||
|
-e "s/%domain%/$domain/g" \
|
||||||
|
-e "s/%ns1%/$ns1/g" \
|
||||||
|
-e "s/%ns2%/$ns2/g" > $V_USERS/$user/zones/$domain
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_tpl"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
71
bin/v_change_dns_domain_ttl
Executable file
71
bin/v_change_dns_domain_ttl
Executable file
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing dns domain ttl
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
ttl="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain ttl'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'ttl'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old ttl
|
||||||
|
old_ttl=$(get_dns_domain_value '$TTL')
|
||||||
|
|
||||||
|
# Changing ttl
|
||||||
|
update_dns_domain_value '$TTL' "$ttl"
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ttl"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
82
bin/v_change_sys_cron_job
Executable file
82
bin/v_change_sys_cron_job
Executable file
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing cron job
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
job="$2"
|
||||||
|
min="$3"
|
||||||
|
hour="$4"
|
||||||
|
day="$5"
|
||||||
|
month="$6"
|
||||||
|
wday="$7"
|
||||||
|
command="$8"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '7' "$#" 'user job min hour day month wday command'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command'
|
||||||
|
|
||||||
|
# Checking cron system
|
||||||
|
is_system_enabled 'cron'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking cron job
|
||||||
|
is_job_valid
|
||||||
|
|
||||||
|
# Checking job is active
|
||||||
|
# is_job_suspended
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Concatenating cron string
|
||||||
|
command=$(echo $command|sed -e "s/'/%quote%/g" -e "s/:/%dots%/g")
|
||||||
|
v_str="JOB='$job' MIN='$min' HOUR='$hour' WDAY='$wday'"
|
||||||
|
v_str="$v_str MONTH='$month' DAY='$day' CMD='$command' SUSPEND='no'"
|
||||||
|
|
||||||
|
# Deleting job
|
||||||
|
del_cron_job
|
||||||
|
|
||||||
|
# Adding to crontab
|
||||||
|
echo "$v_str">>$V_USERS/$user/crontab.conf
|
||||||
|
|
||||||
|
# Sorting jobs by id
|
||||||
|
sort_cron_jobs
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
47
bin/v_change_sys_ip_name
Executable file
47
bin/v_change_sys_ip_name
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing ip name
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
ip="$1"
|
||||||
|
ip_name="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'ip ip_name'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'ip' 'ip_name'
|
||||||
|
|
||||||
|
# Checking system ip
|
||||||
|
is_sys_ip_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing ip name
|
||||||
|
update_sys_ip_value '$NAME' "$ip_name"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
71
bin/v_change_sys_ip_owner
Executable file
71
bin/v_change_sys_ip_owner
Executable file
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing ip owner
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
ip="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user ip'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'ip'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking system ip
|
||||||
|
is_sys_ip_valid
|
||||||
|
|
||||||
|
# Checking webdomains on ip
|
||||||
|
is_ip_key_empty '$U_WEB_DOMAINS'
|
||||||
|
|
||||||
|
# Checking users on ip
|
||||||
|
is_ip_key_empty '$U_SYS_USERS'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get ip and user owner
|
||||||
|
ip_owner=$(get_sys_ip_value '$OWNER')
|
||||||
|
user_owner=$(get_user_value '$OWNER')
|
||||||
|
owner_role=$(get_user_value '$ROLE')
|
||||||
|
|
||||||
|
# Checking permissions
|
||||||
|
if [ "$owner_role" != 'admin' ] || [ "$ip_owner" != "$user_owner" ]; then
|
||||||
|
echo "Error: ip owner is not admin"
|
||||||
|
log_event 'debug' "$E_PERMS_REQUEIURED $V_EVENT"
|
||||||
|
exit $E_PERMS_REQUEIURED
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Changing ip owner
|
||||||
|
update_sys_ip_value '$OWNER' "$user"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
67
bin/v_change_sys_ip_status
Executable file
67
bin/v_change_sys_ip_status
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing ip status
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
ip="$1"
|
||||||
|
ip_status="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'ip ip_status'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'ip' 'ip_status'
|
||||||
|
|
||||||
|
# Checking system ip
|
||||||
|
is_sys_ip_valid
|
||||||
|
|
||||||
|
# Checking current status
|
||||||
|
current_status=$(get_sys_ip_value '$STATUS')
|
||||||
|
if [ "$ip_status" = "$current_status" ]; then
|
||||||
|
echo "Error: status is already set"
|
||||||
|
log_event 'debug' "$E_VALUE_EXIST $V_EVENT"
|
||||||
|
exit $E_VALUE_EXIST
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Parsing current ip usage
|
||||||
|
web_domains=$(get_sys_ip_value '$U_WEB_DOMAINS')
|
||||||
|
sys_user=$(get_sys_ip_value '$U_SYS_USERS')
|
||||||
|
ip_owner=$(get_sys_ip_value '$OWNER')
|
||||||
|
|
||||||
|
# Checking condition
|
||||||
|
if [ "$web_domains" -ne '0' ] && [ "$sys_user" != "$ip_owner" ]; then
|
||||||
|
echo "Error: ip is used"
|
||||||
|
log_event 'debug' "$E_IP_USED $V_EVENT"
|
||||||
|
exit $E_IP_USED
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing ip name
|
||||||
|
update_sys_ip_value '$STATUS' "$ip_status"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
57
bin/v_change_sys_user_contact
Executable file
57
bin/v_change_sys_user_contact
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing user contact email
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
email="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user email'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'email'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old value
|
||||||
|
old_email=$(get_user_value '$CONTACT')
|
||||||
|
|
||||||
|
# Changing user contact email
|
||||||
|
update_user_value "$user" '$CONTACT' "$email"
|
||||||
|
|
||||||
|
# Changing passwd file
|
||||||
|
pw_str=$(grep -n "^$user:" /etc/passwd)
|
||||||
|
str=$(echo "$pw_str" | cut -f 1 -d :)
|
||||||
|
sed -i "$str s/$old_email/$email/g" /etc/passwd
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $old_email"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
56
bin/v_change_sys_user_ns
Executable file
56
bin/v_change_sys_user_ns
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing user nameservers
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
ns1="$2"
|
||||||
|
ns2="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '3' "$#" 'user ns1 ns2'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'ns1' 'ns2'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old values
|
||||||
|
old_ns1=$(get_user_value '$NS1')
|
||||||
|
old_ns2=$(get_user_value '$NS2')
|
||||||
|
|
||||||
|
# Changing ns values
|
||||||
|
update_user_value "$user" '$NS1' "$ns1"
|
||||||
|
update_user_value "$user" '$NS2' "$ns2"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $old_ns1 $old_ns2"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_change_sys_user_package
Executable file
58
bin/v_change_sys_user_package
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing user package
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
package="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user package'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'package'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking package
|
||||||
|
is_package_valid
|
||||||
|
|
||||||
|
# Checking current data
|
||||||
|
is_package_avalable
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old package value
|
||||||
|
old_package=$(get_user_value '$PACKAGE')
|
||||||
|
|
||||||
|
# Changing user package
|
||||||
|
change_user_package
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
52
bin/v_change_sys_user_password
Executable file
52
bin/v_change_sys_user_password
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing user password
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
password="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user password'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'password'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing user password
|
||||||
|
echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Hiding password
|
||||||
|
V_EVENT=$(echo $V_EVENT | sed -e "s/$password/xxxxxx/g")
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
55
bin/v_change_sys_user_shell
Executable file
55
bin/v_change_sys_user_shell
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing user shell
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
shell="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user shell'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'shell'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing user shell
|
||||||
|
update_user_value "$user" '$SHELL' "$shell"
|
||||||
|
|
||||||
|
# Get shell full path
|
||||||
|
shell_path=$(get_shell_path)
|
||||||
|
|
||||||
|
# Changing passwd file
|
||||||
|
/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
96
bin/v_change_web_domain_ip
Executable file
96
bin/v_change_web_domain_ip
Executable file
|
@ -0,0 +1,96 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing domain ip
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
ip="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain ip'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'ip'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking ip
|
||||||
|
is_ip_avalable
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get tpl
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
old_ip=$(get_web_domain_value '$IP')
|
||||||
|
|
||||||
|
# Changing ip
|
||||||
|
change_domain_ip "$conf" "$domain" "$ip" "$old_ip" "$tpl_file"
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Get tpl
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Adding elog
|
||||||
|
change_domain_ip "$conf" "$domain" "$ip" "$old_ip" "$tpl_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Increasing ip value
|
||||||
|
increase_ip_value
|
||||||
|
|
||||||
|
# Decreasing old ip value
|
||||||
|
decrease_ip_value "$old_ip"
|
||||||
|
|
||||||
|
# Adding ip in config
|
||||||
|
update_web_domain_value '$IP' "$ip"
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ip"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
108
bin/v_change_web_domain_sslcert
Executable file
108
bin/v_change_web_domain_sslcert
Executable file
|
@ -0,0 +1,108 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing domain ssl certificate
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
certificate="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain certificate'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'certificate'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Check SSL is added
|
||||||
|
is_web_domain_value_exist '$SSL'
|
||||||
|
|
||||||
|
# Checking ssl certificate
|
||||||
|
is_web_domain_cert_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defininig config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Defining ssl key and certificate
|
||||||
|
ssl_cert="$V_HOME/$user/conf/$certificate.crt"
|
||||||
|
ssl_key="$V_HOME/$user/conf/$certificate.key"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='SSLCertificateFile'
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" SSLCertificateFile $ssl_cert"
|
||||||
|
|
||||||
|
# Changing sslhome
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='SSLCertificateKeyFile'
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" SSLCertificateKeyFile $ssl_key"
|
||||||
|
|
||||||
|
# Changing sslhome
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Adding certificate to user dir
|
||||||
|
if [ ! -e "$ssl_cert" ]; then
|
||||||
|
cp -f $V_USERS/$user/cert/$certificate.crt $ssl_cert
|
||||||
|
cp -f $V_USERS/$user/cert/$certificate.key $ssl_key
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old sslhome value
|
||||||
|
old_ssl_cert=$(get_web_domain_value '$SSL_CERT')
|
||||||
|
|
||||||
|
# Adding sslcert in config
|
||||||
|
update_web_domain_value '$SSL_CERT' "$certificate"
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ssl_cert"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
109
bin/v_change_web_domain_sslhome
Executable file
109
bin/v_change_web_domain_sslhome
Executable file
|
@ -0,0 +1,109 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing domain ssl home
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
tpl_option="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain sslhome'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Check SSL is added
|
||||||
|
is_web_domain_value_exist '$SSL'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defininig config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='DocumentRoot'
|
||||||
|
|
||||||
|
# Parsing tpl_option
|
||||||
|
case $tpl_option in
|
||||||
|
single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
|
||||||
|
same) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
|
||||||
|
*) check_args '3' "2" 'user domain sslhome'
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" DocumentRoot $docroot"
|
||||||
|
|
||||||
|
# Changing sslhome
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Get old sslhome value
|
||||||
|
ssl_home=$(get_web_domain_value '$SSL_HOME')
|
||||||
|
|
||||||
|
# Parsing old sslhome
|
||||||
|
case $ssl_home in
|
||||||
|
single) dirroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
|
||||||
|
same) dirroot="$V_HOME/$user/domains/$domain/public_html" ;;
|
||||||
|
*) check_args '3' "2" 'user domain sslhome'
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase="<Directory $dirroot>"
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" <Directory $docroot>"
|
||||||
|
|
||||||
|
# Changing sslhome directory tag
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding sslhome in config
|
||||||
|
update_web_domain_value '$SSL_HOME' "$tpl_option"
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "$V_SCRIPT $user $domain $ssl_home"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
137
bin/v_change_web_domain_tpl
Executable file
137
bin/v_change_web_domain_tpl
Executable file
|
@ -0,0 +1,137 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: changing domain template
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
template="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain template'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'template'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
templates=$(get_user_value '$TEMPLATES')
|
||||||
|
is_template_valid "web"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Deleting domain
|
||||||
|
httpd_del_config
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Get tpl
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Deleting domain
|
||||||
|
httpd_del_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defining variables for template replace
|
||||||
|
ip=$(get_web_domain_value '$IP')
|
||||||
|
aliases=$(get_web_domain_value '$ALIAS')
|
||||||
|
port=$(get_web_port)
|
||||||
|
email="$user@$domain"
|
||||||
|
docroot="$V_HOME/$user/domains/$domain/public_html"
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
tpl_file="$V_WEBTPL/apache_$template.tpl"
|
||||||
|
group="$user"
|
||||||
|
|
||||||
|
# Adding domain to the httpd.conf
|
||||||
|
httpd_add_config
|
||||||
|
|
||||||
|
# Running template post setup file
|
||||||
|
if [ -e $V_WEBTPL/apache_$template.sh ]; then
|
||||||
|
$V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
# Defining variables for ssl template replace
|
||||||
|
port=$(get_web_port_ssl)
|
||||||
|
tpl_option=$(get_web_domain_value '$SSL_HOME')
|
||||||
|
cert=$(get_web_domain_value '$SSL_CERT')
|
||||||
|
ssl_cert="$V_HOME/$user/conf/$cert.crt"
|
||||||
|
ssl_key="$V_HOME/$user/conf/$cert.key"
|
||||||
|
case $tpl_option in
|
||||||
|
single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
|
||||||
|
*) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
|
||||||
|
esac
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
tpl_file="$V_WEBTPL/apache_$template.stpl"
|
||||||
|
|
||||||
|
# Adding domain to the httpd.conf
|
||||||
|
httpd_add_config
|
||||||
|
|
||||||
|
# Running template post setup file
|
||||||
|
if [ -e $V_WEBTPL/apache_$template.sh ]; then
|
||||||
|
$V_WEBTPL/apache_$template.sh \
|
||||||
|
"$user" "$domain" "$ip" "$V_HOME" "$docroot" "$port"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing tpl in config
|
||||||
|
update_web_domain_value '$TPL' "$template"
|
||||||
|
|
||||||
|
# Updating db keys
|
||||||
|
for keys in $(cat $V_WEBTPL/apache_$template.descr|grep -v '#'); do
|
||||||
|
key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
|
||||||
|
value=$(echo "$keys" |cut -f 2 -d \')
|
||||||
|
update_web_domain_value "$key" "$value"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
BIN
bin/v_check_sys_user_password
Executable file
BIN
bin/v_check_sys_user_password
Executable file
Binary file not shown.
76
bin/v_del_db_base
Executable file
76
bin/v_del_db_base
Executable file
|
@ -0,0 +1,76 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Deleting data base
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
database="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user db_name'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'database'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking db existance
|
||||||
|
is_db_valid
|
||||||
|
|
||||||
|
# Checking db is active
|
||||||
|
is_db_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get some variables we do not have now
|
||||||
|
db_user=$(get_db_value '$USER')
|
||||||
|
host=$(get_db_value '$HOST')
|
||||||
|
type=$(get_db_value '$TYPE')
|
||||||
|
|
||||||
|
# Switching on db type
|
||||||
|
case $type in
|
||||||
|
mysql) del_db_mysql ;;
|
||||||
|
pgsql) del_db_pgsql ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Decreasing db value
|
||||||
|
decrease_db_value
|
||||||
|
|
||||||
|
# Decreasing domain value
|
||||||
|
decrease_user_value "$user" '$U_DATABASES'
|
||||||
|
|
||||||
|
# Deleting vesta db record
|
||||||
|
del_db_vesta
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
56
bin/v_del_db_host
Executable file
56
bin/v_del_db_host
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding data base server
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
type="$1"
|
||||||
|
host="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'type host'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'host'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking db type
|
||||||
|
is_type_valid 'db' "$type"
|
||||||
|
|
||||||
|
# Checking host existance
|
||||||
|
is_db_host_valid
|
||||||
|
|
||||||
|
# Checking db host users
|
||||||
|
is_db_host_free
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting host from conf
|
||||||
|
del_dbhost_vesta
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
78
bin/v_del_dns_domain
Executable file
78
bin/v_del_dns_domain
Executable file
|
@ -0,0 +1,78 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deliting dns domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
named_conf=/etc/named.conf
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_dns_domain_value '$TPL')
|
||||||
|
old_ip=$(get_dns_domain_value '$IP')
|
||||||
|
|
||||||
|
# Deleting domain in named.conf
|
||||||
|
rm_string=$(grep -n /etc/namedb/$domain.db $named_conf|cut -d : -f 1)
|
||||||
|
if [ ! -z "$rm_string" ]; then
|
||||||
|
sed -i "$rm_string d" $named_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/etc/namedb/$domain.db" ]; then
|
||||||
|
rm -f /etc/namedb/$domain.db
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Decreasing domain value
|
||||||
|
decrease_user_value "$user" '$U_DNS_DOMAINS'
|
||||||
|
|
||||||
|
# Deleting domain
|
||||||
|
del_dns_domain
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
73
bin/v_del_dns_domain_record
Executable file
73
bin/v_del_dns_domain_record
Executable file
|
@ -0,0 +1,73 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deleting dns record
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
id="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain id'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'id'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
# Checking record valid
|
||||||
|
is_dns_record_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting record
|
||||||
|
conf="$V_USERS/$user/zones/$domain"
|
||||||
|
rm_string=$(grep -n "^ID='$id'" $conf|cut -d : -f 1)
|
||||||
|
if [ ! -z "$rm_string" ]; then
|
||||||
|
sed -i "$rm_string d" $conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sorting records
|
||||||
|
sort_dns_records
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
57
bin/v_del_ssl_certificate
Executable file
57
bin/v_del_ssl_certificate
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/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
|
62
bin/v_del_sys_cron
Executable file
62
bin/v_del_sys_cron
Executable file
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deleting sys cron
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
job="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user job'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'job'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking cron job
|
||||||
|
is_job_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting job
|
||||||
|
del_cron_job
|
||||||
|
|
||||||
|
# Sorting jobs by id
|
||||||
|
sort_cron_jobs
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
90
bin/v_del_sys_ip
Executable file
90
bin/v_del_sys_ip
Executable file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deleting system ip
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
ip="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'ip'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'ip'
|
||||||
|
|
||||||
|
# Checking system ip
|
||||||
|
is_sys_ip_valid "$ip"
|
||||||
|
|
||||||
|
# Checking webdomains on ip
|
||||||
|
is_ip_key_empty '$U_WEB_DOMAINS'
|
||||||
|
|
||||||
|
# Checking users on ip
|
||||||
|
is_ip_key_empty '$U_SYS_USERS'
|
||||||
|
|
||||||
|
# We do not check ownership if
|
||||||
|
# no one actualy use this ip
|
||||||
|
|
||||||
|
# Checking interface
|
||||||
|
interface=$(get_current_interface)
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config paths
|
||||||
|
conf='/etc/httpd/conf.d/vesta.conf'
|
||||||
|
nconf='/etc/nginx/conf.d/vesta_ip.conf'
|
||||||
|
iconf='/etc/sysconfig/network-scripts/ifcfg'
|
||||||
|
rconf='/etc/httpd/conf.d/rpaf.conf'
|
||||||
|
|
||||||
|
# Get ip owner
|
||||||
|
user="$(get_sys_ip_value '$OWNER')"
|
||||||
|
|
||||||
|
# Deleting interface
|
||||||
|
ifconfig "$interface" down
|
||||||
|
|
||||||
|
# Deleting startup script
|
||||||
|
rm -f $iconf-$interface
|
||||||
|
|
||||||
|
# Deleting vesta ip
|
||||||
|
rm -f $V_IPS/$ip
|
||||||
|
|
||||||
|
# Importing main config
|
||||||
|
source $V_CONF/vesta.conf
|
||||||
|
|
||||||
|
# Deleting namehosting support
|
||||||
|
namehost_ip_disable
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Updating user conf
|
||||||
|
if [ ! -z "$user" ]; then
|
||||||
|
decrease_user_value "$user" '$IP_OWNED'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
if [ "$web_restart" = 'yes' ]; then
|
||||||
|
restart_schedule 'web'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
65
bin/v_del_sys_user_ip
Executable file
65
bin/v_del_sys_user_ip
Executable file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deleting user ip
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
ip="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user ip'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'ip'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking user ip
|
||||||
|
is_sys_ip_valid
|
||||||
|
|
||||||
|
# Checking ownership
|
||||||
|
is_sys_ip_owner
|
||||||
|
|
||||||
|
# Checking webdomains on ip
|
||||||
|
is_ip_key_empty '$U_WEB_DOMAINS'
|
||||||
|
|
||||||
|
# Checking users on ip
|
||||||
|
is_ip_key_empty '$U_SYS_USERS'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting owner
|
||||||
|
update_sys_ip_value '$OWNER' ''
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Updating user conf
|
||||||
|
decrease_user_value '$IP_OWNED'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
59
bin/v_del_sys_user_reports
Executable file
59
bin/v_del_sys_user_reports
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding user reports
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking reports existance
|
||||||
|
is_user_value_exist '$REPORTS'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing user report value
|
||||||
|
update_user_value "$user" '$REPORTS' 'no'
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_add_sys_user_reports $user"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
127
bin/v_del_web_domain
Executable file
127
bin/v_del_web_domain
Executable file
|
@ -0,0 +1,127 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deliting web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
old_ip=$(get_web_domain_value '$IP')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Deleting domain
|
||||||
|
httpd_del_config
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Get tpl
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Deleting domain
|
||||||
|
httpd_del_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking stats
|
||||||
|
stats_type=$(get_web_domain_value '$STATS')
|
||||||
|
if [ ! -z "$stats_type" ] && [ "$stats_type" != 'no' ]; then
|
||||||
|
# Parsing pipe line
|
||||||
|
line=$(grep -n "$type.$domain.conf" $V_QUEUE/stats.pipe | \
|
||||||
|
cut -f 1 -d : | head -n 1 )
|
||||||
|
|
||||||
|
# Deleting pipe command
|
||||||
|
if [ ! -z "$line" ]; then
|
||||||
|
sed -i "$line d" $V_QUEUE/stats.pipe
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Deleteing config
|
||||||
|
rm -f $V_HOME/$user/conf/$type.$domain.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Deleting directory
|
||||||
|
rm -rf $V_HOME/$user/domains/$domain
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting domain
|
||||||
|
del_web_domain
|
||||||
|
|
||||||
|
# Checking last ssl domain
|
||||||
|
ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web_domains.conf | wc -l)
|
||||||
|
if [ "$ssl_dom" -eq '0' ]; then
|
||||||
|
sed -i "s/ Include /#Include /" $V_HOME/$user/conf/httpd.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking last domain
|
||||||
|
domains=$(wc -l $V_USERS/$user/web_domains.conf|cut -f 1 -d ' ')
|
||||||
|
if [ "$domains" -eq '0' ]; then
|
||||||
|
conf='/etc/httpd/conf.d/vesta.conf'
|
||||||
|
line=$(grep -n "$V_HOME/$user/conf/httpd.conf" $conf | cut -f 1 -d : )
|
||||||
|
if [ ! -z "$line" ]; then
|
||||||
|
sed -i "$line d" $conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Decreasing ip value
|
||||||
|
decrease_ip_value "$old_ip"
|
||||||
|
|
||||||
|
# Decreasing domain value
|
||||||
|
decrease_user_value "$user" '$U_WEB_DOMAINS'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
117
bin/v_del_web_domain_alias
Executable file
117
bin/v_del_web_domain_alias
Executable file
|
@ -0,0 +1,117 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deliting web domain alias
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
dom_alias=$(idn -t --quiet -u "$3" )
|
||||||
|
dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '3' "$#" 'user domain dom_alias'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'dom_alias'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking alias is added
|
||||||
|
cur_alias=$(get_web_domain_value '$ALIAS')
|
||||||
|
check_alias=$(echo $cur_alias|grep -w "$dom_alias")
|
||||||
|
if [ -z "$check_alias" ]; then
|
||||||
|
echo "Error: alias not exist"
|
||||||
|
log_event 'debug' "$E_DOM_NOTEXIST $V_EVENT"
|
||||||
|
exit $E_DOM_NOTEXIST
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining new alias string
|
||||||
|
new_alias=$(echo "$cur_alias" |\
|
||||||
|
sed -e "s/,/\n/g"|\
|
||||||
|
sed -e "s/^$dom_alias$//g"|\
|
||||||
|
sed -e "/^$/d"|\
|
||||||
|
sed -e ':a;N;$!ba;s/\n/,/g')
|
||||||
|
|
||||||
|
new_alias_idn=$(idn -t --quiet -a "$cur_alias" |\
|
||||||
|
sed -e "s/,/\n/g"|\
|
||||||
|
sed -e "s/^$dom_alias$//g"|\
|
||||||
|
sed -e "/^$/d"|\
|
||||||
|
sed -e ':a;N;$!ba;s/\n/,/g')
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ServerAlias'
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" ServerAlias ${new_alias_idn//,/ }"
|
||||||
|
|
||||||
|
# Deleting alias
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Checking ssl domain
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Defining ssl template
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining ssl config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Deleting ssl alias
|
||||||
|
httpd_change_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting alias
|
||||||
|
update_web_domain_value '$ALIAS' "$new_alias"
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_add_web_domain_alias $user $domain $dom_alias"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
122
bin/v_del_web_domain_cgi
Executable file
122
bin/v_del_web_domain_cgi
Executable file
|
@ -0,0 +1,122 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deliting cgi for domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking cgi is added
|
||||||
|
is_web_domain_value_exist '$CGI'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ScriptAlias '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" #ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin"
|
||||||
|
|
||||||
|
# Deleting cgi-bin support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='Options '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=' Options +Includes -Indexes -ExecCGI'
|
||||||
|
|
||||||
|
# Deleting execscgi support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Get ssl template name
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining ssl config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ScriptAlias '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" #ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin"
|
||||||
|
|
||||||
|
# Deleting cgi-bin support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='Options '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=' Options +Includes -Indexes -ExecCGI'
|
||||||
|
|
||||||
|
# Deleting execscgi support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting cgi in config
|
||||||
|
update_web_domain_value '$CGI' 'no'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_add_web_domain_cgi $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
98
bin/v_del_web_domain_elog
Executable file
98
bin/v_del_web_domain_elog
Executable file
|
@ -0,0 +1,98 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deleting error log for domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid "$user"
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Check errorlog is added
|
||||||
|
is_web_domain_value_exist '$ELOG'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='ErrorLog '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" #ErrorLog /var/log/httpd/domains/$domain.error.log"
|
||||||
|
|
||||||
|
# Deleting errolog support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
|
||||||
|
# Get ssl template name
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining ssl config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Deleting errolog support
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Deleting elog in config
|
||||||
|
update_web_domain_value '$ELOG' 'no'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_add_web_domain_elog $user $domain"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
93
bin/v_del_web_domain_ssl
Executable file
93
bin/v_del_web_domain_ssl
Executable file
|
@ -0,0 +1,93 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: deliting web domain ssl
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking ssl is added
|
||||||
|
is_web_domain_value_exist '$SSL'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Deleting domain
|
||||||
|
httpd_del_config
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get old values
|
||||||
|
cert=$(get_web_domain_value '$SSL_CERT' )
|
||||||
|
tpl_option=$(get_web_domain_value '$SSL_HOME' )
|
||||||
|
|
||||||
|
# Deleting ssl in config
|
||||||
|
update_web_domain_value '$SSL' 'no'
|
||||||
|
update_web_domain_value '$SSL_HOME' ''
|
||||||
|
update_web_domain_value '$SSL_CERT' ''
|
||||||
|
|
||||||
|
# Checking last ssl domain
|
||||||
|
ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web_domains.conf | wc -l)
|
||||||
|
main_conf='/etc/httpd/conf.d/vesta.conf'
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
if [ "$ssl_dom" -eq '0' ]; then
|
||||||
|
sed -i "/Include ${conf////\/}/d" $main_conf
|
||||||
|
rm -f $conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Decreasing domain value
|
||||||
|
decrease_user_value "$user" '$U_WEB_SSL'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_add_web_domain_ssl $user $domain $cert $tpl_option"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
84
bin/v_del_web_domain_stat
Executable file
84
bin/v_del_web_domain_stat
Executable file
|
@ -0,0 +1,84 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking stats enabled
|
||||||
|
is_web_domain_value_exist '$STATS'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining statistic type
|
||||||
|
type=$(get_web_domain_value '$STATS')
|
||||||
|
|
||||||
|
# Defining statistic dir
|
||||||
|
stat_dir="$V_HOME/$user/domains/$domain/stats"
|
||||||
|
|
||||||
|
# Deleting dir content
|
||||||
|
rm -rf $stat_dir/*
|
||||||
|
|
||||||
|
# Deleting config
|
||||||
|
rm -f $V_HOME/$user/conf/$type.$domain.conf
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Parsing pipe line
|
||||||
|
line=$(grep -n "$type.$domain.conf" $V_QUEUE/stats.pipe | \
|
||||||
|
cut -f 1 -d : | head -n 1 )
|
||||||
|
|
||||||
|
# Deleting pipe command
|
||||||
|
if [ ! -z "$line" ]; then
|
||||||
|
sed -i "$line d" $V_QUEUE/stats.pipe
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Deleting stats
|
||||||
|
update_web_domain_value '$STATS' ''
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
105
bin/v_del_web_domain_stat_auth
Executable file
105
bin/v_del_web_domain_stat_auth
Executable file
|
@ -0,0 +1,105 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: adding web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
auth_user="$3"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain [auth_user]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking stats auth enabled
|
||||||
|
is_web_domain_value_exist '$STATS_AUTH'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Definining statistic dir
|
||||||
|
stat_dir="$V_HOME/$user/domains/$domain/stats"
|
||||||
|
|
||||||
|
# Checking auth_user
|
||||||
|
if [ ! -z "$auth_user" ]; then
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'auth_user'
|
||||||
|
|
||||||
|
htpasswd -D $stat_dir/.htpasswd "$auth_user" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking htpasswd current users
|
||||||
|
lines=$(wc -l $stat_dir/.htpasswd |cut -f 1 -d ' ')
|
||||||
|
if [ -z "$auth_user" ] || [ "$lines" -eq '0' ]; then
|
||||||
|
rm -f $stat_dir/.htpasswd
|
||||||
|
rm -f $stat_dir/.htaccess
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking auth_user
|
||||||
|
if [ ! -z "$auth_user" ]; then
|
||||||
|
# Get current value
|
||||||
|
curr_val=$(get_web_domain_value '$STATS_AUTH')
|
||||||
|
|
||||||
|
# Deleteting auth_user
|
||||||
|
new_val=$(echo "$curr_val" |\
|
||||||
|
sed -e "s/,/\n/g"|\
|
||||||
|
sed -e "s/^$auth_user$//g"|\
|
||||||
|
sed -e "/^$/d"|\
|
||||||
|
sed -e ':a;N;$!ba;s/\n/,/g')
|
||||||
|
|
||||||
|
# Checking it was last user
|
||||||
|
if [ -z "$new_val" ]; then
|
||||||
|
new_val=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
# User empty, deleting all
|
||||||
|
new_val=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Deleting stats auth_user
|
||||||
|
update_web_domain_value '$STATS_AUTH' "$new_val"
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "$V_EVENT"
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
57
bin/v_get_dns_domain_value
Executable file
57
bin/v_get_dns_domain_value
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Getting dns domain value
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '3' "$#" 'user domain key'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking key
|
||||||
|
value=$(get_dns_domain_value "$key")
|
||||||
|
|
||||||
|
# Printing value
|
||||||
|
echo "$value"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
52
bin/v_get_sys_user_value
Executable file
52
bin/v_get_sys_user_value
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Getting system user value
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '2' "$#" 'user key'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking key
|
||||||
|
value=$(get_user_value "$key")
|
||||||
|
|
||||||
|
# Printing value
|
||||||
|
echo "$value"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
60
bin/v_get_web_domain_value
Executable file
60
bin/v_get_web_domain_value
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Getting web domain value
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '3' "$#" 'user domain key'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking key
|
||||||
|
value=$(get_web_domain_value "$key")
|
||||||
|
|
||||||
|
# Printing value
|
||||||
|
echo "$value"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
61
bin/v_list_db_base
Executable file
61
bin/v_list_db_base
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing data base
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
database="$2"
|
||||||
|
format="${3-shell}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '2' "$#" 'user db_name [format]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'database'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking database exist
|
||||||
|
is_db_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/db.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE'
|
||||||
|
|
||||||
|
# Listing database
|
||||||
|
case $format in
|
||||||
|
json) db_json_single_list ;;
|
||||||
|
shell) db_shell_single_list | column -t ;;
|
||||||
|
*) check_args '2' "0" 'user database [format]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_list_db_bases
Executable file
58
bin/v_list_db_bases
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing data bases
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/db.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE'
|
||||||
|
|
||||||
|
# Listing databases
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) v_shell_list| column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
61
bin/v_list_db_host
Executable file
61
bin/v_list_db_host
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing data base servers
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
type="$1"
|
||||||
|
host="$2"
|
||||||
|
format="${3-shell}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '2' "$#" 'type host [format]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'host'
|
||||||
|
|
||||||
|
# Checking db type
|
||||||
|
is_type_valid 'db' "$type"
|
||||||
|
|
||||||
|
# Checking db host
|
||||||
|
is_db_host_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config type
|
||||||
|
conf="$V_DB/$type.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$HOST $PORT $MAX_USERS $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'
|
||||||
|
|
||||||
|
# Listing database
|
||||||
|
case $format in
|
||||||
|
json) dbhost_json_single_list ;;
|
||||||
|
shell) dbhost_shell_single_list | column -t;;
|
||||||
|
*) check_args '2' "0" 'type host [format]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
60
bin/v_list_db_hosts
Executable file
60
bin/v_list_db_hosts
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing data base servers
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
type="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'type [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking db type
|
||||||
|
is_type_valid 'db' "$type"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config type
|
||||||
|
conf="$V_DB/$type.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$HOST $PORT $MAX_USERS $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'
|
||||||
|
|
||||||
|
# Listing database
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) fields='$HOST $PORT $MAX_USERS $MAX_DB $U_DB_BASES $ACTIVE $DATE';
|
||||||
|
v_shell_list | column -t ;;
|
||||||
|
*) check_args '2' "0" 'type [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
64
bin/v_list_dns_domain
Executable file
64
bin/v_list_dns_domain
Executable file
|
@ -0,0 +1,64 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing dns domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
format="${3-shell}"
|
||||||
|
limit="${4-1000}"
|
||||||
|
offset="${5-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '2' "$#" 'user domain [format]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/zones/$domain"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$ID $RECORD $TYPE $VALUE $SUSPEND $DATE'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) dns_json_list ;;
|
||||||
|
shell) fields='$ID $RECORD $TYPE $VALUE';
|
||||||
|
dns_shell_list | column -t ;;
|
||||||
|
*) check_args '2' "0" 'user domain [format]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
60
bin/v_list_dns_domains
Executable file
60
bin/v_list_dns_domains
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing dns domains
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/dns.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $SUSPEND $DATE'
|
||||||
|
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) fields='$DOMAIN $IP $TPL $TTL $EXP $SUSPEND';
|
||||||
|
v_shell_list| column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
44
bin/v_list_dns_templates
Executable file
44
bin/v_list_dns_templates
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing dns templates
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
format="${1-shell}"
|
||||||
|
limit="${2-1000}"
|
||||||
|
offset="${3-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'limit' 'offset'
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) dnstpl_json_list ;;
|
||||||
|
shell) dnstpl_shell_list ;;
|
||||||
|
*) check_args '1' "0" '[format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
52
bin/v_list_ssl_certificates
Executable file
52
bin/v_list_ssl_certificates
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing ssl certificates
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cert_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) cert_json_list ;;
|
||||||
|
shell) cert_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
61
bin/v_list_sys_cron
Executable file
61
bin/v_list_sys_cron
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing user cron
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/crontab.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$JOB $MIN $HOUR $DAY $MONTH $WDAY $CMD $SUSPEND $DATE'
|
||||||
|
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) crn_json_list ;;
|
||||||
|
shell) fields='$JOB~$SUSPEND~$MIN~$HOUR~$DAY~$MONTH~$WDAY~$CMD';
|
||||||
|
crn_shell_list |column -t -s '~';;
|
||||||
|
*) check_args '1' '0' 'user [format] [limit] [offset]' ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
46
bin/v_list_sys_interfaces
Executable file
46
bin/v_list_sys_interfaces
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing system interfaces
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
format="${1-shell}"
|
||||||
|
limit="${2-1000}"
|
||||||
|
offset="${3-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'limit' 'offset'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) ipint_json_list ;;
|
||||||
|
shell) ipint_shell_list ;;
|
||||||
|
*) check_args '1' '0' '[format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
54
bin/v_list_sys_ip
Executable file
54
bin/v_list_sys_ip
Executable file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing system ip
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
ip="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'ip [format]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'ip'
|
||||||
|
|
||||||
|
# Checking ip
|
||||||
|
is_sys_ip_valid
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS
|
||||||
|
$INTERFACE $NETMASK $DATE'
|
||||||
|
|
||||||
|
# Listing ip
|
||||||
|
case $format in
|
||||||
|
json) ip_json_single_list ;;
|
||||||
|
shell) ip_shell_single_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'ip [format]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
51
bin/v_list_sys_ips
Executable file
51
bin/v_list_sys_ips
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing system users
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
format="${1-shell}"
|
||||||
|
limit="${2-1000}"
|
||||||
|
offset="${3-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'limit' 'offset'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS
|
||||||
|
$INTERFACE $NETMASK $DATE'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) ip_json_list ;;
|
||||||
|
shell) fields='$IP $NETMASK $OWNER $STATUS $U_WEB_DOMAINS';
|
||||||
|
ip_shell_list | column -t ;;
|
||||||
|
*) check_args '1' '0' '[format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
60
bin/v_list_sys_user
Executable file
60
bin/v_list_sys_user
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing system user
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/user.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
|
||||||
|
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
|
||||||
|
$BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $TEMPLATES $MAX_CHILDS $SUSPENDED
|
||||||
|
$OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS
|
||||||
|
$U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE'
|
||||||
|
|
||||||
|
# Listing user
|
||||||
|
case $format in
|
||||||
|
json) usr_json_single_list ;;
|
||||||
|
shell) usr_shell_single_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_list_sys_user_ips
Executable file
58
bin/v_list_sys_user_ips
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing user ips
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get user owner
|
||||||
|
owner=$(get_user_value '$OWNER')
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$IP $OWNER $STATUS $NAME'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) ip_user_json_list ;;
|
||||||
|
shell) ip_user_shell_list | column -t ;;
|
||||||
|
*) check_args '1' '0' 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
50
bin/v_list_sys_user_ns
Executable file
50
bin/v_list_sys_user_ns
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing user nameservers
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Listing nameservers
|
||||||
|
case $format in
|
||||||
|
json) usrns_json_list ;;
|
||||||
|
shell) usrns_shell_list ;;
|
||||||
|
*) check_args '1' '0' 'user [format]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
50
bin/v_list_sys_user_packages
Executable file
50
bin/v_list_sys_user_packages
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing sys user packages
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
format="${1-shell}"
|
||||||
|
limit="${2-1000}"
|
||||||
|
offset="${3-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'limit' 'offset'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining fields
|
||||||
|
fields='$PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES $MAIL_DOMAINS
|
||||||
|
$MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA $BANDWIDTH $NS1 $NS2
|
||||||
|
$SHELL $BACKUPS $TEMPLATES $MAX_CHILDS'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) pkg_json_list ;;
|
||||||
|
shell) pkg_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" '[format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
52
bin/v_list_sys_users
Executable file
52
bin/v_list_sys_users
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing system users
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
format="${1-shell}"
|
||||||
|
limit="${2-1000}"
|
||||||
|
offset="${3-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'limit' 'offset'
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
|
||||||
|
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
|
||||||
|
$BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $TEMPLATES $MAX_CHILDS $SUSPENDED
|
||||||
|
$OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS
|
||||||
|
$U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) usr_json_list ;;
|
||||||
|
shell) fields='$USER $PACKAGE $U_DISK $U_BANDWIDTH $SUSPENDED $DATE';
|
||||||
|
usr_shell_list | column -t ;;
|
||||||
|
*) check_args '1' '0' '[format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
59
bin/v_list_web_domain
Executable file
59
bin/v_list_web_domain
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
format="${3-shell}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '2' "$#" 'user domain [format]'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS
|
||||||
|
$STATS_AUTH $SSL $SSL_HOME $SSL_CERT $NGINX $NGINX_EXT $SUSPEND $DATE'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) dom_json_single_list ;;
|
||||||
|
shell) dom_shell_single_list | column -t ;;
|
||||||
|
*) check_args '2' "0" 'user domain [format]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
61
bin/v_list_web_domains
Executable file
61
bin/v_list_web_domains
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web domains
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS
|
||||||
|
$STATS_AUTH $SSL $SSL_HOME $SSL_CERT $NGINX $NGINX_EXT $SUSPEND $DATE'
|
||||||
|
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $DATE';
|
||||||
|
v_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_list_web_domains_alias
Executable file
58
bin/v_list_web_domains_alias
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web domains
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $ALIAS'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) v_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_list_web_domains_elog
Executable file
58
bin/v_list_web_domains_elog
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $ELOG'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) v_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_list_web_domains_nginx
Executable file
58
bin/v_list_web_domains_nginx
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web domains
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $NGINX'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) v_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_list_web_domains_ssl
Executable file
58
bin/v_list_web_domains_ssl
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $SSL $SSL_HOME $SSL_CERT'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) v_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
58
bin/v_list_web_domains_stats
Executable file
58
bin/v_list_web_domains_stats
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking args
|
||||||
|
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$DOMAIN $STATS $STATS_AUTH'
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) v_json_list ;;
|
||||||
|
shell) v_shell_list | column -t ;;
|
||||||
|
*) check_args '1' "0" 'user [format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
56
bin/v_list_web_templates
Executable file
56
bin/v_list_web_templates
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: listing web templates
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
format="${2-shell}"
|
||||||
|
limit="${3-1000}"
|
||||||
|
offset="${4-1}"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'limit' 'offset'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get user package package
|
||||||
|
templates=$(get_user_value '$TEMPLATES')
|
||||||
|
|
||||||
|
# Listing domains
|
||||||
|
case $format in
|
||||||
|
json) webtpl_json_list ;;
|
||||||
|
shell) webtpl_shell_list ;;
|
||||||
|
*) check_args '1' "0" '[format] [limit] [offset]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
164
bin/v_rebuild_web_domain
Executable file
164
bin/v_rebuild_web_domain
Executable file
|
@ -0,0 +1,164 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: rebuilding web domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
ip="$3"
|
||||||
|
template=$4
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
source $V_FUNC/ip_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain [ip] [template]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking user is active
|
||||||
|
is_user_suspended
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
# Checking ip
|
||||||
|
if [ -n "$ip" ]; then
|
||||||
|
format_validation 'ip'
|
||||||
|
is_ip_avalable
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking template
|
||||||
|
if [ -n "$template" ]; then
|
||||||
|
format_validation 'template'
|
||||||
|
templates=$(get_user_value '$TEMPLATES')
|
||||||
|
is_template_valid "web"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining domain aliases
|
||||||
|
ip_name=$(get_ip_name)
|
||||||
|
ip_name_idn=$(idn -t --quiet -a "$ip_name")
|
||||||
|
domain_alias="www.$domain"
|
||||||
|
domain_alias_idn="www.$domain_idn"
|
||||||
|
if [ ! -z "$ip_name" ]; then
|
||||||
|
domain_alias_dash="${domain//./-}.$ip_name"
|
||||||
|
domain_alias_dash_idn="${domain_idn//./-}.$ip_name_idn"
|
||||||
|
aliases="$domain_alias,$domain_alias_dash"
|
||||||
|
aliases_idn="$domain_alias_idn,$domain_alias_dash_idn"
|
||||||
|
else
|
||||||
|
aliases="$domain_alias"
|
||||||
|
aliases_idn="$domain_alias_idn"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defining vars for httpd_add_config function
|
||||||
|
port=$(get_web_port)
|
||||||
|
group="$user"
|
||||||
|
email="$user@$domain"
|
||||||
|
docroot="$V_HOME/$user/domains/$domain/public_html"
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
tpl_file="$V_WEBTPL/apache_$template.tpl"
|
||||||
|
|
||||||
|
# Adding domain to the httpd.conf
|
||||||
|
httpd_add_config
|
||||||
|
|
||||||
|
# Building directory tree
|
||||||
|
if [ ! -e $V_HOME/$user/domains/$domain ]; then
|
||||||
|
mkdir $V_HOME/$user/domains/$domain \
|
||||||
|
$V_HOME/$user/domains/$domain/public_html \
|
||||||
|
$V_HOME/$user/domains/$domain/public_shtml \
|
||||||
|
$V_HOME/$user/domains/$domain/document_errors \
|
||||||
|
$V_HOME/$user/domains/$domain/cgi-bin \
|
||||||
|
$V_HOME/$user/domains/$domain/private \
|
||||||
|
$V_HOME/$user/domains/$domain/stats \
|
||||||
|
$V_HOME/$user/domains/$domain/logs
|
||||||
|
|
||||||
|
# Adding domain skeleton
|
||||||
|
cp -r $V_WEBTPL/skel/public_html/ $V_HOME/$user/domains/$domain/
|
||||||
|
cp -r $V_WEBTPL/skel/public_shtml/ $V_HOME/$user/domains/$domain/
|
||||||
|
cp -r $V_WEBTPL/skel/document_errors/ $V_HOME/$user/domains/$domain/
|
||||||
|
cp -r $V_WEBTPL/skel/cgi-bin/ $V_HOME/$user/domains/$domain/
|
||||||
|
|
||||||
|
# Changing tpl values
|
||||||
|
for file in $(find "$V_HOME/$user/domains/$domain/" -type f); do
|
||||||
|
sed -i "s/%domain%/$domain/g" $file
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding domain logs
|
||||||
|
touch /var/log/httpd/domains/$domain.bytes \
|
||||||
|
/var/log/httpd/domains/$domain.log \
|
||||||
|
/var/log/httpd/domains/$domain.error_log
|
||||||
|
|
||||||
|
# Adding symlink for logs
|
||||||
|
ln -s /var/log/httpd/domains/$domain.*log $V_HOME/$user/domains/$domain/logs/
|
||||||
|
|
||||||
|
# Changing file owner
|
||||||
|
chown -R $user:$user $V_HOME/$user/domains/$domain
|
||||||
|
chown root:$user /var/log/httpd/domains/$domain.*
|
||||||
|
|
||||||
|
# Changing file permissions
|
||||||
|
chmod 551 $V_HOME/$user/domains/$domain
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/private
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/cgi-bin
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/public_html
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/public_shtml
|
||||||
|
chmod 751 $V_HOME/$user/domains/$domain/document_errors
|
||||||
|
chmod -f -R 775 $V_HOME/$user/domains/$domain/cgi-bin/*
|
||||||
|
chmod -f -R 775 $V_HOME/$user/domains/$domain/public_html/*
|
||||||
|
chmod -f -R 775 $V_HOME/$user/domains/$domain/document_errors/*
|
||||||
|
chmod 551 $V_HOME/$user/domains/$domain/stats
|
||||||
|
chmod 551 $V_HOME/$user/domains/$domain/logs
|
||||||
|
chmod 640 /var/log/httpd/domains/$domain.*
|
||||||
|
|
||||||
|
# Running template post setup file
|
||||||
|
if [ -e $V_WEBTPL/apache_$template.sh ]; then
|
||||||
|
$V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checking main vesta httpd config
|
||||||
|
main_conf='/etc/httpd/conf.d/vesta.conf'
|
||||||
|
main_conf_check=$(grep "$conf" $main_conf )
|
||||||
|
if [ -z "$main_conf_check" ]; then
|
||||||
|
echo "Include $conf" >>$main_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta piped
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
67
bin/v_suspend_db_base
Executable file
67
bin/v_suspend_db_base
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Suspending databse
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
database="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user db_name'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'database'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking db existance
|
||||||
|
is_db_valid
|
||||||
|
|
||||||
|
# Checking db is active
|
||||||
|
is_db_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Define database variables
|
||||||
|
db_user=$(get_db_value '$USER')
|
||||||
|
host=$(get_db_value '$HOST')
|
||||||
|
type=$(get_db_value '$TYPE')
|
||||||
|
|
||||||
|
# Switching on db type
|
||||||
|
case $type in
|
||||||
|
mysql) suspend_db_mysql ;;
|
||||||
|
pgsql) suspend_db_pgsql ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Updating db value
|
||||||
|
update_db_base_value '$SUSPEND' 'yes'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
74
bin/v_suspend_db_bases
Executable file
74
bin/v_suspend_db_bases
Executable file
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Suspending databses
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/db.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
field='$DB'
|
||||||
|
|
||||||
|
# Defining search string
|
||||||
|
search_string="SUSPEND='no'"
|
||||||
|
|
||||||
|
# Parsing unsuspeneded domains
|
||||||
|
databases=$(db_clear_search)
|
||||||
|
|
||||||
|
for database in $databases; do
|
||||||
|
# Define database variables
|
||||||
|
db_user=$(get_db_value '$USER')
|
||||||
|
host=$(get_db_value '$HOST')
|
||||||
|
type=$(get_db_value '$TYPE')
|
||||||
|
|
||||||
|
# Switching on db type
|
||||||
|
case $type in
|
||||||
|
mysql) suspend_db_mysql ;;
|
||||||
|
pgsql) suspend_db_pgsql ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Updating db value
|
||||||
|
update_db_base_value '$SUSPEND' 'yes'
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
67
bin/v_suspend_dns_domain
Executable file
67
bin/v_suspend_dns_domain
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: suspening dns domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="/etc/named.conf"
|
||||||
|
|
||||||
|
rm_string=$(grep -n /etc/namedb/$domain.db $conf|cut -d : -f 1)
|
||||||
|
if [ ! -z "$rm_string" ]; then
|
||||||
|
sed -i "$rm_string d" $conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding suspend in config
|
||||||
|
update_dns_domain_value '$SUSPEND' 'yes'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
73
bin/v_suspend_dns_domains
Executable file
73
bin/v_suspend_dns_domains
Executable file
|
@ -0,0 +1,73 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: suspening dns domains
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking dns system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/dns.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
field='$DOMAIN'
|
||||||
|
|
||||||
|
# Defining search string
|
||||||
|
search_string="SUSPEND='no'"
|
||||||
|
|
||||||
|
# Parsing unsuspeneded domains
|
||||||
|
domains=$(dom_clear_search)
|
||||||
|
|
||||||
|
# Starting suspend loop
|
||||||
|
for domain in $domains; do
|
||||||
|
# Defining named config
|
||||||
|
conf="/etc/named.conf"
|
||||||
|
rm_string=$(grep -n /etc/namedb/$domain.db $conf|cut -d : -f 1)
|
||||||
|
if [ ! -z "$rm_string" ]; then
|
||||||
|
sed -i "$rm_string d" $conf
|
||||||
|
fi
|
||||||
|
# Adding suspend in config
|
||||||
|
update_dns_domain_value '$SUSPEND' 'yes'
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
59
bin/v_suspend_sys_cron_job
Executable file
59
bin/v_suspend_sys_cron_job
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Suspending sys cron
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
job="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user job'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'job'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking cron job
|
||||||
|
is_job_valid
|
||||||
|
|
||||||
|
# Checking suspend status
|
||||||
|
is_job_suspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Suspending job
|
||||||
|
update_cron_job_value '$SUSPEND' 'yes'
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
60
bin/v_suspend_sys_cron_jobs
Executable file
60
bin/v_suspend_sys_cron_jobs
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Suspending sys cron jobs
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Searching jobs
|
||||||
|
conf="$V_USERS/$user/crontab.conf"
|
||||||
|
field='$JOB'
|
||||||
|
search_string="SUSPEND='no'"
|
||||||
|
jobs=$(cron_clear_search)
|
||||||
|
|
||||||
|
# Suspendning
|
||||||
|
for job in $jobs; do
|
||||||
|
update_cron_job_value '$SUSPEND' 'yes'
|
||||||
|
done
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs "$user"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
94
bin/v_suspend_web_domain
Executable file
94
bin/v_suspend_web_domain
Executable file
|
@ -0,0 +1,94 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: suspening web domain (with ssl)
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
# Defining url
|
||||||
|
url="${3-$V_SUSPEND_URL}"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain [suspend_url]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain' 'url'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Checking domain is not suspened
|
||||||
|
is_domain_suspended 'web_domains'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='DocumentRoot '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" Redirect / http://$url/"
|
||||||
|
|
||||||
|
# Suspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Check ssl vhost
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
# Defining teplate name
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Reefining replace string - old str_repl contains escaped chars
|
||||||
|
str_repl=" Redirect / http://$url/"
|
||||||
|
|
||||||
|
# Suspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding suspend in config
|
||||||
|
update_web_domain_value '$SUSPEND' 'yes'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
104
bin/v_suspend_web_domains
Executable file
104
bin/v_suspend_web_domains
Executable file
|
@ -0,0 +1,104 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: suspening web domains (with ssl)
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
# Defining url
|
||||||
|
url="${2-$V_SUSPEND_URL}"
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user [suspend_url]'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'url'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
field='$DOMAIN'
|
||||||
|
|
||||||
|
# Defining search string
|
||||||
|
search_string="SUSPEND='no'"
|
||||||
|
|
||||||
|
# Parsing unsuspeneded domains
|
||||||
|
domains=$(dom_clear_search)
|
||||||
|
|
||||||
|
# Starting suspend loop
|
||||||
|
for domain in $domains; do
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='DocumentRoot '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" Redirect / http://$url/"
|
||||||
|
|
||||||
|
# Suspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Check ssl vhost
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
# Defining teplate name
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Reefining replace string - old str_repl contains escaped chars
|
||||||
|
str_repl=" Redirect / http://$url/"
|
||||||
|
|
||||||
|
# Suspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding suspend in config
|
||||||
|
update_web_domain_value '$SUSPEND' 'yes'
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
67
bin/v_unsuspend_db_base
Executable file
67
bin/v_unsuspend_db_base
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Unsuspending databse
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
database="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user db_name'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'database'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking db existance
|
||||||
|
is_db_valid
|
||||||
|
|
||||||
|
# Checking db is active
|
||||||
|
is_db_unsuspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Define database variables
|
||||||
|
db_user=$(get_db_value '$USER')
|
||||||
|
host=$(get_db_value '$HOST')
|
||||||
|
type=$(get_db_value '$TYPE')
|
||||||
|
|
||||||
|
# Switching on db type
|
||||||
|
case $type in
|
||||||
|
mysql) unsuspend_db_mysql ;;
|
||||||
|
pgsql) unsuspend_db_pgsql ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Updating db value
|
||||||
|
update_db_base_value '$SUSPEND' 'no'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
74
bin/v_unsuspend_db_bases
Executable file
74
bin/v_unsuspend_db_bases
Executable file
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Unsuspending databses
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/db_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking db system is enabled
|
||||||
|
is_system_enabled 'db'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/db.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
field='$DB'
|
||||||
|
|
||||||
|
# Defining search string
|
||||||
|
search_string="SUSPEND='yes'"
|
||||||
|
|
||||||
|
# Parsing unsuspeneded domains
|
||||||
|
databases=$(db_clear_search)
|
||||||
|
|
||||||
|
for database in $databases; do
|
||||||
|
# Define database variables
|
||||||
|
db_user=$(get_db_value '$USER')
|
||||||
|
host=$(get_db_value '$HOST')
|
||||||
|
type=$(get_db_value '$TYPE')
|
||||||
|
|
||||||
|
# Switching on db type
|
||||||
|
case $type in
|
||||||
|
mysql) unsuspend_db_mysql ;;
|
||||||
|
pgsql) unsuspend_db_pgsql ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Updating db value
|
||||||
|
update_db_base_value '$SUSPEND' 'no'
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
65
bin/v_unsuspend_dns_domain
Executable file
65
bin/v_unsuspend_dns_domain
Executable file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: unsuspening dns domain
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_dns_domain_valid
|
||||||
|
|
||||||
|
# Check domain is suspened
|
||||||
|
is_domain_unsuspended 'dns'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="/etc/named.conf"
|
||||||
|
|
||||||
|
# Adding zone in named.conf
|
||||||
|
nmd_rec="zone \"$domain\" { type master; file \"/etc/namedb/$domain.db\"; };"
|
||||||
|
echo "$nmd_rec" >> $conf
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Unsuspending domain in config
|
||||||
|
update_dns_domain_value '$SUSPEND' 'no'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
77
bin/v_unsuspend_dns_domains
Executable file
77
bin/v_unsuspend_dns_domains
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: unsuspening dns domains
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking dns system is enabled
|
||||||
|
is_system_enabled 'dns'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/dns.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
field='$DOMAIN'
|
||||||
|
|
||||||
|
# Defining search string
|
||||||
|
search_string="SUSPEND='yes'"
|
||||||
|
|
||||||
|
# Parsing suspeneded domains
|
||||||
|
domains=$(dom_clear_search)
|
||||||
|
|
||||||
|
|
||||||
|
# Starting unsuspend loop
|
||||||
|
for domain in $domains; do
|
||||||
|
|
||||||
|
# Defining named config
|
||||||
|
conf="/etc/named.conf"
|
||||||
|
|
||||||
|
# Adding zone in named.conf
|
||||||
|
rec="zone \"$domain\" { type master; file \"/etc/namedb/$domain.db\"; };"
|
||||||
|
echo "$rec" >> $conf
|
||||||
|
|
||||||
|
# Unsuspendin in config
|
||||||
|
update_dns_domain_value '$SUSPEND' 'no'
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'dns'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
59
bin/v_unsuspend_sys_cron_job
Executable file
59
bin/v_unsuspend_sys_cron_job
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Unuspending sys cron
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
job="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user job'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'job'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking cron job
|
||||||
|
is_job_valid
|
||||||
|
|
||||||
|
# Check job is suspened
|
||||||
|
is_job_unsuspended
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Unsuspending job
|
||||||
|
update_cron_job_value '$SUSPEND' 'no'
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
60
bin/v_unsuspend_sys_cron_jobs
Executable file
60
bin/v_unsuspend_sys_cron_jobs
Executable file
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: Unuspending sys cron
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/cron_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Searching jobs
|
||||||
|
conf="$V_USERS/$user/crontab.conf"
|
||||||
|
field='$JOB'
|
||||||
|
search_string="SUSPEND='yes'"
|
||||||
|
jobs=$(cron_clear_search)
|
||||||
|
|
||||||
|
# Unsuspendning jobs
|
||||||
|
for job in $jobs; do
|
||||||
|
update_cron_job_value '$SUSPEND' 'no'
|
||||||
|
done
|
||||||
|
|
||||||
|
# Sync system cron with user
|
||||||
|
sync_cron_jobs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'cron'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
98
bin/v_unsuspend_web_domain
Executable file
98
bin/v_unsuspend_web_domain
Executable file
|
@ -0,0 +1,98 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: unsuspening web domain (with ssl)
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
domain="$2"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '2' "$#" 'user domain'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user' 'domain'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
# Checking domain exist
|
||||||
|
is_web_domain_valid
|
||||||
|
|
||||||
|
# Check domain is suspened
|
||||||
|
is_domain_unsuspended 'web_domains'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='Redirect / '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" DocumentRoot $V_HOME/$user/domains/$domain/public_html"
|
||||||
|
|
||||||
|
# Unsuspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Check ssl vhost
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
# Defining teplate name and ssl documentroot option
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
tpl_option=$(get_web_domain_value '$SSL_HOME')
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Switching on option
|
||||||
|
case $tpl_option in
|
||||||
|
single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
|
||||||
|
*) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" DocumentRoot $docroot"
|
||||||
|
|
||||||
|
# Unsuspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding suspend in config
|
||||||
|
update_web_domain_value '$SUSPEND' 'no'
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
107
bin/v_unsuspend_web_domains
Executable file
107
bin/v_unsuspend_web_domains
Executable file
|
@ -0,0 +1,107 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: unsuspening web domain (with ssl)
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user="$1"
|
||||||
|
|
||||||
|
# Importing variables
|
||||||
|
source $VESTA/conf/vars.conf
|
||||||
|
source $V_FUNC/shared_func.sh
|
||||||
|
source $V_FUNC/domain_func.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Checking arg number
|
||||||
|
check_args '1' "$#" 'user'
|
||||||
|
|
||||||
|
# Checking argument format
|
||||||
|
format_validation 'user'
|
||||||
|
|
||||||
|
# Checking web system is enabled
|
||||||
|
is_system_enabled 'web'
|
||||||
|
|
||||||
|
# Checking user
|
||||||
|
is_user_valid
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_USERS/$user/web_domains.conf"
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
field='$DOMAIN'
|
||||||
|
|
||||||
|
# Defining search string
|
||||||
|
search_string="SUSPEND='yes'"
|
||||||
|
|
||||||
|
# Parsing suspeneded domains
|
||||||
|
domains=$(dom_clear_search)
|
||||||
|
|
||||||
|
# Starting unsuspend loop
|
||||||
|
for domain in $domains; do
|
||||||
|
|
||||||
|
# Get template name
|
||||||
|
tpl_name=$(get_web_domain_value '$TPL')
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/httpd.conf"
|
||||||
|
|
||||||
|
# Defining search phrase
|
||||||
|
search_phrase='Redirect / '
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" DocumentRoot $V_HOME/$user/domains/$domain/public_html"
|
||||||
|
|
||||||
|
# Unsuspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
|
||||||
|
# Check ssl vhost
|
||||||
|
ssl=$(get_web_domain_value '$SSL')
|
||||||
|
if [ "$ssl" = 'yes' ]; then
|
||||||
|
# Defining teplate name and ssl documentroot option
|
||||||
|
tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
|
||||||
|
tpl_opt=$(get_web_domain_value '$SSL_HOME')
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
conf="$V_HOME/$user/conf/shttpd.conf"
|
||||||
|
|
||||||
|
# Switching on option
|
||||||
|
case $tpl_opt in
|
||||||
|
single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
|
||||||
|
*) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Defining replace string
|
||||||
|
str_repl=" DocumentRoot $docroot"
|
||||||
|
|
||||||
|
# Unsuspending vhost
|
||||||
|
httpd_change_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding unsuspend in config
|
||||||
|
update_web_domain_value '$SUSPEND' 'no'
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Adding task to the vesta pipe
|
||||||
|
restart_schedule 'web'
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
exit $OK
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue