diff --git a/bin/v-acknowledge-user-notification b/bin/v-acknowledge-user-notification index 84823d27..19ea65f8 100755 --- a/bin/v-acknowledge-user-notification +++ b/bin/v-acknowledge-user-notification @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER NOTIFICATION' -validate_format 'user' 'nid' +is_format_valid 'user' 'nid' is_object_valid 'user' 'USER' "$user" @@ -61,6 +61,6 @@ if [ "$notice" = 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-activate-vesta-license b/bin/v-activate-vesta-license index f6cc05e0..6d5c875e 100755 --- a/bin/v-activate-vesta-license +++ b/bin/v-activate-vesta-license @@ -62,6 +62,6 @@ if [ "$module" = 'SFTPJAIL' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-backup-host b/bin/v-add-backup-host index 5595c043..0d0b7004 100755 --- a/bin/v-add-backup-host +++ b/bin/v-add-backup-host @@ -94,7 +94,7 @@ EOF if [ "$type" != 'local' ];then check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]" - validate_format 'host' + is_format_valid 'host' is_password_valid if [ "$type" = 'sftp' ]; then which expect >/dev/null 2>&1 @@ -117,7 +117,7 @@ if [ "$type" = 'ftp' ]; then grep -i -e failed -e error -e "can't" -e "not conn" -e "incorrect") if [ ! -z "$ferror" ]; then echo "Error: can't login to ftp $user@$host" - log_event "$E_CONNECT" "$EVENT" + log_event "$E_CONNECT" "$ARGUMENTS" exit $E_CONNECT fi @@ -129,7 +129,7 @@ if [ "$type" = 'ftp' ]; then echo "$ftp_result" rm -rf $tmpdir echo "Error: can't create $ftmpdir folder on the ftp" - log_event "$E_FTP" "$EVENT" + log_event "$E_FTP" "$ARGUMENTS" exit $E_FTP fi fi @@ -145,7 +145,7 @@ if [ "$type" = 'sftp' ]; then $E_CONNECT) echo "Error: can't login to sftp $user@$host";; $E_FTP) echo "Error: can't create temp folder on the sftp host";; esac - log_event "$rc" "$EVENT" + log_event "$rc" "$ARGUMENTS" exit "$rc" fi fi @@ -153,13 +153,12 @@ fi # Adding backup host if [ $type != 'local' ]; then - echo "HOST='$host' - USERNAME='$user' - PASSWORD='$password' - BPATH='$path' - PORT='$port' - TIME='$TIME' - DATE='$DATE'" > $VESTA/conf/$type.backup.conf + time_n_date=$(date +'%T %F') + time=$(echo "$time_n_date" |cut -f 1 -d \ ) + date=$(echo "$time_n_date" |cut -f 2 -d \ ) + str="HOST='$host'\nUSERNAME='$user'\nPASSWORD='$password'" + str="$str\nBPATH='$path'\nPORT='$port'\nTIME='$time'\nDATE='$date'" + echo -e "$str" > $VESTA/conf/$type.backup.conf chmod 660 $VESTA/conf/$type.backup.conf fi @@ -181,6 +180,6 @@ else fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-cron-job b/bin/v-add-cron-job index b6c41480..2a1a7c9b 100755 --- a/bin/v-add-cron-job +++ b/bin/v-add-cron-job @@ -34,13 +34,13 @@ A7="$command" #----------------------------------------------------------# check_args '7' "$#" 'USER MIN HOUR DAY MONTH WDAY COMMAND [JOB] [RESTART]' -validate_format 'user' 'min' 'hour' 'day' 'month' 'wday' 'command' +is_format_valid 'user' 'min' 'hour' 'day' 'month' 'wday' 'command' is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_package_full 'CRON_JOBS' get_next_cronjob -validate_format 'job' +is_format_valid 'job' is_object_new 'cron' 'JOB' "$job" @@ -48,9 +48,14 @@ is_object_new 'cron' 'JOB' "$job" # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Concatenating cron string str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'" -str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'" +str="$str CMD='$command' SUSPENDED='no' TIME='$time' DATE='$date'" # Adding to crontab echo "$str" >> $VESTA/data/users/$user/cron.conf @@ -78,6 +83,6 @@ check_result $? "Cron restart failed" >/dev/null # Logging log_history "added cron job $job" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-cron-reports b/bin/v-add-cron-reports index e0d6b21a..df785905 100755 --- a/bin/v-add-cron-reports +++ b/bin/v-add-cron-reports @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -50,6 +50,6 @@ check_result $? "Cron restart failed" >/dev/null # Logging log_history "enabled cron reporting" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-cron-restart-job b/bin/v-add-cron-restart-job index 474ef119..9b061265 100755 --- a/bin/v-add-cron-restart-job +++ b/bin/v-add-cron-restart-job @@ -38,6 +38,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-cron-vesta-autoupdate b/bin/v-add-cron-vesta-autoupdate index 2d026837..3ad0ba4e 100755 --- a/bin/v-add-cron-vesta-autoupdate +++ b/bin/v-add-cron-vesta-autoupdate @@ -34,6 +34,11 @@ fi # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Define time somewhere at night min=$(gen_password '012345' '2') hour=$(gen_password '1234567' '1') @@ -44,7 +49,7 @@ command='sudo /usr/local/vesta/bin/v-update-sys-vesta-all' # Concatenating cron string str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'" -str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'" +str="$str CMD='$command' SUSPENDED='no' TIME='$time' DATE='$date'" # Adding to crontab echo "$str" >> $VESTA/data/users/$user/cron.conf @@ -72,6 +77,6 @@ check_result $? "Cron restart failed" >/dev/null # Logging log_history "added cron job $job" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-database b/bin/v-add-database index 68e67647..438b473e 100755 --- a/bin/v-add-database +++ b/bin/v-add-database @@ -36,14 +36,14 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DATABASE DBUSER DBPASS [TYPE] [HOST] [CHARSET]' -validate_format 'user' 'database' 'dbuser' 'charset' +is_format_valid 'user' 'database' 'dbuser' 'charset' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_type_valid "$DB_SYSTEM" "$type" is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_object_new 'db' 'DB' "$database" get_next_dbhost -is_object_valid "../../../conf/$type" 'DBHOST' "$host" +is_object_valid "../../../conf/$type" 'HOST' "$host" is_object_unsuspended "../../../conf/$type" 'DBHOST' "$host" #is_charset_valid is_package_full 'DATABASES' @@ -66,14 +66,15 @@ esac # Vesta # #----------------------------------------------------------# -# Update time and date -DATE=$(date +%F) -TIME=$(date +%T) +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) # Adding db to db conf str="DB='$database' DBUSER='$dbuser' MD5='$md5' HOST='$host' TYPE='$type'" -str="$str CHARSET='$charset' U_DISK='0' SUSPENDED='no' TIME='$TIME'" -str="$str DATE='$DATE'" +str="$str CHARSET='$charset' U_DISK='0' SUSPENDED='no' TIME='$time'" +str="$str DATE='$date'" echo "$str" >> $USER_DATA/db.conf chmod 660 $USER_DATA/db.conf @@ -83,6 +84,6 @@ increase_user_value "$user" '$U_DATABASES' # Logging log_history "added $type database $database" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-database-host b/bin/v-add-database-host index 550d0a70..c7b23ddf 100755 --- a/bin/v-add-database-host +++ b/bin/v-add-database-host @@ -38,7 +38,7 @@ is_mysql_host_alive() { rm $mycnf if [ '0' -ne "$?" ]; then echo "Error: MySQL connection to $host failed" - log_event "$E_CONNECT" "$EVENT" + log_event "$E_CONNECT" "$ARGUMENTS" exit $E_CONNECT fi } @@ -48,7 +48,7 @@ is_pgsql_host_alive() { psql -h $host -U $dbuser -c "SELECT VERSION()" > /dev/null 2>&1 if [ '0' -ne "$?" ]; then echo "Error: PostgreSQL connection to $host failed" - log_event "$E_CONNECT" "$EVENT" + log_event "$E_CONNECT" "$ARGUMENTS" exit $E_CONNECT fi } @@ -60,7 +60,7 @@ is_pgsql_host_alive() { args_usage='TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TPL]' check_args '4' "$#" "$args_usage" -validate_format 'host' 'dbuser' 'max_db' 'charsets' 'template' +is_format_valid 'host' 'dbuser' 'max_db' 'charsets' 'template' #is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' #is_type_valid "$DB_SYSTEM" "$type" is_dbhost_new @@ -76,19 +76,23 @@ esac # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Concatenating db host string case $type in mysql) str="HOST='$host' USER='$dbuser' PASSWORD='$dbpass'"; str="$str CHARSETS='$charsets' MAX_DB='$max_db' U_SYS_USERS=''"; - str="$str U_DB_BASES='0' SUSPENDED='no' TIME='$TIME' DATE='$DATE'";; + str="$str U_DB_BASES='0' SUSPENDED='no' TIME='$time' DATE='$date'";; pgsql) str="HOST='$host' USER='$dbuser' PASSWORD='$dbpass'"; str="$str CHARSETS='$charsets' TPL='$template' MAX_DB='$max_db'"; str="$str U_SYS_USERS='' U_DB_BASES='0' SUSPENDED='no'"; - str="$str TIME='$TIME' DATE='$DATE'";; + str="$str TIME='$time' DATE='$date'";; esac - #----------------------------------------------------------# # Vesta # #----------------------------------------------------------# @@ -110,6 +114,6 @@ else fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-dns-domain b/bin/v-add-dns-domain index 852050ce..df9ab30a 100755 --- a/bin/v-add-dns-domain +++ b/bin/v-add-dns-domain @@ -41,7 +41,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN IP [NS1] [NS2] [NS3] [..] [NS8] [RESTART]' -validate_format 'user' 'domain' 'ip' +is_format_valid 'user' 'domain' 'ip' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -52,37 +52,37 @@ is_dns_template_valid if [ ! -z "$ns1" ]; then ns1=$(echo $4 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns1' + is_format_valid 'ns1' fi if [ ! -z "$ns2" ]; then ns2=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns2' + is_format_valid 'ns2' fi if [ ! -z "$ns3" ]; then ns3=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns3' + is_format_valid 'ns3' fi if [ ! -z "$ns4" ]; then ns4=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns4' + is_format_valid 'ns4' fi if [ ! -z "$ns5" ]; then ns5=$(echo $8 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns5' + is_format_valid 'ns5' fi if [ ! -z "$ns6" ]; then ns6=$(echo $9 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns6' + is_format_valid 'ns6' fi if [ ! -z "$ns7" ]; then ns7=$(echo ${10} | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns7' + is_format_valid 'ns7' fi if [ ! -z "$ns8" ]; then ns8=$(echo ${11} | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns8' + is_format_valid 'ns8' fi @@ -127,6 +127,11 @@ if [ -z "$ns8" ]; then template_data=$(echo "$template_data" |grep -v %ns8%) fi +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Adding dns zone to the user config echo "$template_data" |\ sed -e "s/%ip%/$ip/g" \ @@ -140,8 +145,8 @@ echo "$template_data" |\ -e "s/%ns6%/$ns6/g" \ -e "s/%ns7%/$ns7/g" \ -e "s/%ns8%/$ns8/g" \ - -e "s/%time%/$TIME/g" \ - -e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf + -e "s/%time%/$time/g" \ + -e "s/%date%/$date/g" > $USER_DATA/dns/$domain.conf chmod 660 $USER_DATA/dns/$domain.conf records="$(wc -l $USER_DATA/dns/$domain.conf |cut -f 1 -d ' ')" @@ -149,7 +154,7 @@ records="$(wc -l $USER_DATA/dns/$domain.conf |cut -f 1 -d ' ')" # Adding dns.conf record dns_rec="DOMAIN='$domain' IP='$ip' TPL='$template' TTL='$ttl' EXP='$exp'" dns_rec="$dns_rec SOA='$soa' SERIAL='$serial' SRC='' RECORDS='$records'" -dns_rec="$dns_rec SUSPENDED='no' TIME='$TIME' DATE='$DATE'" +dns_rec="$dns_rec SUSPENDED='no' TIME='$time' DATE='$date'" echo "$dns_rec" >> $USER_DATA/dns.conf chmod 660 $USER_DATA/dns.conf @@ -200,6 +205,6 @@ fi # Logging log_history "added dns domain $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-dns-on-web-alias b/bin/v-add-dns-on-web-alias index e0eded79..cc587483 100755 --- a/bin/v-add-dns-on-web-alias +++ b/bin/v-add-dns-on-web-alias @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER ALIAS IP [RESTART]' -validate_format 'user' 'alias' 'ip' +is_format_valid 'user' 'alias' 'ip' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -40,7 +40,7 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" # Define additional vars sub_domain=$(echo "$alias" |awk -F '.' '{print $1}') diff --git a/bin/v-add-dns-record b/bin/v-add-dns-record index 988c0fbe..1cdb57d7 100755 --- a/bin/v-add-dns-record +++ b/bin/v-add-dns-record @@ -52,7 +52,7 @@ fi #----------------------------------------------------------# check_args '5' "$#" 'USER DOMAIN RECORD TYPE VALUE [PRIORITY] [ID] [RESTART]' -validate_format 'user' 'domain' 'record' 'rtype' 'dvalue' +is_format_valid 'user' 'domain' 'record' 'rtype' 'dvalue' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -60,7 +60,7 @@ is_object_valid 'dns' 'DOMAIN' "$domain" is_object_unsuspended 'dns' 'DOMAIN' "$domain" is_package_full 'DNS_RECORDS' get_next_dnsrecord -validate_format 'id' +is_format_valid 'id' is_object_new "dns/$domain" 'ID' "$id" is_dns_fqnd "$rtype" "$dvalue" is_dns_nameserver_valid "$domain" "$rtype" "$dvalue" @@ -70,10 +70,15 @@ is_dns_nameserver_valid "$domain" "$rtype" "$dvalue" # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Adding record zone="$USER_DATA/dns/$domain.conf" dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' PRIORITY='$priority'" -dns_rec="$dns_rec VALUE='$dvalue' SUSPENDED='no' TIME='$TIME' DATE='$DATE'" +dns_rec="$dns_rec VALUE='$dvalue' SUSPENDED='no' TIME='$time' DATE='$date'" echo "$dns_rec" >> $zone chmod 660 $zone @@ -114,6 +119,6 @@ fi # Logging log_history "added $rtype dns record $record for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-domain b/bin/v-add-domain index 0af33c0d..c18c9cb5 100755 --- a/bin/v-add-domain +++ b/bin/v-add-domain @@ -25,9 +25,9 @@ source $VESTA/conf/vesta.conf # Verifications # #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN [IP] [RESTART]' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' if [ ! -z "$ip" ] ; then - validate_format 'ip' + is_format_valid 'ip' fi is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -42,7 +42,7 @@ if [ -z "$ip" ]; then ip=$(get_user_ip $user) if [ -z "$ip" ]; then echo "Error: no avaiable IP address" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi fi diff --git a/bin/v-add-firewall-ban b/bin/v-add-firewall-ban index 6fb61c8d..a1eed13e 100755 --- a/bin/v-add-firewall-ban +++ b/bin/v-add-firewall-ban @@ -29,7 +29,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'IP CHAIN' -validate_format 'ip' 'chain' +is_format_valid 'ip' 'chain' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' @@ -59,8 +59,13 @@ fi # Adding chain $BIN/v-add-firewall-chain $chain +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Adding ip to banlist -echo "IP='$ip' CHAIN='$chain' TIME='$TIME' DATE='$DATE'" >> $conf +echo "IP='$ip' CHAIN='$chain' TIME='$time' DATE='$date'" >> $conf $iptables -I fail2ban-$chain 1 -s $ip \ -j REJECT --reject-with icmp-port-unreachable 2>/dev/null @@ -73,6 +78,6 @@ chmod 660 $conf #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-firewall-chain b/bin/v-add-firewall-chain index 735cd11d..f963dade 100755 --- a/bin/v-add-firewall-chain +++ b/bin/v-add-firewall-chain @@ -31,7 +31,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'CHAIN [PORT] [PROTOCOL]' -validate_format 'chain' +is_format_valid 'chain' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' @@ -81,6 +81,6 @@ chmod 660 $chains #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-firewall-rule b/bin/v-add-firewall-rule index 37abe98b..6fb867d3 100755 --- a/bin/v-add-firewall-rule +++ b/bin/v-add-firewall-rule @@ -47,13 +47,13 @@ sort_fw_rules() { #----------------------------------------------------------# check_args '3' "$#" 'ACTION IP PORT [PROTOCOL] [COMMENT] [RULE]' -validate_format 'action' 'protocol' 'port_ext' 'ip' +is_format_valid 'action' 'protocol' 'port_ext' 'ip' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' get_next_fw_rule -validate_format 'rule' +is_format_valid 'rule' is_object_new '../../data/firewall/rules' 'RULE' "$rule" if [ ! -z "$comment" ]; then - validate_format 'comment' + is_format_valid 'comment' fi @@ -61,10 +61,15 @@ fi # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Concatenating rule str="RULE='$rule' ACTION='$action' PROTOCOL='$protocol' PORT='$port_ext'" str="$str IP='$ip' COMMENT='$comment' SUSPENDED='no'" -str="$str TIME='$TIME' DATE='$DATE'" +str="$str TIME='$time' DATE='$date'" # Adding to config echo "$str" >> $VESTA/data/firewall/rules.conf @@ -84,6 +89,6 @@ $BIN/v-update-firewall #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-account b/bin/v-add-mail-account index 5bc5cf02..77e44dfa 100755 --- a/bin/v-add-mail-account +++ b/bin/v-add-mail-account @@ -29,16 +29,16 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT PASSWORD [QUOTA]' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' if [ "$quota" != 'unlimited' ]; then - validate_format 'quota' + is_format_valid 'quota' fi is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_object_valid 'mail' 'DOMAIN' "$domain" is_object_unsuspended 'mail' 'DOMAIN' "$domain" -is_package_full 'MAIL_ACCOUNTS' +is_package_full 'MAIL_USER' is_mail_new "$account" is_password_valid @@ -65,13 +65,18 @@ fi # Vesta # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + if [[ "$quota" -eq '0' ]]; then quota='unlimited' fi -str="ACCOUNT='$account' ALIAS='' QUOTA='$quota' AUTOREPLY='no' FWD=''" -str="$str FWD_ONLY='' MD5='$md5' U_DISK='0' SUSPENDED='no' TIME='$TIME'" -str="$str DATE='$DATE'" +str="ACCOUNT='$account' ALIAS='' AUTOREPLY='no' FWD='' FWD_ONLY=''" +str="$str MD5='$md5' QUOTA='$quota' U_DISK='0' SUSPENDED='no'" +str="$str TIME='$time' DATE='$date'" echo "$str" >> $USER_DATA/mail/$domain.conf chmod 660 $USER_DATA/mail/$domain.conf @@ -82,6 +87,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$ACCOUNTS' "$accounts" # Logging log_history "added mail account $account@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-account-alias b/bin/v-add-mail-account-alias index 9cd2b06b..004e6e4d 100755 --- a/bin/v-add-mail-account-alias +++ b/bin/v-add-mail-account-alias @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT ALIAS' -validate_format 'user' 'domain' 'account' 'malias' +is_format_valid 'user' 'domain' 'account' 'malias' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -65,6 +65,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$ALIAS' "$aliases" # Logging log_history "added alias $malias to $account@$domain " -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-account-autoreply b/bin/v-add-mail-account-autoreply index a1cd09f9..88070f7c 100755 --- a/bin/v-add-mail-account-autoreply +++ b/bin/v-add-mail-account-autoreply @@ -35,7 +35,7 @@ fi #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT MESSAGE' -validate_format 'user' 'domain' 'account' 'autoreply' +is_format_valid 'user' 'domain' 'account' 'autoreply' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -70,6 +70,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$AUTOREPLY' 'yes' # Logging log_history "added autoreply message on $account@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-account-forward b/bin/v-add-mail-account-forward index 5f4eaeed..1a990a31 100755 --- a/bin/v-add-mail-account-forward +++ b/bin/v-add-mail-account-forward @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT FORWARD' -validate_format 'user' 'domain' 'account' 'forward' +is_format_valid 'user' 'domain' 'account' 'forward' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -39,7 +39,7 @@ is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account" fwd=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD') if [ ! -z "$(echo $fwd | grep -w $forward)" ]; then echo "Error: forward $forward exists" - log_event "$E_EXISTS $EVENT" + log_event "$E_EXISTS $ARGUMENTS" exit $E_EXISTS fi @@ -71,6 +71,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD' "$fwd" # Logging log_history "added forwarding from $account@$domain to $forward" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-account-fwd-only b/bin/v-add-mail-account-fwd-only index 72e7c8ec..277776ba 100755 --- a/bin/v-add-mail-account-fwd-only +++ b/bin/v-add-mail-account-fwd-only @@ -34,7 +34,7 @@ fi #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ACCOUNT' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -45,7 +45,7 @@ is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account" fwd=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD') if [ -z "$fwd" ]; then echo "Error: forward doesn't exist" - log_event "$E_NOTEXIST $EVENT" + log_event "$E_NOTEXIST $ARGUMENTS" exit $E_NOTEXIST fi @@ -71,6 +71,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD_ONLY' "yes" # Logging log_history "added fwd_only flag for $account@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-domain b/bin/v-add-mail-domain index 9fbd1852..68ac1fa1 100755 --- a/bin/v-add-mail-domain +++ b/bin/v-add-mail-domain @@ -38,7 +38,7 @@ fi #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN [ANTISPAM] [ANTIVIRUS] [DKIM] [DKIM_SIZE]' -validate_format 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size' +is_format_valid 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -50,10 +50,15 @@ is_package_full 'MAIL_DOMAINS' # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Adding domain to mail.conf s="DOMAIN='$domain' ANTIVIRUS='$antivirus' ANTISPAM='$antispam' DKIM='$dkim'" -s="$s ACCOUNTS='0' U_DISK='0' CATCHALL='' SUSPENDED='no' TIME='$TIME'" -s="$s DATE='$DATE'" +s="$s CATCHALL='' ACCOUNTS='0' U_DISK='0' SUSPENDED='no' TIME='$time'" +s="$s DATE='$date'" echo $s >> $USER_DATA/mail.conf touch $USER_DATA/mail/$domain.conf @@ -134,6 +139,6 @@ fi # Logging log_history "added mail domain $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-domain-antispam b/bin/v-add-mail-domain-antispam index 20e0c201..916f1540 100755 --- a/bin/v-add-mail-domain-antispam +++ b/bin/v-add-mail-domain-antispam @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,6 +54,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$ANTISPAM' 'yes' # Logging log_history "enabled antispam on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-domain-antivirus b/bin/v-add-mail-domain-antivirus index fe7151d2..d18857cb 100755 --- a/bin/v-add-mail-domain-antivirus +++ b/bin/v-add-mail-domain-antivirus @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,6 +54,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS' 'yes' # Logging log_history "enabled antivirus on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-domain-catchall b/bin/v-add-mail-domain-catchall index 8ce5eddf..91dc0354 100755 --- a/bin/v-add-mail-domain-catchall +++ b/bin/v-add-mail-domain-catchall @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN EMAIL' -validate_format 'user' 'domain' 'email' +is_format_valid 'user' 'domain' 'email' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -56,6 +56,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' "$email" # Logging log_history "added $email as catchall email for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-mail-domain-dkim b/bin/v-add-mail-domain-dkim index f2accc03..fe709a59 100755 --- a/bin/v-add-mail-domain-dkim +++ b/bin/v-add-mail-domain-dkim @@ -34,7 +34,7 @@ fi #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN [DKIM_SIZE]' -validate_format 'user' 'domain' 'dkim_size' +is_format_valid 'user' 'domain' 'dkim_size' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -83,6 +83,6 @@ increase_user_value "$user" '$U_MAIL_DKMI' # Logging log_history "enabled DKIM support for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-remote-dns-domain b/bin/v-add-remote-dns-domain index a2f5b34a..b82ea4fd 100755 --- a/bin/v-add-remote-dns-domain +++ b/bin/v-add-remote-dns-domain @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN [FLUSH]' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" diff --git a/bin/v-add-remote-dns-host b/bin/v-add-remote-dns-host index 32614ce0..0c52f79b 100755 --- a/bin/v-add-remote-dns-host +++ b/bin/v-add-remote-dns-host @@ -35,7 +35,7 @@ source $VESTA/conf/vesta.conf args_usage='HOST PORT USER PASSWORD [TYPE] [DNS_USER]' check_args '4' "$#" "$args_usage" -validate_format 'host' 'port' 'user' 'type' 'dns_user' +is_format_valid 'host' 'port' 'user' 'type' 'dns_user' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_password_valid is_dnshost_new @@ -46,10 +46,15 @@ is_dnshost_alive # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Concatentating dns host string str="HOST='$host' PORT='$port' USER='$user' PASSWORD='$password'" str="$str DNS_USER='$dns_user' TYPE='$type' SUSPENDED='no'" -str="$str TIME='$TIME' DATE='$DATE'" +str="$str TIME='$time' DATE='$date'" # Adding host to dns-cluster.conf echo "$str" >> $VESTA/conf/dns-cluster.conf @@ -83,6 +88,6 @@ if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-remote-dns-record b/bin/v-add-remote-dns-record index 9848ef23..000f2948 100755 --- a/bin/v-add-remote-dns-record +++ b/bin/v-add-remote-dns-record @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ID' -validate_format 'user' 'domain' 'id' +is_format_valid 'user' 'domain' 'id' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" diff --git a/bin/v-add-sys-firewall b/bin/v-add-sys-firewall index ab40345b..b154c7f0 100755 --- a/bin/v-add-sys-firewall +++ b/bin/v-add-sys-firewall @@ -52,6 +52,6 @@ $BIN/v-update-firewall #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-sys-ip b/bin/v-add-sys-ip index 3b1a835e..307d6805 100755 --- a/bin/v-add-sys-ip +++ b/bin/v-add-sys-ip @@ -35,15 +35,15 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'IP NETMASK [INTERFACE] [USER] [STATUS] [NAME] [NATED_IP]' -validate_format 'ip' 'netmask' 'interface' 'user' 'ip_status' +is_format_valid 'ip' 'netmask' 'interface' 'user' 'ip_status' is_ip_free is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" if [ ! -z "$ip_name" ] ; then - validate_format 'ip_name' + is_format_valid 'ip_name' fi if [ ! -z "$nat_ip" ] ; then - validate_format 'nat_ip' + is_format_valid 'nat_ip' fi @@ -82,6 +82,11 @@ if [ -z "$sys_ip_check" ]; then fi fi +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Adding vesta ip echo "OWNER='$user' STATUS='$ip_status' @@ -91,8 +96,8 @@ U_WEB_DOMAINS='0' INTERFACE='$interface' NETMASK='$netmask' NAT='$nat_ip' -TIME='$TIME' -DATE='$DATE'" > $VESTA/data/ips/$ip +TIME='$time' +DATE='$date'" > $VESTA/data/ips/$ip chmod 660 $VESTA/data/ips/$ip # WEB support @@ -176,6 +181,6 @@ fi # Logging log_history "added system ip address $ip" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-sys-quota b/bin/v-add-sys-quota index f0acde21..51074f02 100755 --- a/bin/v-add-sys-quota +++ b/bin/v-add-sys-quota @@ -87,6 +87,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-sys-sftp-jail b/bin/v-add-sys-sftp-jail index c31fb439..896fb050 100755 --- a/bin/v-add-sys-sftp-jail +++ b/bin/v-add-sys-sftp-jail @@ -101,6 +101,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-user b/bin/v-add-user index 35424381..27d0da20 100755 --- a/bin/v-add-user +++ b/bin/v-add-user @@ -25,7 +25,7 @@ is_user_free() { check_sysuser=$(cut -f 1 -d : /etc/passwd | grep -w "$user" ) if [ ! -z "$check_sysuser" ] || [ -e "$USER_DATA" ]; then echo "Error: user $user exists" - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi } @@ -36,9 +36,9 @@ is_user_free() { #----------------------------------------------------------# check_args '3' "$#" 'USER PASSWORD EMAIL [PACKAGE] [FNAME] [LNAME]' -validate_format 'user' 'email' 'package' +is_format_valid 'user' 'email' 'package' if [ ! -z "$fname" ]; then - validate_format 'fname' 'lname' + is_format_valid 'fname' 'lname' fi is_user_free "$user" is_password_valid @@ -50,7 +50,7 @@ is_package_valid #----------------------------------------------------------# # Parsing package data -pkg_data=$(cat $VESTA/data/packages/$package.pkg |grep -v TIME |grep -v DATE) +pkg_data=$(cat $VESTA/data/packages/$package.pkg |egrep -v "TIME|DATE") # Checking shell shell_conf=$(echo "$pkg_data" | grep 'SHELL' | cut -f 2 -d \') @@ -134,6 +134,10 @@ if [ ! -z "$DB_SYSTEM" ]; then echo "$BIN/v-update-databases-disk $user" >> $VESTA/data/queue/disk.pipe fi +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) # Filling user config if [ "$user" != 'admin' ]; then @@ -181,8 +185,8 @@ U_CRON_JOBS='0' U_BACKUPS='0' LANGUAGE='' NOTIFICATIONS='no' -TIME='$TIME' -DATE='$DATE'" > $USER_DATA/user.conf +TIME='$time' +DATE='$date'" > $USER_DATA/user.conf chmod 660 $USER_DATA/user.conf # Updating quota @@ -207,6 +211,6 @@ fi # Logging log_history "added system user $user" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-user-favourites b/bin/v-add-user-favourites index 84764e4a..18863829 100755 --- a/bin/v-add-user-favourites +++ b/bin/v-add-user-favourites @@ -26,12 +26,12 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER SYSTEM OBJECT' -validate_format 'user' 'system' +is_format_valid 'user' 'system' case $system in - MAIL_ACC) validate_format 'email' ;; - CRON) validate_format 'id' ;; - DNS_REC) validate_format 'id' ;; - *) validate_format 'object' + MAIL_ACC) is_format_valid 'email' ;; + CRON) is_format_valid 'id' ;; + DNS_REC) is_format_valid 'id' ;; + *) is_format_valid 'object' esac is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -120,6 +120,6 @@ chmod 640 $USER_DATA/favourites.conf # Logging log_history "added starred $object in $system listing" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-user-notification b/bin/v-add-user-notification index dcc61f8a..5945b192 100755 --- a/bin/v-add-user-notification +++ b/bin/v-add-user-notification @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER TOPIC NOTICE [TYPE]' -validate_format 'user' 'topic' 'notice' +is_format_valid 'user' 'topic' 'notice' is_object_valid 'user' 'USER' "$user" @@ -46,9 +46,14 @@ else nid=1 fi +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Concatenating string str="NID='$nid' TOPIC='$topic' NOTICE='$notice' TYPE='$type'" -str="$str ACK='no' TIME='$TIME' DATE='$DATE'" +str="$str ACK='no' TIME='$time' DATE='$date'" # Adding to config echo "$str" >> $USER_DATA/notifications.conf diff --git a/bin/v-add-user-package b/bin/v-add-user-package index 49332154..23f42725 100755 --- a/bin/v-add-user-package +++ b/bin/v-add-user-package @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf is_package_new() { if [ -e "$VESTA/data/packages/$package.pkg" ]; then echo "Error: package $package already exists." - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi } @@ -30,39 +30,39 @@ is_package_new() { is_package_consistent() { source $pkg_dir/$package.pkg if [ "$WEB_DOMAINS" != 'unlimited' ]; then - validate_format_int $WEB_DOMAINS 'WEB_DOMAINS' + is_format_valid_int $WEB_DOMAINS 'WEB_DOMAINS' fi if [ "$WEB_ALIASES" != 'unlimited' ]; then - validate_format_int $WEB_ALIASES 'WEB_ALIASES' + is_format_valid_int $WEB_ALIASES 'WEB_ALIASES' fi if [ "$DNS_DOMAINS" != 'unlimited' ]; then - validate_format_int $DNS_DOMAINS 'DNS_DOMAINS' + is_format_valid_int $DNS_DOMAINS 'DNS_DOMAINS' fi if [ "$DNS_RECORDS" != 'unlimited' ]; then - validate_format_int $DNS_RECORDS 'DNS_RECORDS' + is_format_valid_int $DNS_RECORDS 'DNS_RECORDS' fi if [ "$MAIL_DOMAINS" != 'unlimited' ]; then - validate_format_int $MAIL_DOMAINS 'MAIL_DOMAINS' + is_format_valid_int $MAIL_DOMAINS 'MAIL_DOMAINS' fi if [ "$MAIL_ACCOUNTS" != 'unlimited' ]; then - validate_format_int $MAIL_ACCOUNTS 'MAIL_ACCOUNTS' + is_format_valid_int $MAIL_ACCOUNTS 'MAIL_ACCOUNTS' fi if [ "$DATABASES" != 'unlimited' ]; then - validate_format_int $DATABASES 'DATABASES' + is_format_valid_int $DATABASES 'DATABASES' fi if [ "$CRON_JOBS" != 'unlimited' ]; then - validate_format_int $CRON_JOBS 'CRON_JOBS' + is_format_valid_int $CRON_JOBS 'CRON_JOBS' fi if [ "$DISK_QUOTA" != 'unlimited' ]; then - validate_format_int $DISK_QUOTA 'DISK_QUOTA' + is_format_valid_int $DISK_QUOTA 'DISK_QUOTA' fi if [ "$BANDWIDTH" != 'unlimited' ]; then - validate_format_int $BANDWIDTH 'BANDWIDTH' + is_format_valid_int $BANDWIDTH 'BANDWIDTH' fi if [ "$BACKUPS" != 'unlimited' ]; then - validate_format_int $BACKUPS 'BACKUPS' + is_format_valid_int $BACKUPS 'BACKUPS' fi - validate_format_shell $SHELL + is_format_valid_shell $SHELL } @@ -71,7 +71,7 @@ is_package_consistent() { #----------------------------------------------------------# check_args '2' "$#" 'PKG_DIR PACKAGE' 'rewrite' -validate_format 'pkg_dir' 'package' +is_format_valid 'pkg_dir' 'package' if [ "$rewrite" != 'yes' ]; then is_package_new fi @@ -97,6 +97,6 @@ if [ "$rewrite" != 'yes' ]; then else log_history "updated user package $package" '' 'admin' fi -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-web-domain-ftp b/bin/v-add-web-domain-ftp index 6a55155c..8d888093 100755 --- a/bin/v-add-web-domain-ftp +++ b/bin/v-add-web-domain-ftp @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN FTP_USER FTP_PASSWORD [FTP_PATH]' -validate_format 'user' 'domain' 'ftp_user' +is_format_valid 'user' 'domain' 'ftp_user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -37,7 +37,7 @@ is_object_unsuspended 'web' 'DOMAIN' "$domain" check_ftp_user=$(grep "^$ftp_user:" /etc/passwd) if [ ! -z "$check_ftp_user" ] && [ "$FTP_USER" != "$ftp_user" ]; then echo "Error: ftp user $ftp_user already exists" - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi is_password_valid @@ -68,7 +68,7 @@ else ftp_path_a=$(readlink -f "$HOMEDIR/$user/web/$domain/$ftp_path") if [ -z "$(echo $ftp_path_a |grep $HOMEDIR/$user/web/$domain)" ]; then echo "Error: absolute path $ftp_path_a is invalid" - log_event "$E_INVALID" "$EVENT" + log_event "$E_INVALID" "$ARGUMENTS" exit $E_INVALID fi # Creating ftp user home directory @@ -120,6 +120,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$FTP_PATH' "$ftp_path" # Logging log_history "added ftp account ${1}_${3}@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-web-domain-httpauth b/bin/v-add-web-domain-httpauth index 5f27399a..42dd269e 100755 --- a/bin/v-add-web-domain-httpauth +++ b/bin/v-add-web-domain-httpauth @@ -32,7 +32,7 @@ docroot="$HOMEDIR/$user/web/$domain/public_html" #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN AUTH_USER AUTH_PASSWORD [RESTART]' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -42,7 +42,7 @@ is_password_valid get_domain_values 'web' if [ ! -z "$(echo "$AUTH_USER" |tr : '\n' |grep ^$auth_user$)" ]; then echo "Error: auth user $auth_user already exists" - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi @@ -100,6 +100,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$AUTH_HASH' "$auth_hash" # Logging log_history "added http auth user $httpauth_user on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-add-web-domain-stats-user b/bin/v-add-web-domain-stats-user index 007c013d..ab23f209 100755 --- a/bin/v-add-web-domain-stats-user +++ b/bin/v-add-web-domain-stats-user @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN STATS_USER STATS_PASS' -validate_format 'user' 'domain' 'stats_user' +is_format_valid 'user' 'domain' 'stats_user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -63,6 +63,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$STATS_CRYPT' "$stats_crypt" # Logging log_history "added password protection for web stats on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-backup-users b/bin/v-backup-users index 3473ad70..87473928 100755 --- a/bin/v-backup-users +++ b/bin/v-backup-users @@ -44,6 +44,6 @@ done #----------------------------------------------------------# # No Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-cron-job b/bin/v-change-cron-job index c38ad7e9..7a30a258 100755 --- a/bin/v-change-cron-job +++ b/bin/v-change-cron-job @@ -30,7 +30,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '7' "$#" 'USER JOB MIN HOUR DAY MONTH WDAY COMMAND' -validate_format 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command' +is_format_valid 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command' is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -42,10 +42,15 @@ is_object_unsuspended 'cron' 'JOB' "$job" # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Concatenating cron string command=$(echo $command | sed -e "s/'/%quote%/g") str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'" -str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'" +str="$str CMD='$command' SUSPENDED='no' TIME='$time' DATE='$date'" # Deleting old job sed -i "/JOB='$job' /d" $USER_DATA/cron.conf @@ -70,6 +75,6 @@ check_result $? "Cron restart failed" >/dev/null # Logging log_history "changed cron job $job" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-database-host-password b/bin/v-change-database-host-password index abe8e06b..fc066293 100755 --- a/bin/v-change-database-host-password +++ b/bin/v-change-database-host-password @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf args_usage='TYPE HOST DBUSER DBPASS' check_args '4' "$#" "$args_usage" -validate_format 'host' 'dbuser' +is_format_valid 'host' 'dbuser' is_object_valid "../../conf/$type" 'HOST' "$host" dbpass="$password" @@ -59,6 +59,6 @@ update_object_value "../../conf/$type" 'HOST' "$host" '$PASSWORD' "$dbpass" #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-database-owner b/bin/v-change-database-owner index 166528f8..274f7aad 100755 --- a/bin/v-change-database-owner +++ b/bin/v-change-database-owner @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'DATABASE USER' -validate_format 'database' 'user' +is_format_valid 'database' 'user' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -34,7 +34,7 @@ is_object_unsuspended 'user' 'USER' "$user" owner=$(echo $database | cut -f 1 -d '_') if [ ! -e "$VESTA/data/users/$owner" ]; then echo "Error: database owner doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -47,7 +47,7 @@ fi db_data=$(grep "DB='$database'" $VESTA/data/users/$owner/db.conf) if [ -z "$db_data" ]; then echo "Error: database $database doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -56,7 +56,7 @@ new_db=$(echo $database | sed "s/^${owner}_/${user}_/") check_db=$(grep "DB='$new_db'" $VESTA/data/users/$user/db.conf) if [ ! -z "$check_db" ]; then echo "Error: $new_db database exists" - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi @@ -69,7 +69,7 @@ fi tmpdir=$(mktemp -p $BACKUP -d) if [ "$?" -ne 0 ]; then echo "Error: can't create $tmpdir" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -120,6 +120,6 @@ $BIN/v-update-user-counters $user #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-database-password b/bin/v-change-database-password index 1272f00a..b911747c 100755 --- a/bin/v-change-database-password +++ b/bin/v-change-database-password @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DATABASE DBPASS' -validate_format 'user' 'database' +is_format_valid 'user' 'database' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -56,6 +56,6 @@ update_object_value 'db' 'DB' "$database" '$MD5' "$md5" # Logging log_history "changed $database database password" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-database-user b/bin/v-change-database-user index 332dfc10..752a7932 100755 --- a/bin/v-change-database-user +++ b/bin/v-change-database-user @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DATABASE DBUSER [DBPASS]' -validate_format 'user' 'database' 'dbuser' +is_format_valid 'user' 'database' 'dbuser' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -86,6 +86,6 @@ fi # Logging log_history "changed $database database user to $dbuser" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-dns-domain-exp b/bin/v-change-dns-domain-exp index da75bca8..ec11acc9 100755 --- a/bin/v-change-dns-domain-exp +++ b/bin/v-change-dns-domain-exp @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN EXP' -validate_format 'user' 'domain' 'exp' +is_format_valid 'user' 'domain' 'exp' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -58,6 +58,6 @@ fi # Logging log_history "changed whois expiration date for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-dns-domain-ip b/bin/v-change-dns-domain-ip index a066c6be..47e01f42 100755 --- a/bin/v-change-dns-domain-ip +++ b/bin/v-change-dns-domain-ip @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN IP' -validate_format 'user' 'domain' 'ip' +is_format_valid 'user' 'domain' 'ip' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -78,6 +78,6 @@ fi # Logging log_history "changed dns ip for $domain to $ip" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-dns-domain-soa b/bin/v-change-dns-domain-soa index 3a8670f7..553bcfc9 100755 --- a/bin/v-change-dns-domain-soa +++ b/bin/v-change-dns-domain-soa @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN SOA' -validate_format 'user' 'domain' 'soa' +is_format_valid 'user' 'domain' 'soa' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -72,6 +72,6 @@ fi # Logging log_history "changed soa record for $domain to $soa" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-dns-domain-tpl b/bin/v-change-dns-domain-tpl index e8ee90c6..db68c94c 100755 --- a/bin/v-change-dns-domain-tpl +++ b/bin/v-change-dns-domain-tpl @@ -29,7 +29,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN TEMPLATE [RESTART]' -validate_format 'user' 'domain' 'template' +is_format_valid 'user' 'domain' 'template' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -98,6 +98,6 @@ fi # Logging log_history "changed dns template for $domain to $template" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-dns-domain-ttl b/bin/v-change-dns-domain-ttl index 120d7e0d..0e85391f 100755 --- a/bin/v-change-dns-domain-ttl +++ b/bin/v-change-dns-domain-ttl @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN TTL' -validate_format 'user' 'domain' 'ttl' +is_format_valid 'user' 'domain' 'ttl' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -71,6 +71,6 @@ fi # Logging log_history "changed TTL for $domain to $ttl" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-dns-record b/bin/v-change-dns-record index 1569ae9c..9f5dfb08 100755 --- a/bin/v-change-dns-record +++ b/bin/v-change-dns-record @@ -30,7 +30,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ID VALUE [PRIORITY] [RESTART]' -validate_format 'user' 'domain' 'id' 'dvalue' +is_format_valid 'user' 'domain' 'id' 'dvalue' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -67,9 +67,14 @@ is_dns_nameserver_valid "$domain" "$TYPE" "$dvalue" # Deleting old record sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Adding record dns_rec="ID='$id' RECORD='$RECORD' TYPE='$TYPE' PRIORITY='$priority'" -dns_rec="$dns_rec VALUE='$dvalue' SUSPENDED='no' TIME='$TIME' DATE='$DATE'" +dns_rec="$dns_rec VALUE='$dvalue' SUSPENDED='no' TIME='$time' DATE='$date'" echo "$dns_rec" >> $USER_DATA/dns/$domain.conf # Sorting records @@ -104,6 +109,6 @@ fi # Logging log_history "changed dns record on $domain to $dvalue" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-dns-record-id b/bin/v-change-dns-record-id index 42ab1d74..4c321b0f 100755 --- a/bin/v-change-dns-record-id +++ b/bin/v-change-dns-record-id @@ -29,7 +29,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ID NEWID [RESTART]' -validate_format 'user' 'domain' 'id' 'newid' +is_format_valid 'user' 'domain' 'id' 'newid' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -78,6 +78,6 @@ fi # Logging log_history "changed dns record id on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-domain-owner b/bin/v-change-domain-owner index 1943473e..66ab4ca3 100755 --- a/bin/v-change-domain-owner +++ b/bin/v-change-domain-owner @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'DOMAIN USER [IP]' -validate_format 'domain' 'user' +is_format_valid 'domain' 'user' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" if [ ! -z "$ip" ]; then @@ -36,7 +36,7 @@ fi owner=$(v-search-domain-owner $domain) if [ -z "$owner" ]; then echo "Error: domain $domain doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi if [ "$owner" = "$user" ]; then @@ -168,6 +168,6 @@ $BIN/v-update-user-counters $user #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-firewall-rule b/bin/v-change-firewall-rule index 806f093b..d2502bce 100755 --- a/bin/v-change-firewall-rule +++ b/bin/v-change-firewall-rule @@ -40,9 +40,9 @@ sort_fw_rules() { #----------------------------------------------------------# check_args '5' "$#" 'RULE ACTION IP PORT [PROTOCOL] [COMMENT]' -validate_format 'rule' 'action' 'protocol' 'port_ext' 'ip' +is_format_valid 'rule' 'action' 'protocol' 'port_ext' 'ip' if [ ! -z "$comment" ]; then - validate_format 'comment' + is_format_valid 'comment' fi is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' is_object_valid '../../data/firewall/rules' 'RULE' "$rule" @@ -52,10 +52,15 @@ is_object_valid '../../data/firewall/rules' 'RULE' "$rule" # Action # #----------------------------------------------------------# +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Concatenating firewall rule str="RULE='$rule' ACTION='$action' PROTOCOL='$protocol' PORT='$port_ext'" str="$str IP='$ip' COMMENT='$comment' SUSPENDED='no'" -str="$str TIME='$TIME' DATE='$DATE'" +str="$str TIME='$time' DATE='$date'" # Deleting old rule sed -i "/RULE='$rule' /d" $VESTA/data/firewall/rules.conf @@ -75,6 +80,6 @@ $BIN/v-update-firewall #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-mail-account-password b/bin/v-change-mail-account-password index 3109ea21..80d0713b 100755 --- a/bin/v-change-mail-account-password +++ b/bin/v-change-mail-account-password @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT PASSWORD' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -63,6 +63,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$MD5' "$md5" # Logging log_history "changed password for $account@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-mail-account-quota b/bin/v-change-mail-account-quota index 3055da72..0d4f8d53 100755 --- a/bin/v-change-mail-account-quota +++ b/bin/v-change-mail-account-quota @@ -28,9 +28,9 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT QUOTA' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' if [ "$quota" != 'unlimited' ]; then - validate_format 'quota' + is_format_valid 'quota' fi is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -69,6 +69,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$QUOTA' "$quota" # Logging log_history "changed mail quota for $account@$domain to $quota" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-mail-domain-catchall b/bin/v-change-mail-domain-catchall index 97909fd6..25e0caaa 100755 --- a/bin/v-change-mail-domain-catchall +++ b/bin/v-change-mail-domain-catchall @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN EMAIL' -validate_format 'user' 'domain' 'email' +is_format_valid 'user' 'domain' 'email' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -56,6 +56,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' "$email" # Logging log_history "changed catchall email for $domain to $email" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-remote-dns-domain-exp b/bin/v-change-remote-dns-domain-exp index a335d63b..421e1408 100755 --- a/bin/v-change-remote-dns-domain-exp +++ b/bin/v-change-remote-dns-domain-exp @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" diff --git a/bin/v-change-remote-dns-domain-soa b/bin/v-change-remote-dns-domain-soa index 65a0c8df..0974e1aa 100755 --- a/bin/v-change-remote-dns-domain-soa +++ b/bin/v-change-remote-dns-domain-soa @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" diff --git a/bin/v-change-remote-dns-domain-ttl b/bin/v-change-remote-dns-domain-ttl index b0e45b77..6bdc90e8 100755 --- a/bin/v-change-remote-dns-domain-ttl +++ b/bin/v-change-remote-dns-domain-ttl @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" diff --git a/bin/v-change-sys-config-value b/bin/v-change-sys-config-value index 0af44ee3..31b62634 100755 --- a/bin/v-change-sys-config-value +++ b/bin/v-change-sys-config-value @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'KEY VALUE' -validate_format 'key' +is_format_valid 'key' #----------------------------------------------------------# @@ -50,6 +50,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-sys-hostname b/bin/v-change-sys-hostname index d977f39f..bf1e8bae 100755 --- a/bin/v-change-sys-hostname +++ b/bin/v-change-sys-hostname @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'HOSTNAME' -validate_format 'domain' +is_format_valid 'domain' #----------------------------------------------------------# @@ -52,6 +52,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-sys-ip-name b/bin/v-change-sys-ip-name index 425efb6e..8e77805c 100755 --- a/bin/v-change-sys-ip-name +++ b/bin/v-change-sys-ip-name @@ -24,9 +24,9 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'IP IP_NAME' -validate_format 'ip' +is_format_valid 'ip' if [ ! -z "$ip_name" ]; then - validate_format 'ip_name' + is_format_valid 'ip_name' fi is_ip_valid @@ -45,6 +45,6 @@ update_ip_value '$NAME' "$ip_name" # Logging log_history "changed associated dns on $ip to $domain" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-sys-ip-nat b/bin/v-change-sys-ip-nat index a76e8878..3af6e716 100755 --- a/bin/v-change-sys-ip-nat +++ b/bin/v-change-sys-ip-nat @@ -25,9 +25,9 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'IP NAT_IP [RESTART]' -validate_format 'ip' +is_format_valid 'ip' if [ ! -z "$nat_ip" ]; then - validate_format 'nat_ip' + is_format_valid 'nat_ip' fi is_ip_valid @@ -82,6 +82,6 @@ fi # Logging log_history "changed associated nat address on $ip to $nat_ip" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-sys-ip-owner b/bin/v-change-sys-ip-owner index 3fbfc43e..952b6ca1 100755 --- a/bin/v-change-sys-ip-owner +++ b/bin/v-change-sys-ip-owner @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'IP USER' -validate_format 'ip' 'user' +is_format_valid 'ip' 'user' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_ip_valid @@ -77,6 +77,6 @@ fi # Logging log_history "changed owner of $ip to $user" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-sys-ip-status b/bin/v-change-sys-ip-status index 907c9e96..64c9513f 100755 --- a/bin/v-change-sys-ip-status +++ b/bin/v-change-sys-ip-status @@ -24,11 +24,11 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'IP IP_STATUS' -validate_format 'ip' 'ip_status' +is_format_valid 'ip' 'ip_status' is_ip_valid if [ "$ip_status" = "$(get_ip_value '$STATUS')" ]; then echo "Error: status $ip_status is already set" - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi @@ -37,7 +37,7 @@ sys_user=$(get_ip_value '$U_SYS_USERS') ip_owner=$(get_ip_value '$OWNER') if [ "$web_domains" -ne '0' ] && [ "$sys_user" != "$ip_owner" ]; then echo "Error: ip $ip is used" - log_event "$E_INUSE" "$EVENT" + log_event "$E_INUSE" "$ARGUMENTS" exit $E_INUSE fi @@ -56,6 +56,6 @@ update_ip_value '$STATUS' "$ip_status" # Logging log_history "changed $ip status to $ip_status" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-sys-language b/bin/v-change-sys-language index 5b79b0f4..6f27a902 100755 --- a/bin/v-change-sys-language +++ b/bin/v-change-sys-language @@ -20,7 +20,7 @@ source $VESTA/conf/vesta.conf is_language_valid() { if [ ! -e "$VESTA/web/inc/i18n/$language.php" ]; then echo "Error: language file $language doesn't exist" - log_event "$E_NOTEXIST $EVENT" + log_event "$E_NOTEXIST $ARGUMENTS" exit $E_NOTEXIST fi } @@ -31,7 +31,7 @@ is_language_valid() { #----------------------------------------------------------# check_args '1' "$#" 'LANGUAGE' -validate_format 'language' +is_format_valid 'language' is_language_valid $language @@ -52,6 +52,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-sys-timezone b/bin/v-change-sys-timezone index d168d13a..bfd4e5bc 100755 --- a/bin/v-change-sys-timezone +++ b/bin/v-change-sys-timezone @@ -19,7 +19,7 @@ source $VESTA/conf/vesta.conf is_timezone_valid() { if [ ! -e "/usr/share/zoneinfo/$timezone" ]; then echo "Error: tz file $timezone doesn't exist" - log_event $E_NOTEXIST "$EVENT" + log_event $E_NOTEXIST "$ARGUMENTS" exit $E_NOTEXIST fi } @@ -67,6 +67,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-contact b/bin/v-change-user-contact index 4228e5aa..bbbb2d16 100755 --- a/bin/v-change-user-contact +++ b/bin/v-change-user-contact @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER EMAIL' -validate_format 'user' 'email' +is_format_valid 'user' 'email' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -49,6 +49,6 @@ $BIN/v-rebuild-cron-jobs $user > /dev/null 2>&1 # Logging log_history "changed contact email to $email" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-language b/bin/v-change-user-language index dceda7d2..38084ccc 100755 --- a/bin/v-change-user-language +++ b/bin/v-change-user-language @@ -21,12 +21,12 @@ source $VESTA/conf/vesta.conf is_language_valid() { if ! [[ "$1" =~ ^[[:alnum:]_-]+$ ]]; then echo "Error: language $1 is not valid" - log_event "$E_INVALID" "$EVENT" + log_event "$E_INVALID" "$ARGUMENTS" exit $E_INVALID fi if [ ! -e "$VESTA/web/inc/i18n/$1.php" ]; then echo "Error: language $1 doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi } @@ -37,7 +37,7 @@ is_language_valid() { #----------------------------------------------------------# check_args '2' "$#" 'USER LANGUAGE' -validate_format 'user' 'language' +is_format_valid 'user' 'language' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_language_valid $language @@ -61,6 +61,6 @@ fi # Logging log_history "changed language to $language" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-name b/bin/v-change-user-name index 41223181..2776b4cb 100755 --- a/bin/v-change-user-name +++ b/bin/v-change-user-name @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER FNAME LNAME' -validate_format 'user' 'fname' 'lname' +is_format_valid 'user' 'fname' 'lname' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -48,6 +48,6 @@ update_user_value "$user" '$LNAME' "$lname" # Logging log_history "changed user name to $fname $lname" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-ns b/bin/v-change-user-ns index 02f06ff0..0e28766c 100755 --- a/bin/v-change-user-ns +++ b/bin/v-change-user-ns @@ -33,30 +33,30 @@ source $VESTA/conf/vesta.conf check_args '3' "$#" 'USER NS1 NS2 [NS3] [NS4] [NS5] [NS6] [NS7] [NS8]' # Checking argument format -validate_format 'user' 'ns1' 'ns2' +is_format_valid 'user' 'ns1' 'ns2' if [ ! -z "$ns3" ]; then ns3=$(echo $4 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns3' + is_format_valid 'ns3' fi if [ ! -z "$ns4" ]; then ns4=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns4' + is_format_valid 'ns4' fi if [ ! -z "$ns5" ]; then ns5=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns5' + is_format_valid 'ns5' fi if [ ! -z "$ns6" ]; then ns6=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns6' + is_format_valid 'ns6' fi if [ ! -z "$ns7" ]; then ns7=$(echo $8 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns7' + is_format_valid 'ns7' fi if [ ! -z "$ns8" ]; then ns8=$(echo $9 | sed -e 's/\.*$//g' -e 's/^\.*//g') - validate_format 'ns8' + is_format_valid 'ns8' fi is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -80,6 +80,6 @@ update_user_value "$user" '$NS' "$ns" # Logging log_history "updated nameservers $ns1 $ns2 $ns3 $ns4 $ns5 $ns6 $ns7 $ns8" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-package b/bin/v-change-user-package index 80dd2046..7f8feee3 100755 --- a/bin/v-change-user-package +++ b/bin/v-change-user-package @@ -41,62 +41,57 @@ is_package_avalable() { if [ "$WEB_DOMAINS" != 'unlimited' ]; then if [ "$WEB_DOMAINS" -lt "$U_WEB_DOMAINS" ]; then echo "Error: Package doesn't cover WEB_DOMAIN usage" - log_event "$E_LIMIT" "$EVENT" + log_event "$E_LIMIT" "$ARGUMENTS" exit $E_LIMIT fi fi if [ "$DNS_DOMAINS" ! = 'unlimited' ]; then if [ "$DNS_DOMAINS" -lt "$U_DNS_DOMAINS" ]; then echo "Error: Package doesn't cover DNS_DOMAIN usage" - log_event "$E_LIMIT" "$EVENT" + log_event "$E_LIMIT" "$ARGUMENTS" exit $E_LIMIT fi fi if [ "$MAIL_DOMAINS" != 'unlimited' ]; then if [ "$MAIL_DOMAINS" -lt "$U_MAIL_DOMAINS" ]; then echo "Error: Package doesn't cover MAIL_DOMAIN usage" - log_event "$E_LIMIT" "$EVENT" + log_event "$E_LIMIT" "$ARGUMENTS" exit $E_LIMIT fi fi if [ "$DATABASES" != 'unlimited' ]; then if [ "$DATABASES" -lt "$U_DATABASES" ]; then echo "Error: Package doesn't cover DATABASE usage" - log_event "$E_LIMIT" "$EVENT" + log_event "$E_LIMIT" "$ARGUMENTS" exit $E_LIMIT fi fi if [ "$CRON_JOBS" != 'unlimited' ]; then if [ "$CRON_JOBS" -lt "$U_CRON_JOBS" ]; then echo "Error: Package doesn't cover CRON usage" - log_event "$E_LIMIT" "$EVENT" + log_event "$E_LIMIT" "$ARGUMENTS" exit $E_LIMIT fi fi if [ "$DISK_QUOTA" != 'unlimited' ]; then if [ "$DISK_QUOTA" -lt "$U_DISK" ]; then echo "Error: Package doesn't cover DISK usage" - log_event "$E_LIMIT" "$EVENT" + log_event "$E_LIMIT" "$ARGUMENTS" exit $E_LIMIT fi fi if [ "$BANDWIDTH" != 'unlimited' ]; then if [ "$BANDWIDTH" -lt "$U_BANDWIDTH" ]; then echo "Error: Package doesn't cover BANDWIDTH usage" - log_event "$E_LIMIT" "$EVENT" + log_event "$E_LIMIT" "$ARGUMENTS" exit $E_LIMIT fi fi } change_user_package() { - usr_data=$(cat $USER_DATA/user.conf) - eval $usr_data - - pkg_data=$(cat $VESTA/data/packages/$package.pkg |grep -v TIME |\ - grep -v DATE) - eval $pkg_data - + eval $(cat $USER_DATA/user.conf) + eval $(cat $VESTA/data/packages/$package.pkg |egrep -v "TIME|DATE") echo "FNAME='$FNAME' LNAME='$LNAME' PACKAGE='$package' @@ -159,7 +154,7 @@ DATE='$DATE'" > $USER_DATA/user.conf #----------------------------------------------------------# check_args '2' "$#" 'USER PACKAGE [FORCE]' -validate_format 'user' 'package' +is_format_valid 'user' 'package' is_object_valid 'user' 'USER' "$user" is_package_valid if [ "$force" != 'yes' ];then @@ -197,6 +192,6 @@ fi # Logging log_history "changed $user package to $package" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-password b/bin/v-change-user-password index af194361..196239bc 100755 --- a/bin/v-change-user-password +++ b/bin/v-change-user-password @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER PASSWORD' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_password_valid @@ -48,6 +48,6 @@ update_user_value "$user" '$MD5' "$md5" # Logging log_history "changed password" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-shell b/bin/v-change-user-shell index 721c8475..6a079c0a 100755 --- a/bin/v-change-user-shell +++ b/bin/v-change-user-shell @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER SHELL' -validate_format 'user' 'shell' +is_format_valid 'user' 'shell' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -58,6 +58,6 @@ update_user_value "$user" '$SHELL' "$shell" # Logging log_history "changed $user shell to $shell" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-user-template b/bin/v-change-user-template index a67bfc3d..7ba774fb 100755 --- a/bin/v-change-user-template +++ b/bin/v-change-user-template @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER TYPE TEMPLATE' -validate_format 'user' 'template' +is_format_valid 'user' 'template' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -51,6 +51,6 @@ esac # Logging log_history "changed $type template to $template" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-web-domain-ftp-password b/bin/v-change-web-domain-ftp-password index 900c6fa3..1eabe0ef 100755 --- a/bin/v-change-web-domain-ftp-password +++ b/bin/v-change-web-domain-ftp-password @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN FTP_USER FTP_PASSWORD' -validate_format 'user' 'domain' 'ftp_user' +is_format_valid 'user' 'domain' 'ftp_user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -37,7 +37,7 @@ is_password_valid get_domain_values 'web' if [ -z "$(echo $FTP_USER | tr ':' '\n' | grep ^$ftp_user$)" ]; then echo "Error: account $ftp_user doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -67,6 +67,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$FTP_MD5' "$ftp_md5" # Logging log_history "changed password for $ftp_user on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-web-domain-ftp-path b/bin/v-change-web-domain-ftp-path index 71da7d85..6ac0b7df 100755 --- a/bin/v-change-web-domain-ftp-path +++ b/bin/v-change-web-domain-ftp-path @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN FTP_USER FTP_PATH' -validate_format 'user' 'domain' 'ftp_user' +is_format_valid 'user' 'domain' 'ftp_user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -36,13 +36,13 @@ is_object_unsuspended 'web' 'DOMAIN' "$domain" get_domain_values 'web' if [ -z "$(echo $FTP_USER | tr ':' '\n' | grep ^$ftp_user$)" ]; then echo "Error: account $ftp_user doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi ftp_path_a=$(readlink -f "$HOMEDIR/$user/web/$domain/$ftp_path") if [ -z "$(echo $ftp_path_a |grep $HOMEDIR/$user/web/$domain)" ]; then echo "Error: absolute path $ftp_path_a is invalid" - log_event "$E_INVALID" "$EVENT" + log_event "$E_INVALID" "$ARGUMENTS" exit $E_INVALID fi @@ -84,6 +84,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$FTP_PATH' "$ftp_path" # Logging log_history "changed path to $ftp_path_a for $ftp_user@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-change-web-domain-httpauth b/bin/v-change-web-domain-httpauth index 3483838c..91ed166d 100755 --- a/bin/v-change-web-domain-httpauth +++ b/bin/v-change-web-domain-httpauth @@ -29,7 +29,7 @@ htpasswd="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.htpasswd" #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN AUTH_USER AUTH_PASSWORD [RESTART]' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -39,7 +39,7 @@ is_password_valid get_domain_values 'web' if [ -z "$(echo "$AUTH_USER" |tr : '\n' |grep ^$auth_user$)" ]; then echo "Error: auth user $auth_user doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -71,6 +71,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$AUTH_HASH' "$auth_hash" # Logging log_history "changed auth user $httpauth_user password on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-check-user-password b/bin/v-check-user-password index 1eecc3dd..73a44be6 100755 --- a/bin/v-check-user-password +++ b/bin/v-check-user-password @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER PASSWORD' -validate_format 'user' +is_format_valid 'user' # Checking user if [ ! -d "$VESTA/data/users/$user" ] && [ "$user" != 'root' ]; then diff --git a/bin/v-deactivate-vesta-license b/bin/v-deactivate-vesta-license index 13a400ab..ad8dc44b 100755 --- a/bin/v-deactivate-vesta-license +++ b/bin/v-deactivate-vesta-license @@ -60,6 +60,6 @@ if [ "$module" = 'SFTPJAIL' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-backup-host b/bin/v-delete-backup-host index 21e27221..d5d44756 100755 --- a/bin/v-delete-backup-host +++ b/bin/v-delete-backup-host @@ -25,7 +25,7 @@ check_args '1' "$#" 'TYPE [HOST]' types=$(echo "$BACKUP_SYSTEM" |sed "s/,/\n/g" |grep "^$type$") if [ -z "$types" ]; then echo "Error: invalid backup type" - log_event "$E_INVALID" "$EVENT" + log_event "$E_INVALID" "$ARGUMENTS" exit $E_INVALID fi @@ -51,6 +51,6 @@ bckp=$(echo "$BACKUP_SYSTEM" |\ sed -i "s/BACKUP_SYSTEM=.*/BACKUP_SYSTEM='$bckp'/g" $VESTA/conf/vesta.conf # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-cron-job b/bin/v-delete-cron-job index d41e0141..77668e17 100755 --- a/bin/v-delete-cron-job +++ b/bin/v-delete-cron-job @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER JOB' -validate_format 'user' 'job' +is_format_valid 'user' 'job' is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -58,6 +58,6 @@ check_result $? "Restart restart failed" >/dev/null # Logging log_history "deleted cron job $job" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-cron-reports b/bin/v-delete-cron-reports index 65c219a7..45fd88ca 100755 --- a/bin/v-delete-cron-reports +++ b/bin/v-delete-cron-reports @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -50,6 +50,6 @@ check_result $? "Cron restart failed" >/dev/null # Logging log_history "disabled cron reporting" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-cron-restart-job b/bin/v-delete-cron-restart-job index 0b27db2b..33c8c566 100755 --- a/bin/v-delete-cron-restart-job +++ b/bin/v-delete-cron-restart-job @@ -39,6 +39,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-cron-vesta-autoupdate b/bin/v-delete-cron-vesta-autoupdate index ec38facf..051bc764 100755 --- a/bin/v-delete-cron-vesta-autoupdate +++ b/bin/v-delete-cron-vesta-autoupdate @@ -56,6 +56,6 @@ $BIN/v-restart-cron check_result $? "Cron restart failed" >/dev/null # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-database b/bin/v-delete-database index e67eda7f..33ed53f1 100755 --- a/bin/v-delete-database +++ b/bin/v-delete-database @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DATABASE' -validate_format 'user' 'database' +is_format_valid 'user' 'database' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -60,6 +60,6 @@ decrease_user_value "$user" '$U_DATABASES' # Logging log_history "deleted $database database" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-database-host b/bin/v-delete-database-host index a5e8a91f..4a52be10 100755 --- a/bin/v-delete-database-host +++ b/bin/v-delete-database-host @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'TYPE HOST' -validate_format 'type' 'host' +is_format_valid 'type' 'host' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_type_valid "$DB_SYSTEM" "$type" is_object_valid "../../conf/$type" 'HOST' "$host" @@ -45,6 +45,6 @@ sed -i "/HOST='$host' /d" $VESTA/conf/$type.conf # Logging log_history "deleted $type database server $host" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-databases b/bin/v-delete-databases index 6edf5fb9..d771bba3 100755 --- a/bin/v-delete-databases +++ b/bin/v-delete-databases @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -43,6 +43,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-dns-domain b/bin/v-delete-dns-domain index b12d6296..5281a10a 100755 --- a/bin/v-delete-dns-domain +++ b/bin/v-delete-dns-domain @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -79,6 +79,6 @@ fi # Logging log_history "deleted dns domain $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-dns-domains b/bin/v-delete-dns-domains index 785e3d5b..f74b4e14 100755 --- a/bin/v-delete-dns-domains +++ b/bin/v-delete-dns-domains @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -49,6 +49,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-dns-domains-src b/bin/v-delete-dns-domains-src index 22f03984..6f1958c6 100755 --- a/bin/v-delete-dns-domains-src +++ b/bin/v-delete-dns-domains-src @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER SRC [RESTART]' -validate_format 'user' 'src' +is_format_valid 'user' 'src' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -50,6 +50,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-dns-on-web-alias b/bin/v-delete-dns-on-web-alias index 6cd93dff..74cc49f4 100755 --- a/bin/v-delete-dns-on-web-alias +++ b/bin/v-delete-dns-on-web-alias @@ -30,7 +30,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ALIAS' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -74,6 +74,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-dns-record b/bin/v-delete-dns-record index f838b9a0..1c713d01 100755 --- a/bin/v-delete-dns-record +++ b/bin/v-delete-dns-record @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ID [RESTART]' -validate_format 'user' 'domain' 'id' +is_format_valid 'user' 'domain' 'id' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" @@ -77,6 +77,6 @@ fi # Logging log_history "deleted dns record $id on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-domain b/bin/v-delete-domain index a1fff5ea..f5347846 100755 --- a/bin/v-delete-domain +++ b/bin/v-delete-domain @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -66,7 +66,7 @@ fi # Checking domain search result if [ -z "$domain_found" ]; then echo "Error: domain $domain doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi diff --git a/bin/v-delete-firewall-ban b/bin/v-delete-firewall-ban index 8bae0e2c..52f3403d 100755 --- a/bin/v-delete-firewall-ban +++ b/bin/v-delete-firewall-ban @@ -29,7 +29,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'IP CHAIN' -validate_format 'ip' 'chain' +is_format_valid 'ip' 'chain' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' @@ -59,6 +59,6 @@ chmod 660 $conf #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-firewall-chain b/bin/v-delete-firewall-chain index 917682b9..7e510d80 100755 --- a/bin/v-delete-firewall-chain +++ b/bin/v-delete-firewall-chain @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'CHAIN' -validate_format 'chain' +is_format_valid 'chain' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' @@ -61,6 +61,6 @@ chmod 660 $chains #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-firewall-rule b/bin/v-delete-firewall-rule index d37e8a18..8f646644 100755 --- a/bin/v-delete-firewall-rule +++ b/bin/v-delete-firewall-rule @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'RULE' -validate_format 'rule' +is_format_valid 'rule' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' is_object_valid '../../data/firewall/rules' 'RULE' "$rule" @@ -46,6 +46,6 @@ $BIN/v-update-firewall #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-account b/bin/v-delete-mail-account index 6ae7bfec..a16829a6 100755 --- a/bin/v-delete-mail-account +++ b/bin/v-delete-mail-account @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ACCOUNT' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -68,6 +68,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$ACCOUNTS' "$accounts" # Logging log_history "deleted $account@$domain mail account" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-account-alias b/bin/v-delete-mail-account-alias index 87a1213c..470fa859 100755 --- a/bin/v-delete-mail-account-alias +++ b/bin/v-delete-mail-account-alias @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT ALIAS' -validate_format 'user' 'domain' 'account' 'malias' +is_format_valid 'user' 'domain' 'account' 'malias' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -39,7 +39,7 @@ is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account" aliases=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$ALIAS') if [ -z "$(echo $aliases | grep -w $malias)" ]; then echo "Error: alias $malias doesn't exist" - log_event "$E_NOTEXIST $EVENT" + log_event "$E_NOTEXIST $ARGUMENTS" exit $E_NOTEXIST fi @@ -69,6 +69,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$ALIAS' "$aliases" # Logging log_history "deleted alias $malias on $account@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-account-autoreply b/bin/v-delete-mail-account-autoreply index 2f2ef486..67e79d89 100755 --- a/bin/v-delete-mail-account-autoreply +++ b/bin/v-delete-mail-account-autoreply @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ACCOUNT' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -60,7 +60,7 @@ rm -f $USER_DATA/mail/$domain/$account@$domain.msg update_object_value "mail/$domain" 'ACCOUNT' "$account" '$AUTOREPLY' 'no' # Logging -log_history "$EVENT" -log_event "$OK" "$EVENT" +log_history "$ARGUMENTS" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-account-forward b/bin/v-delete-mail-account-forward index a77b3d7e..ff289e35 100755 --- a/bin/v-delete-mail-account-forward +++ b/bin/v-delete-mail-account-forward @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '4' "$#" 'USER DOMAIN ACCOUNT FORWARD' -validate_format 'user' 'domain' 'account' 'forward' +is_format_valid 'user' 'domain' 'account' 'forward' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -39,7 +39,7 @@ is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account" fwd=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD') if [ -z "$(echo $fwd | grep -w $forward)" ]; then echo "Error: forward $forward doesn't exist" - log_event "$E_NOTEXIST $EVENT" + log_event "$E_NOTEXIST $ARGUMENTS" exit $E_NOTEXIST fi @@ -71,6 +71,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD' "$fwd" # Logging log_history "deleted $forward forward on $account@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-account-fwd-only b/bin/v-delete-mail-account-fwd-only index b437b7e3..dbc9a727 100755 --- a/bin/v-delete-mail-account-fwd-only +++ b/bin/v-delete-mail-account-fwd-only @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ACCOUNT' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -56,6 +56,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD_ONLY' '' # Logging log_history "deleted fwd_only flag for $account@$domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-domain b/bin/v-delete-mail-domain index a57e459d..4833e656 100755 --- a/bin/v-delete-mail-domain +++ b/bin/v-delete-mail-domain @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -79,6 +79,6 @@ decrease_user_value "$user" '$U_MAIL_ACCOUNTS' "$accounts" # Logging log_history "deleted mail domain $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-domain-antispam b/bin/v-delete-mail-domain-antispam index e33b266e..8ba2cfd0 100755 --- a/bin/v-delete-mail-domain-antispam +++ b/bin/v-delete-mail-domain-antispam @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,6 +54,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$ANTISPAM' 'no' # Logging log_history "disabled antispam support for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-domain-antivirus b/bin/v-delete-mail-domain-antivirus index 7473c125..baea4575 100755 --- a/bin/v-delete-mail-domain-antivirus +++ b/bin/v-delete-mail-domain-antivirus @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,6 +54,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$ANTIVIRUS' 'no' # Logging log_history "disabled antivirus support on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-domain-catchall b/bin/v-delete-mail-domain-catchall index 3791d7ad..549c5523 100755 --- a/bin/v-delete-mail-domain-catchall +++ b/bin/v-delete-mail-domain-catchall @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,6 +54,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' '' # Logging log_history "deleted catchall email on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-domain-dkim b/bin/v-delete-mail-domain-dkim index 88b480b0..e8e57cf4 100755 --- a/bin/v-delete-mail-domain-dkim +++ b/bin/v-delete-mail-domain-dkim @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -65,6 +65,6 @@ decrease_user_value "$user" '$U_MAIL_DKMI' # Logging log_history "disabled DKIM support on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-mail-domains b/bin/v-delete-mail-domains index 116e4874..e734f844 100755 --- a/bin/v-delete-mail-domains +++ b/bin/v-delete-mail-domains @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -42,6 +42,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-remote-dns-domain b/bin/v-delete-remote-dns-domain index b92aec22..5200030e 100755 --- a/bin/v-delete-remote-dns-domain +++ b/bin/v-delete-remote-dns-domain @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" diff --git a/bin/v-delete-remote-dns-host b/bin/v-delete-remote-dns-host index 9e4b7368..e6586739 100755 --- a/bin/v-delete-remote-dns-host +++ b/bin/v-delete-remote-dns-host @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'HOST' -validate_format 'host' +is_format_valid 'host' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid "../../conf/dns-cluster" 'HOST' "$host" @@ -60,6 +60,6 @@ fi # Logging log_history "deleted remote dns server $host" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-remote-dns-record b/bin/v-delete-remote-dns-record index eab802cc..cbc1d4c8 100755 --- a/bin/v-delete-remote-dns-record +++ b/bin/v-delete-remote-dns-record @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ID' -validate_format 'user' 'domain' 'id' +is_format_valid 'user' 'domain' 'id' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" diff --git a/bin/v-delete-sys-firewall b/bin/v-delete-sys-firewall index 86b0ff5d..75b78794 100755 --- a/bin/v-delete-sys-firewall +++ b/bin/v-delete-sys-firewall @@ -43,6 +43,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-sys-ip b/bin/v-delete-sys-ip index 17ea1612..3ef1548a 100755 --- a/bin/v-delete-sys-ip +++ b/bin/v-delete-sys-ip @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'IP' -validate_format 'ip' +is_format_valid 'ip' is_ip_valid "$ip" is_ip_key_empty '$U_WEB_DOMAINS' is_ip_key_empty '$U_SYS_USERS' @@ -43,7 +43,7 @@ cidr=$(convert_netmask $NETMASK) interface=$(/sbin/ip addr | grep "$ip/$cidr" | awk '{print $NF}') if [ ! -z "$interface" ] && [ -z "$(echo $interface |cut -s -f2 -d :)" ]; then echo "Error: can't delete main IP address" - log_event "$E_FORBIDEN" "$EVENT" + log_event "$E_FORBIDEN" "$ARGUMENTS" exit $E_FORBIDEN fi @@ -52,7 +52,7 @@ if [ ! -z "$interface" ]; then /sbin/ip addr del $ip/$cidr dev $INTERFACE if [ "$?" -ne 0 ]; then echo "Error: can't delete system ip" - log_event "$E_FORBIDEN" "$EVENT" + log_event "$E_FORBIDEN" "$ARGUMENTS" exit $E_FORBIDEN fi fi @@ -138,6 +138,6 @@ fi # Logging log_history "deleted system ip address $ip" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-sys-quota b/bin/v-delete-sys-quota index b2a5d27b..4b8913bf 100755 --- a/bin/v-delete-sys-quota +++ b/bin/v-delete-sys-quota @@ -63,6 +63,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-sys-sftp-jail b/bin/v-delete-sys-sftp-jail index 103b41a9..c48fd65f 100755 --- a/bin/v-delete-sys-sftp-jail +++ b/bin/v-delete-sys-sftp-jail @@ -84,6 +84,6 @@ sed -i "/v-add-sys-sftp-jail/d" /etc/rc.local 2>/dev/null #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-user-backup b/bin/v-delete-user-backup index 00b7e86b..4a71a40b 100755 --- a/bin/v-delete-user-backup +++ b/bin/v-delete-user-backup @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER BACKUP' -validate_format 'user' 'backup' +is_format_valid 'user' 'backup' is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -48,6 +48,6 @@ update_user_value "$user" '$U_BACKUPS' "$U_BACKUPS" # Logging log_history "deleted backup archive $backup" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-user-favourites b/bin/v-delete-user-favourites index 8efffe08..374fa430 100755 --- a/bin/v-delete-user-favourites +++ b/bin/v-delete-user-favourites @@ -27,10 +27,10 @@ source $VESTA/conf/vesta.conf check_args '3' "$#" 'USER SYSTEM OBJECT' case $system in - MAIL_ACC) validate_format 'email' ;; - CRON) validate_format 'id' ;; - DNS_REC) validate_format 'id' ;; - *) validate_format 'object' + MAIL_ACC) is_format_valid 'email' ;; + CRON) is_format_valid 'id' ;; + DNS_REC) is_format_valid 'id' ;; + *) is_format_valid 'object' esac is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -119,6 +119,6 @@ chmod 640 $USER_DATA/favourites.conf # Logging log_history "deleted starred $object from $system listing" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-user-ips b/bin/v-delete-user-ips index 292ce809..7f8e3224 100755 --- a/bin/v-delete-user-ips +++ b/bin/v-delete-user-ips @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" if [ "$user" = 'admin' ]; then @@ -58,6 +58,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-user-notification b/bin/v-delete-user-notification index c9e32607..6b223e0b 100755 --- a/bin/v-delete-user-notification +++ b/bin/v-delete-user-notification @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER NOTIFICATION' -validate_format 'user' 'nid' +is_format_valid 'user' 'nid' is_object_valid 'user' 'USER' "$user" @@ -61,6 +61,6 @@ if [ "$notice" = 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-user-package b/bin/v-delete-user-package index 8ce2195a..dbd75a86 100755 --- a/bin/v-delete-user-package +++ b/bin/v-delete-user-package @@ -22,7 +22,7 @@ is_package_in_use() { check_package=$(grep "PACKAGE='$package'" $USER_DATA/*/user.conf) if [ ! -z "$check_package" ]; then echo "Error: package $package is in use" - log_event "$E_INUSE" "$EVENT" + log_event "$E_INUSE" "$ARGUMENTS" exit $E_INUSE fi } @@ -32,7 +32,7 @@ is_package_in_use() { #----------------------------------------------------------# check_args '1' "$#" 'PACKAGE' -validate_format 'package' +is_format_valid 'package' is_package_valid is_package_in_use @@ -50,6 +50,6 @@ rm -f $VESTA/data/packages/$package.pkg #----------------------------------------------------------# log_history "deleted user package $package" '' 'admin' -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-user-sftp-jail b/bin/v-delete-user-sftp-jail index e25121a9..d6f51544 100755 --- a/bin/v-delete-user-sftp-jail +++ b/bin/v-delete-user-sftp-jail @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' user_str=$(grep "^$user:" /etc/passwd) if [ -z "$user_str" ]; then exit @@ -58,6 +58,6 @@ gpasswd -d $user sftp-only >/dev/null 2>&1 #----------------------------------------------------------# # Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-web-domain-ftp b/bin/v-delete-web-domain-ftp index 8368b179..b53440c4 100755 --- a/bin/v-delete-web-domain-ftp +++ b/bin/v-delete-web-domain-ftp @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN FTP_USER' -validate_format 'user' 'domain' 'ftp_user' +is_format_valid 'user' 'domain' 'ftp_user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -35,7 +35,7 @@ is_object_unsuspended 'web' 'DOMAIN' "$domain" get_domain_values 'web' if [ -z "$(echo $FTP_USER | tr ':' '\n' | grep ^$ftp_user$)" ]; then echo "Error: account $ftp_user doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -78,6 +78,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$FTP_PATH' "$ftp_path" # Logging log_history "deleted ftp account ${3} for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-web-domain-httpauth b/bin/v-delete-web-domain-httpauth index 96c7eed3..84f9767a 100755 --- a/bin/v-delete-web-domain-httpauth +++ b/bin/v-delete-web-domain-httpauth @@ -30,7 +30,7 @@ htpasswd="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.htpasswd" #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN AUTH_USER [RESTART]' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -40,7 +40,7 @@ is_password_valid get_domain_values 'web' if [ -z "$(echo "$AUTH_USER" |tr : '\n' |grep ^$auth_user$)" ]; then echo "Error: auth user $auth_user doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -82,6 +82,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$AUTH_HASH' "$auth_hash" # Logging log_history "changed auth user $httpauth_user password on $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-web-domain-stats b/bin/v-delete-web-domain-stats index bd5627a6..34c35f56 100755 --- a/bin/v-delete-web-domain-stats +++ b/bin/v-delete-web-domain-stats @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -65,6 +65,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$STATS' '' # Logging log_history "disabled web log analyzer for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-web-domain-stats-user b/bin/v-delete-web-domain-stats-user index 6e1008ba..c0067271 100755 --- a/bin/v-delete-web-domain-stats-user +++ b/bin/v-delete-web-domain-stats-user @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -56,6 +56,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$STATS_CRYPT' '' # Logging log_history "disabled web stats password protection for $domain" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-delete-web-domains b/bin/v-delete-web-domains index dec2156a..1406abb9 100755 --- a/bin/v-delete-web-domains +++ b/bin/v-delete-web-domains @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -54,6 +54,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-get-dns-domain-value b/bin/v-get-dns-domain-value index d8aa0179..1786e900 100755 --- a/bin/v-get-dns-domain-value +++ b/bin/v-get-dns-domain-value @@ -24,7 +24,7 @@ source $VESTA/func/main.sh #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN KEY' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" @@ -42,6 +42,6 @@ get_object_value 'dns' 'DOMAIN' "$domain" "$key" #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-get-mail-account-value b/bin/v-get-mail-account-value index 282c8198..556c61ce 100755 --- a/bin/v-get-mail-account-value +++ b/bin/v-get-mail-account-value @@ -25,7 +25,7 @@ source $VESTA/func/main.sh #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN KEY' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_object_valid 'user' 'USER' "$user" is_object_valid 'mail' 'DOMAIN' "$domain" is_object_valid "mail/$domain" 'ACCOUNT' "$account" @@ -44,6 +44,6 @@ get_object_value "mail/$domain" 'ACCOUNT' "$account" "$key" #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-get-mail-domain-value b/bin/v-get-mail-domain-value index da9abf16..616df282 100755 --- a/bin/v-get-mail-domain-value +++ b/bin/v-get-mail-domain-value @@ -24,7 +24,7 @@ source $VESTA/func/main.sh #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN KEY' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_object_valid 'user' 'USER' "$user" is_object_valid 'mail' 'DOMAIN' "$domain" @@ -42,6 +42,6 @@ get_object_value 'mail' 'DOMAIN' "$domain" "$key" #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-get-user-value b/bin/v-get-user-value index 415a764a..a832801a 100755 --- a/bin/v-get-user-value +++ b/bin/v-get-user-value @@ -22,7 +22,7 @@ source $VESTA/func/main.sh #----------------------------------------------------------# check_args '2' "$#" 'USER KEY' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" diff --git a/bin/v-get-web-domain-value b/bin/v-get-web-domain-value index 2c856937..eb6a63d0 100755 --- a/bin/v-get-web-domain-value +++ b/bin/v-get-web-domain-value @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN KEY' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_object_valid 'web' 'DOMAIN' "$domain" diff --git a/bin/v-insert-dns-domain b/bin/v-insert-dns-domain index be66b0a8..4c445e15 100755 --- a/bin/v-insert-dns-domain +++ b/bin/v-insert-dns-domain @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DATA [SRC] [FLUSH] [RESTART]' -validate_format 'user' 'data' +is_format_valid 'user' 'data' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,10 +54,15 @@ if [ "$flush" ! = 'no' ]; then sed -i "/DOMAIN='$DOMAIN'/d" $USER_DATA/dns.conf 2> /dev/null fi +# Generating timestamp +time_n_date=$(date +'%T %F') +time=$(echo "$time_n_date" |cut -f 1 -d \ ) +date=$(echo "$time_n_date" |cut -f 2 -d \ ) + # Prepare values for the insert dns_rec="DOMAIN='$DOMAIN' IP='$IP' TPL='$TPL' TTL='$TTL' EXP='$EXP'" dns_rec="$dns_rec SOA='$SOA' SERIAL="$SERIAL" SRC='$src' RECORDS='$RECORDS'" -dns_rec="$dns_rec SUSPENDED='$SUSPENDED' TIME='$TIME' DATE='$DATE'" +dns_rec="$dns_rec SUSPENDED='$SUSPENDED' TIME='$time' DATE='$date'" echo "$dns_rec" >> $USER_DATA/dns.conf # Set permission @@ -75,6 +80,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-insert-dns-record b/bin/v-insert-dns-record index 12bf1fd4..90205f61 100755 --- a/bin/v-insert-dns-record +++ b/bin/v-insert-dns-record @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN DATA [RESTART]' -validate_format 'user' 'domain' 'data' +is_format_valid 'user' 'domain' 'data' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -51,6 +51,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-insert-dns-records b/bin/v-insert-dns-records index 9030ba74..3ce767f8 100755 --- a/bin/v-insert-dns-records +++ b/bin/v-insert-dns-records @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN DATAFILE [RESTART]' -validate_format 'user' 'domain' 'data_file' +is_format_valid 'user' 'domain' 'data_file' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,6 +54,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-rebuild-cron-jobs b/bin/v-rebuild-cron-jobs index 0d75000e..5acc830d 100755 --- a/bin/v-rebuild-cron-jobs +++ b/bin/v-rebuild-cron-jobs @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -47,6 +47,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-rebuild-databases b/bin/v-rebuild-databases index 4d50a09d..0b8f4a2d 100755 --- a/bin/v-rebuild-databases +++ b/bin/v-rebuild-databases @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -67,6 +67,6 @@ update_user_value "$user" '$U_DISK_DB' "$U_DISK_DB" #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-rebuild-dns-domain b/bin/v-rebuild-dns-domain index 3e123992..2aa34f6f 100755 --- a/bin/v-rebuild-dns-domain +++ b/bin/v-rebuild-dns-domain @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN [RESTART] [UPDATE_SERIAL]' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -88,6 +88,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-rebuild-dns-domains b/bin/v-rebuild-dns-domains index e3303de6..4bb537ab 100755 --- a/bin/v-rebuild-dns-domains +++ b/bin/v-rebuild-dns-domains @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART] [UPDATE_SERIAL]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -89,6 +89,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-rebuild-mail-domains b/bin/v-rebuild-mail-domains index 8e101a94..82b7fa14 100755 --- a/bin/v-rebuild-mail-domains +++ b/bin/v-rebuild-mail-domains @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -70,6 +70,6 @@ update_user_value "$user" '$U_DISK_MAIL' "$U_DISK_MAIL" recalc_user_disk_usage # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-rebuild-user b/bin/v-rebuild-user index 52385694..6a2b4d03 100755 --- a/bin/v-rebuild-user +++ b/bin/v-rebuild-user @@ -27,7 +27,7 @@ export PATH=$PATH:/usr/sbin #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -50,6 +50,6 @@ rebuild_user_conf #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-restore-user b/bin/v-restore-user index a1daaa34..d2a7eae5 100755 --- a/bin/v-restore-user +++ b/bin/v-restore-user @@ -40,7 +40,7 @@ source $VESTA/conf/vesta.conf is_backup_valid() { if [ ! -e "$BACKUP/$backup" ]; then echo "Error: backup doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi } @@ -52,7 +52,7 @@ is_backup_valid() { args_usage='USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR] [NOTIFY]' check_args '2' "$#" "$args_usage" -validate_format 'user' 'backup' +is_format_valid 'user' 'backup' is_backup_valid is_backup_available @@ -92,7 +92,7 @@ if [ "$disk_usage" -ge "$BACKUP_DISK_LIMIT" ]; then echo "Not enough disk space to run restore" | $send_mail -s "$subj" $email echo "Error: Not enough disk space" sed -i "/ $user /d" $VESTA/data/queue/backup.pipe - log_event "$E_DISK" "$EVENT" + log_event "$E_DISK" "$ARGUMENTS" exit $E_DISK fi @@ -107,7 +107,7 @@ while [ "$la" -ge "$BACKUP_LA_LIMIT" ]; do echo "LoadAverage $i is above threshold" |$send_mail -s "$subj" $email echo "Error: LA is too high" sed -i "/ $user /d" $VESTA/data/queue/backup.pipe - log_event "$E_LA" "$EVENT" + log_event "$E_LA" "$ARGUMENTS" exit $E_LA fi (( ++i)) @@ -118,7 +118,7 @@ tmpdir=$(mktemp -p $BACKUP -d) if [ "$?" -ne 0 ]; then echo "Can't create tmp dir $tmpdir" | $send_mail -s "$subj" $email echo "Error: can't create tmp dir" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -208,7 +208,7 @@ if [ "$web" != 'no' ]; then echo "Web domain $domain belongs to another user" |\ $send_mail -s "$subj" $email rm -rf $tmpdir - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi @@ -236,7 +236,7 @@ if [ "$web" != 'no' ]; then echo "Error: no avaiable IP address" echo "No available IP address" |\ $send_mail -s "$subj" $email - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi echo "$IP" > $tmpdir/ip_mapping.$domain @@ -250,7 +250,7 @@ if [ "$web" != 'no' ]; then echo "Error: no avaiable web template" echo "No available web template" |\ $send_mail -s "$subj" $email - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi fi @@ -263,7 +263,7 @@ if [ "$web" != 'no' ]; then echo "Error: no avaiable proxy template" echo "No available proxy tpl" |\ $send_mail -s "$subj" $email - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi fi @@ -467,7 +467,7 @@ if [ "$dns" != 'no' ]; then echo "DNS domain $domain belongs to another user" |\ $send_mail -s "$subj" $email rm -rf $tmpdir - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi @@ -487,7 +487,7 @@ if [ "$dns" != 'no' ]; then if [ -z "$IP" ]; then echo "Error: no avaiable IP address" echo "No available IP address" | $send_mail -s "$subj" $email - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi @@ -507,7 +507,7 @@ if [ "$dns" != 'no' ]; then echo "Error: no avaiable dns template" echo "No available dns template" |\ $send_mail -s "$subj" $email - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi fi @@ -595,7 +595,7 @@ if [ "$mail" != 'no' ]; then echo "Mail domain $domain belongs to another user" |\ $send_mail -s "$subj" $email rm -rf $tmpdir - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi @@ -844,6 +844,6 @@ $BIN/v-update-user-counters admin $BIN/v-update-sys-ip-counters # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-schedule-user-backup b/bin/v-schedule-user-backup index 404f012e..dcbcedb6 100755 --- a/bin/v-schedule-user-backup +++ b/bin/v-schedule-user-backup @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM' is_object_valid 'user' 'USER' "$user" is_backup_enabled @@ -44,6 +44,6 @@ echo "$BIN/v-backup-user $user yes >> $log 2>&1" >>\ #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-schedule-user-restore b/bin/v-schedule-user-restore index e91f0cac..031b024e 100755 --- a/bin/v-schedule-user-restore +++ b/bin/v-schedule-user-restore @@ -29,7 +29,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM' is_object_valid 'user' 'USER' "$user" is_backup_enabled @@ -52,6 +52,6 @@ echo "$BIN/v-restore-user $user $backup $options yes >> $log 2>&1" >>\ #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-search-domain-owner b/bin/v-search-domain-owner index 146a0b4c..5b88f495 100755 --- a/bin/v-search-domain-owner +++ b/bin/v-search-domain-owner @@ -50,6 +50,6 @@ echo $owner #----------------------------------------------------------# # Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-search-object b/bin/v-search-object index a15bc9ed..c642b3e6 100755 --- a/bin/v-search-object +++ b/bin/v-search-object @@ -71,7 +71,7 @@ shell_list_search() { #----------------------------------------------------------# check_args '1' "$#" 'OBJECT [FORMAT]' -validate_format 'object' +is_format_valid 'object' #----------------------------------------------------------# @@ -253,6 +253,6 @@ rm $conf #----------------------------------------------------------# # Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-search-user-object b/bin/v-search-user-object index 28ca2a1e..3e25372d 100755 --- a/bin/v-search-user-object +++ b/bin/v-search-user-object @@ -72,7 +72,7 @@ shell_list_search() { #----------------------------------------------------------# check_args '2' "$#" 'USER OBJECT [FORMAT]' -validate_format 'user' 'object' +is_format_valid 'user' 'object' is_object_valid 'user' 'USER' "$user" @@ -253,6 +253,6 @@ rm $conf #----------------------------------------------------------# # Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-cron-job b/bin/v-suspend-cron-job index 78e75da6..499c0772 100755 --- a/bin/v-suspend-cron-job +++ b/bin/v-suspend-cron-job @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER JOB [RESTART]' -validate_format 'user' 'job' +is_format_valid 'user' 'job' is_object_valid 'user' 'USER' "$user" is_object_valid 'cron' 'JOB' "$job" is_object_unsuspended 'cron' 'JOB' "$job" @@ -53,6 +53,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-cron-jobs b/bin/v-suspend-cron-jobs index f53facf4..935347ad 100755 --- a/bin/v-suspend-cron-jobs +++ b/bin/v-suspend-cron-jobs @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" @@ -48,6 +48,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-database b/bin/v-suspend-database index e8348873..ac736ea1 100755 --- a/bin/v-suspend-database +++ b/bin/v-suspend-database @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DATABASE' -validate_format 'user' 'database' +is_format_valid 'user' 'database' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -55,6 +55,6 @@ update_object_value 'db' 'DB' "$database" '$SUSPENDED' 'yes' increase_user_value "$user" '$SUSPENDED_DB' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-database-host b/bin/v-suspend-database-host index 03cdd9de..daf39adc 100755 --- a/bin/v-suspend-database-host +++ b/bin/v-suspend-database-host @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'TYPE HOST' -validate_format 'type' 'host' +is_format_valid 'type' 'host' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid "../../conf/$type" 'HOST' "$host" is_object_unsuspended "../../conf/$type" 'HOST' "$host" @@ -42,6 +42,6 @@ update_object_value "../../conf/$type" 'HOST' "$host" '$SUSPENDED' 'yes' #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-databases b/bin/v-suspend-databases index d1a7104c..6c15b014 100755 --- a/bin/v-suspend-databases +++ b/bin/v-suspend-databases @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -42,6 +42,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-dns-domain b/bin/v-suspend-dns-domain index be32feb5..ebe45e3a 100755 --- a/bin/v-suspend-dns-domain +++ b/bin/v-suspend-dns-domain @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN [RESTART]' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" @@ -47,6 +47,6 @@ sed -i "s/SUSPENDED='no'/SUSPENDED='yes'/g" $USER_DATA/dns/$domain.conf increase_user_value "$user" '$SUSPENDED_DNS' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-dns-domains b/bin/v-suspend-dns-domains index d561495b..c38e4336 100755 --- a/bin/v-suspend-dns-domains +++ b/bin/v-suspend-dns-domains @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -43,6 +43,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-dns-record b/bin/v-suspend-dns-record index 0a68f8ce..811965f9 100755 --- a/bin/v-suspend-dns-record +++ b/bin/v-suspend-dns-record @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ID [RESTART]' -validate_format 'user' 'domain' 'id' +is_format_valid 'user' 'domain' 'id' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" @@ -64,6 +64,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-domain b/bin/v-suspend-domain index fabbb2de..6f017534 100755 --- a/bin/v-suspend-domain +++ b/bin/v-suspend-domain @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -66,7 +66,7 @@ fi # Checking domain search result if [ -z "$domain_found" ]; then echo "Error: domain $domain doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi diff --git a/bin/v-suspend-firewall-rule b/bin/v-suspend-firewall-rule index dffeba71..67f14cec 100755 --- a/bin/v-suspend-firewall-rule +++ b/bin/v-suspend-firewall-rule @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'RULE' -validate_format 'rule' +is_format_valid 'rule' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' is_object_valid '../../data/firewall/rules' 'RULE' "$rule" is_object_unsuspended '../../data/firewall/rules' 'RULE' "$rule" @@ -44,6 +44,6 @@ $BIN/v-update-firewall #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-mail-account b/bin/v-suspend-mail-account index 7ea2bc6a..ba11c8e0 100755 --- a/bin/v-suspend-mail-account +++ b/bin/v-suspend-mail-account @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ACCOUNT' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -57,6 +57,6 @@ fi update_object_value "mail/$domain" 'ACCOUNT' "$account" '$SUSPENDED' 'yes' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-mail-accounts b/bin/v-suspend-mail-accounts index d8cae620..a62069cf 100755 --- a/bin/v-suspend-mail-accounts +++ b/bin/v-suspend-mail-accounts @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -48,6 +48,6 @@ done #----------------------------------------------------------# # No Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-mail-domain b/bin/v-suspend-mail-domain index 93a1328c..afdc1f3d 100755 --- a/bin/v-suspend-mail-domain +++ b/bin/v-suspend-mail-domain @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -54,6 +54,6 @@ sed -i "s/SUSPENDED='no'/SUSPENDED='yes'/g" $USER_DATA/mail/$domain.conf increase_user_value "$user" '$SUSPENDED_MAIL' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-mail-domains b/bin/v-suspend-mail-domains index 61e2dda8..333228ee 100755 --- a/bin/v-suspend-mail-domains +++ b/bin/v-suspend-mail-domains @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -43,6 +43,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-remote-dns-host b/bin/v-suspend-remote-dns-host index c44e6573..f83b6172 100755 --- a/bin/v-suspend-remote-dns-host +++ b/bin/v-suspend-remote-dns-host @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'HOST' -validate_format 'host' +is_format_valid 'host' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid "../../conf/dns-cluster" 'HOST' "$host" is_object_unsuspended "../../conf/dns-cluster" 'HOST' "$host" @@ -41,6 +41,6 @@ update_object_value "../../conf/dns-cluster" 'HOST' "$host" '$SUSPENDED' 'yes' #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-user b/bin/v-suspend-user index aba883ac..6d049056 100755 --- a/bin/v-suspend-user +++ b/bin/v-suspend-user @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" if [ "$user" = 'admin' ]; then @@ -90,6 +90,6 @@ update_user_value "$user" '$SUSPENDED' 'yes' increase_user_value 'admin' '$SUSPENDED_USERS' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-suspend-web-domains b/bin/v-suspend-web-domains index 0f4c3116..be480390 100755 --- a/bin/v-suspend-web-domains +++ b/bin/v-suspend-web-domains @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -54,6 +54,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-cron-job b/bin/v-unsuspend-cron-job index b2fa0f79..108ddf90 100755 --- a/bin/v-unsuspend-cron-job +++ b/bin/v-unsuspend-cron-job @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER JOB [RESTART]' -validate_format 'user' 'job' 'restart' +is_format_valid 'user' 'job' 'restart' is_object_valid 'user' 'USER' "$user" is_object_valid 'cron' 'JOB' "$job" is_object_suspended 'cron' 'JOB' "$job" @@ -53,6 +53,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-cron-jobs b/bin/v-unsuspend-cron-jobs index f7b5e876..bc4cfc4e 100755 --- a/bin/v-unsuspend-cron-jobs +++ b/bin/v-unsuspend-cron-jobs @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" @@ -48,6 +48,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-database b/bin/v-unsuspend-database index ea58389c..89892cb7 100755 --- a/bin/v-unsuspend-database +++ b/bin/v-unsuspend-database @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DATABASE' -validate_format 'user' 'database' +is_format_valid 'user' 'database' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_valid 'db' 'DB' "$database" @@ -54,6 +54,6 @@ update_object_value 'db' 'DB' "$database" '$SUSPENDED' 'no' decrease_user_value "$user" '$SUSPENDED_DB' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-database-host b/bin/v-unsuspend-database-host index e9e7b80d..928776a5 100755 --- a/bin/v-unsuspend-database-host +++ b/bin/v-unsuspend-database-host @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'TYPE HOST' -validate_format 'type' 'host' +is_format_valid 'type' 'host' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid "../../conf/$type" 'HOST' "$host" is_object_suspended "../../conf/$type" 'HOST' "$host" @@ -42,6 +42,6 @@ update_object_value "../../conf/$type" 'HOST' "$host" '$SUSPENDED' 'no' #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-databases b/bin/v-unsuspend-databases index 52d153af..30525c86 100755 --- a/bin/v-unsuspend-databases +++ b/bin/v-unsuspend-databases @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -43,6 +43,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-dns-domain b/bin/v-unsuspend-dns-domain index e7c41284..49a54091 100755 --- a/bin/v-unsuspend-dns-domain +++ b/bin/v-unsuspend-dns-domain @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" @@ -48,6 +48,6 @@ decrease_user_value "$user" '$SUSPENDED_DNS' sed -i "s/SUSPENDED='yes'/SUSPENDED='no'/g" $USER_DATA/dns/$domain.conf # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-dns-domains b/bin/v-unsuspend-dns-domains index 083dc3d3..eb27ba2e 100755 --- a/bin/v-unsuspend-dns-domains +++ b/bin/v-unsuspend-dns-domains @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -43,6 +43,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-dns-record b/bin/v-unsuspend-dns-record index 963e9676..2f27a5ae 100755 --- a/bin/v-unsuspend-dns-record +++ b/bin/v-unsuspend-dns-record @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ID [RESTART]' -validate_format 'user' 'domain' 'id' +is_format_valid 'user' 'domain' 'id' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" @@ -63,6 +63,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-domain b/bin/v-unsuspend-domain index 32920c31..294b485c 100755 --- a/bin/v-unsuspend-domain +++ b/bin/v-unsuspend-domain @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_object_valid 'user' 'USER' "$user" @@ -65,7 +65,7 @@ fi # Checking domain search result if [ -z "$domain_found" ]; then echo "Error: domain $domain doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi diff --git a/bin/v-unsuspend-firewall-rule b/bin/v-unsuspend-firewall-rule index f2d27a48..be6320d4 100755 --- a/bin/v-unsuspend-firewall-rule +++ b/bin/v-unsuspend-firewall-rule @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'RULE' -validate_format 'rule' +is_format_valid 'rule' is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' is_object_valid '../../data/firewall/rules' 'RULE' "$rule" is_object_suspended '../../data/firewall/rules' 'RULE' "$rule" @@ -44,6 +44,6 @@ $BIN/v-update-firewall #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-mail-account b/bin/v-unsuspend-mail-account index 98936101..0137f865 100755 --- a/bin/v-unsuspend-mail-account +++ b/bin/v-unsuspend-mail-account @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '3' "$#" 'USER DOMAIN ACCOUNT' -validate_format 'user' 'domain' 'account' +is_format_valid 'user' 'domain' 'account' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -58,6 +58,6 @@ fi update_object_value "mail/$domain" 'ACCOUNT' "$account" '$SUSPENDED' 'no' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-mail-accounts b/bin/v-unsuspend-mail-accounts index d78165f6..5ad6285d 100755 --- a/bin/v-unsuspend-mail-accounts +++ b/bin/v-unsuspend-mail-accounts @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -48,6 +48,6 @@ done #----------------------------------------------------------# # No Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-mail-domain b/bin/v-unsuspend-mail-domain index 8cf65fa9..ad9df12e 100755 --- a/bin/v-unsuspend-mail-domain +++ b/bin/v-unsuspend-mail-domain @@ -26,7 +26,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_valid 'mail' 'DOMAIN' "$domain" @@ -53,6 +53,6 @@ sed -i "s/SUSPENDED='yes'/SUSPENDED='no'/g" $USER_DATA/mail/$domain.conf decrease_user_value "$user" '$SUSPENDED_MAIL' # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-mail-domains b/bin/v-unsuspend-mail-domains index 30d70a9a..6e319c94 100755 --- a/bin/v-unsuspend-mail-domains +++ b/bin/v-unsuspend-mail-domains @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -43,6 +43,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-remote-dns-host b/bin/v-unsuspend-remote-dns-host index 4e002365..8e3308bf 100755 --- a/bin/v-unsuspend-remote-dns-host +++ b/bin/v-unsuspend-remote-dns-host @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'HOST' -validate_format 'host' +is_format_valid 'host' is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM' is_object_valid "../../conf/dns-cluster" 'HOST' "$host" is_object_suspended "../../conf/dns-cluster" 'HOST' "$host" @@ -41,6 +41,6 @@ update_object_value "../../conf/dns-cluster" 'HOST' "$host" '$SUSPENDED' 'no' #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-user b/bin/v-unsuspend-user index cfba10ab..1d3feecd 100755 --- a/bin/v-unsuspend-user +++ b/bin/v-unsuspend-user @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" if [ "$user" = 'admin' ]; then exit @@ -89,6 +89,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-unsuspend-web-domains b/bin/v-unsuspend-web-domains index a07ca86a..b9f4d1e4 100755 --- a/bin/v-unsuspend-web-domains +++ b/bin/v-unsuspend-web-domains @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER [RESTART]' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -55,6 +55,6 @@ if [ "$restart" != 'no' ]; then fi # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-database-disk b/bin/v-update-database-disk index 77768c1d..5365177a 100755 --- a/bin/v-update-database-disk +++ b/bin/v-update-database-disk @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DATABASE' -validate_format 'user' 'database' +is_format_valid 'user' 'database' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -55,6 +55,6 @@ update_object_value 'db' 'DB' "$database" '$U_DISK' "$usage" recalc_user_disk_usage # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-databases-disk b/bin/v-update-databases-disk index 066dde38..fd2c3474 100755 --- a/bin/v-update-databases-disk +++ b/bin/v-update-databases-disk @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -42,6 +42,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-dns-templates b/bin/v-update-dns-templates index a5f4a14b..1db87781 100755 --- a/bin/v-update-dns-templates +++ b/bin/v-update-dns-templates @@ -28,7 +28,7 @@ cd $tmpdir wget http://c.vestacp.com/$VERSION/rhel/templates.tar.gz -q if [ "$?" -ne 0 ]; then echo "Error: can't download template.tar.gz" - log_event "$E_CONNECT" "$EVENT" + log_event "$E_CONNECT" "$ARGUMENTS" rm -rf $tmpdir exit $E_CONNECT fi diff --git a/bin/v-update-mail-domain-disk b/bin/v-update-mail-domain-disk index c5bf5ba5..68d58a61 100755 --- a/bin/v-update-mail-domain-disk +++ b/bin/v-update-mail-domain-disk @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -62,6 +62,6 @@ update_object_value 'mail' 'DOMAIN' "$domain" '$U_DISK' "$dom_diks" recalc_user_disk_usage # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-mail-domains-disk b/bin/v-update-mail-domains-disk index 58ad8f04..ca93627f 100755 --- a/bin/v-update-mail-domains-disk +++ b/bin/v-update-mail-domains-disk @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM' is_object_valid 'user' 'USER' "$user" if [ -z "$MAIL_SYSTEM" ] || [ "$MAIL_SYSTEM" = 'remote' ]; then @@ -60,6 +60,6 @@ done recalc_user_disk_usage # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-sys-ip b/bin/v-update-sys-ip index f995c1af..b783b177 100755 --- a/bin/v-update-sys-ip +++ b/bin/v-update-sys-ip @@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '0' "$#" '[USER] [IP_STATUS]' -validate_format 'user' 'ip_status' +is_format_valid 'user' 'ip_status' is_object_valid 'user' 'USER' "$user" "$user" diff --git a/bin/v-update-sys-ip-counters b/bin/v-update-sys-ip-counters index dc8c561c..54711f92 100755 --- a/bin/v-update-sys-ip-counters +++ b/bin/v-update-sys-ip-counters @@ -24,7 +24,7 @@ source $VESTA/conf/vesta.conf check_args '0' "$#" 'IP' if [ ! -z "$ip" ]; then - validate_format 'ip' + is_format_valid 'ip' is_ip_valid fi @@ -60,6 +60,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-sys-queue b/bin/v-update-sys-queue index 56842b48..77da8ee4 100755 --- a/bin/v-update-sys-queue +++ b/bin/v-update-sys-queue @@ -63,6 +63,6 @@ esac #----------------------------------------------------------# # No Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-sys-rrd b/bin/v-update-sys-rrd index f8633aa7..77412eaf 100755 --- a/bin/v-update-sys-rrd +++ b/bin/v-update-sys-rrd @@ -138,6 +138,6 @@ done #----------------------------------------------------------# # No Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-sys-rrd-mysql b/bin/v-update-sys-rrd-mysql index c045057f..0d870e44 100755 --- a/bin/v-update-sys-rrd-mysql +++ b/bin/v-update-sys-rrd-mysql @@ -78,7 +78,7 @@ for host in $hosts; do # Checking empty vars if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ]; then echo "Error: config is broken" - log_event "$E_PARSING" "$EVENT" + log_event "$E_PARSING" "$ARGUMENTS" exit $E_PARSING fi diff --git a/bin/v-update-sys-rrd-net b/bin/v-update-sys-rrd-net index 542c00cf..e9c642e4 100755 --- a/bin/v-update-sys-rrd-net +++ b/bin/v-update-sys-rrd-net @@ -40,6 +40,9 @@ ndev=$(cat /proc/net/dev) ifaces=$(echo "$ndev" |grep : |cut -f 1 -d : | sed "s/ //g") # Parsing excludes +if [ -z "$RRD_IFACE_EXCLUDE" ]; then + RRD_IFACE_EXCLUDE='lo' +fi for exclude in $(echo ${RRD_IFACE_EXCLUDE//,/ }); do ifaces=$(echo "$ifaces" |grep -vw "$exclude" ) done diff --git a/bin/v-update-sys-rrd-pgsql b/bin/v-update-sys-rrd-pgsql index 3eeb16ab..9c8e3cb7 100755 --- a/bin/v-update-sys-rrd-pgsql +++ b/bin/v-update-sys-rrd-pgsql @@ -80,7 +80,7 @@ for host in $hosts; do # Checking empty vars if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ]; then echo "Error: config is broken" - log_event "$E_PARSING" "$EVENT" + log_event "$E_PARSING" "$ARGUMENTS" exit $E_PARSING fi diff --git a/bin/v-update-sys-vesta b/bin/v-update-sys-vesta index a03470e9..a42e4d71 100755 --- a/bin/v-update-sys-vesta +++ b/bin/v-update-sys-vesta @@ -59,6 +59,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-user-backup-exclusions b/bin/v-update-user-backup-exclusions index ed90e9d9..9a7a4a1d 100755 --- a/bin/v-update-user-backup-exclusions +++ b/bin/v-update-user-backup-exclusions @@ -20,7 +20,7 @@ source $VESTA/conf/vesta.conf is_file_available() { if [ ! -e "$vfile" ]; then echo "Error: file $vfile doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi } @@ -30,7 +30,7 @@ is_file_valid() { vcontent=$(cat $vfile) if [[ "$vcontent" =~ $exclude ]]; then echo "Error: invalid characters in the exlusion list" - log_event "$E_INVALID" "$EVENT" + log_event "$E_INVALID" "$ARGUMENTS" exit $E_INVALID fi } @@ -41,7 +41,7 @@ is_file_valid() { #----------------------------------------------------------# check_args '2' "$#" 'USER FILE' -validate_format 'user' 'vfile' +is_format_valid 'user' 'vfile' is_object_valid 'user' 'USER' "$user" is_file_available is_file_valid @@ -78,6 +78,6 @@ chmod 660 $USER_DATA/backup-excludes.conf # Logging log_history "updated exlusion list" -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-user-backups b/bin/v-update-user-backups index 6dfe3299..4125a6bb 100755 --- a/bin/v-update-user-backups +++ b/bin/v-update-user-backups @@ -151,7 +151,7 @@ init_ftp_variables() { if [ -z "$HOST" ] || [ -z "$USERNAME" ] || [ -z "$PASSWORD" ] ||\ [ -z "$BPATH" ]; then echo "Error: Parsing error" - log_event "$E_PARSING" "$EVENT" + log_event "$E_PARSING" "$ARGUMENTS" exit $E_PARSING fi } @@ -163,7 +163,7 @@ check_ftp_connection(){ rm $ftmpdir" if [ ! -z "$(ftpc "$command")" ] ; then echo "Error: FTP error" - log_event "$E_FTP" "$EVENT" + log_event "$E_FTP" "$ARGUMENTS" exit $E_FTP fi } @@ -176,11 +176,11 @@ check_ftp_connection(){ check_args '1' "$#" 'USER' is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" la=$(cat /proc/loadavg |cut -f 1 -d ' '|cut -f 1 -d '.') if [ "$la" -ge "$BACKUP_LA_LIMIT" ]; then - log_event "$E_LA" "$EVENT" + log_event "$E_LA" "$ARGUMENTS" exit $E_LA fi @@ -215,7 +215,7 @@ if [ "$type" = 'ftp' ]; then cd $tmpdir if [ ! -z "$(ftpc "get $backup")" ]; then echo "Error: FTP transfer error" - log_event "$E_FTP" "$EVENT" + log_event "$E_FTP" "$ARGUMENTS" exit $E_FTP fi get_backup_info $tmpdir/$backup $type >> $tmp_file @@ -242,7 +242,7 @@ if [ "$type" = 'ftp,local' ] || [ "$type" = 'local,ftp' ]; then cd $tmpdir if [ ! -z "$(ftpc "get $backup")" ]; then echo "Error: FTP transfer error" - log_event "$E_FTP" "$EVENT" + log_event "$E_FTP" "$ARGUMENTS" exit $E_FTP fi get_backup_info $tmpdir/$backup ftp >> $tmp_file @@ -273,6 +273,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-user-counters b/bin/v-update-user-counters index 9fc1ac5e..5fcdd671 100755 --- a/bin/v-update-user-counters +++ b/bin/v-update-user-counters @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf check_args '0' "$#" 'USER' if [ ! -z "$user" ]; then - validate_format 'user' + is_format_valid 'user' is_object_valid 'user' 'USER' "$user" fi @@ -211,6 +211,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-user-disk b/bin/v-update-user-disk index a37f9a38..a99eaf37 100755 --- a/bin/v-update-user-disk +++ b/bin/v-update-user-disk @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" @@ -60,6 +60,6 @@ update_user_value "$user" '$U_DISK_DIRS' "$disk_usage" recalc_user_disk_usage # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-user-package b/bin/v-update-user-package index 511c8dbf..fa9e5ce0 100755 --- a/bin/v-update-user-package +++ b/bin/v-update-user-package @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'PACKAGE' -validate_format 'package' +is_format_valid 'package' is_package_valid @@ -42,6 +42,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-user-quota b/bin/v-update-user-quota index 9de5f28c..b0f376a2 100755 --- a/bin/v-update-user-quota +++ b/bin/v-update-user-quota @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_object_valid 'user' 'USER' "$user" @@ -52,6 +52,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-user-stats b/bin/v-update-user-stats index 7dc46744..255981da 100755 --- a/bin/v-update-user-stats +++ b/bin/v-update-user-stats @@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf check_args '0' "$#" 'USER' if [ ! -z "$user" ]; then - validate_format 'user' + is_format_valid 'user' is_object_valid 'user' 'USER' "$user" fi @@ -63,6 +63,7 @@ TOTAL_U_MAIL_ACCOUNTS=0 TOTAL_U_DATABASES=0 TOTAL_U_CRON_JOBS=0 TOTAL_U_BACKUPS=0 +TOTAL_USERS=0 # Updating user stats for user in $user_list; do @@ -72,16 +73,17 @@ for user in $user_list; do DATE=$(date -d "$next_month -1day" +%F) # Compiling report string - s="DATE='$DATE' TIME='$TIME' PACKAGE='$PACKAGE' IP_OWNED='$IP_OWNED'" - s="$s DISK_QUOTA='$DISK_QUOTA' U_DISK='$U_DISK' U_DISK_DIRS='$U_DISK_DIRS'" - s="$s U_DISK_WEB='$U_DISK_WEB' U_DISK_MAIL='$U_DISK_MAIL'" - s="$s U_DISK_DB='$U_DISK_DB' BANDWIDTH='$BANDWIDTH'" - s="$s U_BANDWIDTH='$U_BANDWIDTH' U_WEB_DOMAINS='$U_WEB_DOMAINS'" - s="$s U_WEB_SSL='$U_WEB_SSL' U_WEB_ALIASES='$U_WEB_ALIASES'" - s="$s U_DNS_DOMAINS='$U_DNS_DOMAINS' U_DNS_RECORDS='$U_DNS_RECORDS'" - s="$s U_MAIL_DOMAINS='$U_MAIL_DOMAINS' U_MAIL_DKIM='$U_MAIL_DKIM'" - s="$s U_MAIL_ACCOUNTS='$U_MAIL_ACCOUNTS' U_DATABASES='$U_DATABASES'" - s="$s U_CRON_JOBS='$U_CRON_JOBS' U_BACKUPS='$U_BACKUPS'" + s="DATE='$DATE' TIME='$TIME' PACKAGE='$PACKAGE' IP_OWNED='$IP_OWNED'" + s="$s DISK_QUOTA='$DISK_QUOTA' U_DISK='$U_DISK'" + s="$s U_DISK_DIRS='$U_DISK_DIRS' U_DISK_WEB='$U_DISK_WEB''" + s="$s U_DISK_MAIL='$U_DISK_MAIL U_DISK_DB='$U_DISK_DB'" + s="$s BANDWIDTH='$BANDWIDTH' U_BANDWIDTH='$U_BANDWIDTH'" + s="$s U_WEB_DOMAINS='$U_WEB_DOMAINS' U_WEB_SSL='$U_WEB_SSL'" + s="$s U_WEB_ALIASES='$U_WEB_ALIASES' U_DNS_DOMAINS='$U_DNS_DOMAINS'" + s="$s U_DNS_RECORDS='$U_DNS_RECORDS' U_MAIL_DOMAINS='$U_MAIL_DOMAINS'" + s="$s U_MAIL_DKIM='$U_MAIL_DKIM' U_MAIL_ACCOUNTS='$U_MAIL_ACCOUNTS'" + s="$s U_DATABASES='$U_DATABASES' U_CRON_JOBS='$U_CRON_JOBS'" + s="$s U_BACKUPS='$U_BACKUPS'" # Updating user stats log stats="$USER_DATA/stats.log" @@ -121,6 +123,7 @@ for user in $user_list; do TOTAL_U_DATABASES=$((TOTAL_U_DATABASES + U_DATABASES)) TOTAL_U_CRON_JOBS=$((TOTAL_U_CRON_JOBS + U_CRON_JOBS)) TOTAL_U_BACKUPS=$((TOTAL_U_BACKUPS + U_BACKUPS)) + TOTAL_USERS=$((TOTAL_USERS + 1)) done @@ -129,16 +132,18 @@ stats="$VESTA/data/users/admin/overall_stats.log" s="DATE='$DATE' TIME='$TIME' PACKAGE='default' IP_OWNED='$TOTAL_IP_OWNED'" s="$s DISK_QUOTA='0' U_DISK='$TOTAL_U_DISK' U_DISK_DIRS='$TOTAL_U_DISK_DIRS'" -s="$s U_DISK_WEB='$TOTAL_U_DISK_WEB' U_DISK_MAIL='$TOTAL_U_DISK_MAIL'" +s="$s U_DISK_WEB='$TOTAL_U_DISK_WEB' U_DISK_MAIL='$TOTAL_U_DISK_MAIL'" s="$s U_DISK_DB='$TOTAL_U_DISK_DB' BANDWIDTH='0'" s="$s U_BANDWIDTH='$TOTAL_U_BANDWIDTH' U_WEB_DOMAINS='$TOTAL_U_WEB_DOMAINS'" s="$s U_WEB_SSL='$TOTAL_U_WEB_SSL' U_WEB_ALIASES='$TOTAL_U_WEB_ALIASES'" s="$s U_DNS_DOMAINS='$TOTAL_U_DNS_DOMAINS'" s="$s U_DNS_RECORDS='$TOTAL_U_DNS_RECORDS'" -s="$s U_MAIL_DOMAINS='$TOTAL_U_MAIL_DOMAINS' U_MAIL_DKIM='$TOTAL_U_MAIL_DKIM'" +s="$s U_MAIL_DOMAINS='$TOTAL_U_MAIL_DOMAINS'" +s="$s U_MAIL_DKIM='$TOTAL_U_MAIL_DKIM'" s="$s U_MAIL_ACCOUNTS='$TOTAL_U_MAIL_ACCOUNTS'" -s="$s U_DATABASES='$TOTAL_U_DATABASES'" +s="$s U_DATABASES='$TOTAL_U_DATABASES'" s="$s U_CRON_JOBS='$TOTAL_U_CRON_JOBS' U_BACKUPS='$TOTAL_U_BACKUPS'" +s="$s U_USERS='$TOTAL_USERS'" if [ -e "$stats" ]; then # Checking dublicates @@ -164,6 +169,6 @@ fi #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-web-domain-disk b/bin/v-update-web-domain-disk index 67dcaa8a..5317b3f0 100755 --- a/bin/v-update-web-domain-disk +++ b/bin/v-update-web-domain-disk @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -55,6 +55,6 @@ update_object_value 'web' 'DOMAIN' "$domain" '$U_DISK' "$disk_usage" recalc_user_disk_usage # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-web-domain-stat b/bin/v-update-web-domain-stat index a89664fb..b03bb8fc 100755 --- a/bin/v-update-web-domain-stat +++ b/bin/v-update-web-domain-stat @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -44,7 +44,7 @@ get_domain_values 'web' config="$HOMEDIR/$user/conf/web/$STATS.$domain.conf" if [ ! -e "$config" ]; then echo "Error: Parsing error" - log_event "$E_PARSING" "$EVENT" + log_event "$E_PARSING" "$ARGUMENTS" exit $E_PARSING fi @@ -146,6 +146,6 @@ chown -R $user:$(groups $user| cut -f 3 -d ' ') $dir #----------------------------------------------------------# # No Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-web-domain-traff b/bin/v-update-web-domain-traff index d78e9938..fda546cc 100755 --- a/bin/v-update-web-domain-traff +++ b/bin/v-update-web-domain-traff @@ -25,7 +25,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN' -validate_format 'user' 'domain' +is_format_valid 'user' 'domain' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -79,6 +79,6 @@ bandwidth=$((U_BANDWIDTH + mb)) update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' "$bandwidth" # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-web-domains-disk b/bin/v-update-web-domains-disk index ae538997..5951f289 100755 --- a/bin/v-update-web-domains-disk +++ b/bin/v-update-web-domains-disk @@ -22,7 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" @@ -49,6 +49,6 @@ done recalc_user_disk_usage # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-web-domains-stat b/bin/v-update-web-domains-stat index 1ef2abd8..acd24f16 100755 --- a/bin/v-update-web-domains-stat +++ b/bin/v-update-web-domains-stat @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" @@ -47,6 +47,6 @@ done #----------------------------------------------------------# # Logging -log_event "$OK" "$EVENT" +log_event "$OK" "$ARGUMENTS" exit diff --git a/bin/v-update-web-domains-traff b/bin/v-update-web-domains-traff index dfeacf78..ebecf1de 100755 --- a/bin/v-update-web-domains-traff +++ b/bin/v-update-web-domains-traff @@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# check_args '1' "$#" 'USER' -validate_format 'user' +is_format_valid 'user' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_object_valid 'user' 'USER' "$user" "$user" @@ -74,6 +74,6 @@ done recalc_user_bandwidth_usage # No Logging -#log_event "$OK" "$EVENT" +#log_event "$OK" "$ARGUMENTS" exit diff --git a/func/db.sh b/func/db.sh index 270313f6..983174e7 100644 --- a/func/db.sh +++ b/func/db.sh @@ -4,7 +4,7 @@ mysql_connect() { eval $host_str if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ]; then echo "Error: mysql config parsing failed" - log_event "$E_PARSING" "$EVENT" + log_event "$E_PARSING" "$ARGUMENTS" exit $E_PARSING fi @@ -33,7 +33,7 @@ mysql_connect() { $send_mail -s "$subj" $email fi echo "Error: Connection to $HOST failed" - log_event "$E_CONNECT" "$EVENT" + log_event "$E_CONNECT" "$ARGUMENTS" exit $E_CONNECT fi } @@ -52,7 +52,7 @@ mysql_dump() { $send_mail -s "$subj" $email fi echo "Error: dump $database failed" - log_event "$E_DB" "$EVENT" + log_event "$E_DB" "$ARGUMENTS" exit $E_DB fi } @@ -64,7 +64,7 @@ psql_connect() { export PGPASSWORD="$PASSWORD" if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then echo "Error: postgresql config parsing failed" - log_event "$E_PARSING" "$EVENT" + log_event "$E_PARSING" "$ARGUMENTS" exit $E_PARSING fi @@ -75,7 +75,7 @@ psql_connect() { $send_mail -s "$subj" $email fi echo "Error: Connection to $HOST failed" - log_event "$E_CONNECT" "$EVENT" + log_event "$E_CONNECT" "$ARGUMENTS" exit $E_CONNECT fi } @@ -93,7 +93,7 @@ psql_dump() { $send_mail -s "$subj" $email fi echo "Error: dump $database failed" - log_event "$E_DB" "$EVENT" + log_event "$E_DB" "$ARGUMENTS" exit $E_DB fi } @@ -137,7 +137,7 @@ is_charset_valid() { if [ -z "$(echo $CHARSETS | grep -wi $charset )" ]; then echo "Error: charset $charset not exist" - log_event "$E_NOTEXIST" "$EVENT" + log_event "$E_NOTEXIST" "$ARGUMENTS" exit $E_NOTEXIST fi } @@ -235,7 +235,7 @@ is_dbhost_new() { check_host=$(grep "HOST='$host'" $VESTA/conf/$type.conf) if [ ! -z "$check_host" ]; then echo "Error: db host exist" - log_event "$E_EXISTS" "$EVENT" + log_event "$E_EXISTS" "$ARGUMENTS" exit $E_EXISTS fi fi @@ -345,7 +345,7 @@ is_dbhost_free() { eval $host_str if [ 0 -ne "$U_DB_BASES" ]; then echo "Error: host $HOST is used" - log_event "$E_INUSE" "$EVENT" + log_event "$E_INUSE" "$ARGUMENTS" exit $E_INUSE fi } diff --git a/func/main.sh b/func/main.sh index 94f64e29..d55faac8 100644 --- a/func/main.sh +++ b/func/main.sh @@ -1,22 +1,16 @@ # Internal variables -DATE=$(date +%F) -TIME=$(date +%T) -SCRIPT=$(basename $0) HOMEDIR='/home' BACKUP='/backup' BACKUP_GZIP=5 BACKUP_DISK_LIMIT=95 BACKUP_LA_LIMIT=5 RRD_STEP=300 -RRD_IFACE_EXCLUDE=lo -PW_MATRIX='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' -PW_LENGHT='10' BIN=$VESTA/bin USER_DATA=$VESTA/data/users/$user WEBTPL=$VESTA/data/templates/web DNSTPL=$VESTA/data/templates/dns RRD=$VESTA/web/rrd -send_mail="$VESTA/web/inc/mail-wrapper.php" +SENDMAIL="$VESTA/web/inc/mail-wrapper.php" # Return codes OK=0 @@ -42,21 +36,25 @@ E_UPDATE=19 E_RESTART=20 # Event string for logger -EVENT="$DATE $TIME $SCRIPT" for ((I=1; I <= $# ; I++)); do if [[ "$HIDE" != $I ]]; then - EVENT="$EVENT '$(eval echo \$${I})'" + ARGUMENTS="$ARGUMENTS '$(eval echo \$${I})'" else - EVENT="$EVENT '******'" + ARGUMENTS="$ARGUMENTS '******'" fi done # Log event function log_event() { - if [ "$1" -eq 0 ]; then - echo "$2" >> $VESTA/log/system.log + if [ -z "$time" ]; then + LOG_TIME="$(date +'%F %T') $(basename $0)" else - echo "$2 [Error $1]" >> $VESTA/log/error.log + LOG_TIME="$date $time $(basename $0)" + fi + if [ "$1" -eq 0 ]; then + echo "$LOG_TIME $2" >> $VESTA/log/system.log + else + echo "$LOG_TIME $2 [Error $1]" >> $VESTA/log/error.log fi } @@ -66,17 +64,20 @@ log_history() { undo=${2-no} log_user=${3-$user} log=$VESTA/data/users/$log_user/history.log - touch $log if [ '99' -lt "$(wc -l $log |cut -f 1 -d ' ')" ]; then tail -n 49 $log > $log.moved mv -f $log.moved $log chmod 660 $log fi - + if [ -z "$date" ]; then + time_n_date=$(date +'%T %F') + time=$(echo "$time_n_date" |cut -f 1 -d \ ) + date=$(echo "$time_n_date" |cut -f 2 -d \ ) + fi curr_str=$(grep "ID=" $log | cut -f 2 -d \' | sort -n | tail -n1) id="$((curr_str +1))" - echo "ID='$id' DATE='$DATE' TIME='$TIME' CMD='$cmd' UNDO='$undo'" >> $log + echo "ID='$id' DATE='$date' TIME='$time' CMD='$cmd' UNDO='$undo'" >> $log } # Result checker @@ -84,10 +85,10 @@ check_result() { if [ $1 -ne 0 ]; then echo "Error: $2" if [ ! -z "$3" ]; then - log_event $3 $EVENT + log_event "$3" "$ARGUMENTS" exit $3 else - log_event $1 $EVENT + log_event "$1" "$ARGUMENTS" exit $1 fi fi @@ -96,47 +97,52 @@ check_result() { # Argument list checker check_args() { if [ "$1" -gt "$2" ]; then - echo "Error: not enought arguments" echo "Usage: $SCRIPT $3" - log_event "$E_ARGS" "$EVENT" - exit $E_ARGS + check_result $E_ARGS "not enought arguments" >/dev/null fi } # Subsystem checker is_system_enabled() { if [ -z "$1" ] || [ "$1" = no ]; then - echo "Error: $2 is not enabled in the $VESTA/conf/vesta.conf" - log_event "$E_DISABLED" "$EVENT" - exit $E_DISABLED + check_result $E_DISABLED "$2 is not enabled" fi } # User package check is_package_full() { case "$1" in - WEB_DOMAINS) used=$(wc -l $USER_DATA/web.conf|cut -f1 -d \ );; - WEB_ALIASES) used=$(grep "DOMAIN='$domain'" $USER_DATA/web.conf |\ - awk -F "ALIAS='" '{print $2}' | cut -f 1 -d \' | tr ',' '\n' |\ - wc -l );; + WEB_DOMAINS) used=$(wc -l $USER_DATA/web.conf |cut -f1 -d \ );; + WEB_ALIASES) used=$(echo $aliases |tr ',' '\n' |wc -l);; DNS_DOMAINS) used=$(wc -l $USER_DATA/dns.conf |cut -f1 -d \ );; - DNS_RECORDS) used=$(wc -l $USER_DATA/dns/$domain.conf |cut -f1 -d \ );; + DNS_RECORDS) used=$(wc -l $USER_DATA/dns/$domain.conf|cut -f1 -d \ );; MAIL_DOMAINS) used=$(wc -l $USER_DATA/mail.conf |cut -f1 -d \ );; - MAIL_ACCOUNTS) used=$(wc -l $USER_DATA/mail/$domain.conf |\ - cut -f1 -d \ );; + MAIL_USER) used=$(wc -l $USER_DATA/mail/$domain.conf |cut -f1 -d \ );; DATABASES) used=$(wc -l $USER_DATA/db.conf |cut -f1 -d \ );; CRON_JOBS) used=$(wc -l $USER_DATA/cron.conf |cut -f1 -d \ );; esac - limit=$(grep "^$1=" $USER_DATA/user.conf | cut -f 2 -d \' ) + limit=$(grep "^$1=" $USER_DATA/user.conf |cut -f 2 -d \') if [ "$limit" != 'unlimited' ] && [ "$used" -ge "$limit" ]; then - echo "Error: Limit is reached, please upgrade hosting package" - log_event "$E_LIMIT" "$EVENT" - exit $E_LIMIT + check_result $E_LIMIT "$1 limit is reached :: upgrade user package" + fi +} + +# User owner for reseller plugin +get_user_owner() { + if [ -z "$RESELLER_KEY" ]; then + owner='admin' + else + owner=$(grep "^OWNER" $USER_DATA/user.conf| cut -f 2 -d \') + if [ -z "$owner" ]; then + owner='admin' + fi fi } # Random password generator gen_password() { + PW_MATRIX='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + PW_LENGHT='10' pw_matrix=${1-$PW_MATRIX} pw_lenght=${2-$PW_LENGHT} while [ ${n:=1} -le $pw_lenght ]; do @@ -146,24 +152,20 @@ gen_password() { echo "$pass" } -# Package existance check +# Package existence check is_package_valid() { if [ -z "$1" ]; then pkg_dir="$VESTA/data/packages" fi if [ ! -e "$pkg_dir/$package.pkg" ]; then - echo "Error: package $package doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" - exit $E_NOTEXIST + check_result $E_NOTEXIST "package $package doesn't exist" fi } # Validate system type is_type_valid() { if [ -z "$(echo $1 | grep -w $2)" ]; then - echo "Error: $2 is unknown type" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID + check_result $E_INVALID "$2 type is invalid" fi } @@ -172,9 +174,7 @@ is_backup_available() { b_owner=$(echo $user |\ sed -e "s/\.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].tar//") if [ "$user" != "$b_owner" ]; then - echo "Error: User $user don't have permission to use $backup" - log_event "$E_FORBIDEN" "$EVENT" - exit $E_FORBIDEN + check_result $E_FORBIDEN "permission denied" fi } @@ -182,9 +182,7 @@ is_backup_available() { is_backup_enabled() { BACKUPS=$(grep "^BACKUPS=" $USER_DATA/user.conf | cut -f2 -d \') if [ -z "$BACKUPS" ] || [[ "$BACKUPS" -le '0' ]]; then - echo "Error: user backup disabled" - log_event "$E_DISABLED" "$EVENT" - exit $E_DISABLED + check_result $E_DISABLED "user backup is disabled" fi } @@ -193,9 +191,7 @@ is_backup_scheduled() { if [ -e "$VESTA/data/queue/backup.pipe" ]; then check_q=$(grep " $user " $VESTA/data/queue/backup.pipe | grep $1) if [ ! -z "$check_q" ]; then - echo "Error: $1 is already scheduled" - log_event "$E_EXISTS" "$EVENT" - exit $E_EXISTS + check_result $E_EXISTS "$1 is already scheduled" fi fi } @@ -210,30 +206,24 @@ is_object_new() { object=$(grep "$2='$3'" $USER_DATA/$1.conf) fi if [ ! -z "$object" ]; then - echo "Error: $2 with value $3 exists" - log_event "$E_EXISTS" "$EVENT" - exit $E_EXISTS + check_result $E_EXISTS "$2=$3 is already exists" fi } -# Check if object exists and can be used +# Check if object is valid is_object_valid() { if [ $2 = 'USER' ]; then - if [ -d "$VESTA/data/users/$user" ]; then - sobject="OK" + if [ ! -d "$VESTA/data/users/$3" ]; then + check_result $E_NOTEXIST "$1 $3 doesn't exist" fi else - if [ $2 = 'DBHOST' ]; then - sobject=$(grep "HOST='$host'" $VESTA/conf/$type.conf) - else - sobject=$(grep "$2='$3'" $VESTA/data/users/$user/$1.conf) + object=$(grep "$2='$3'" $VESTA/data/users/$user/$1.conf) + if [ -z "$object" ]; then + arg1=$(basename $1) + arg2=$(echo $2 |tr '[:upper:]' '[:lower:]') + check_result $E_NOTEXIST "$arg1 $arg2 $3 doesn't exist" fi fi - if [ -z "$sobject" ]; then - echo "Error: $2 $3 doesn't exist" - log_event "$E_NOTEXIST" "$EVENT" - exit $E_NOTEXIST - fi } # Check if object is supended @@ -244,23 +234,19 @@ is_object_suspended() { spnd=$(grep "$2='$3'" $USER_DATA/$1.conf|grep "SUSPENDED='yes'") fi if [ -z "$spnd" ]; then - echo "Error: $(basename $1) $3 is not suspended" - log_event "$E_SUSPENDED" "$EVENT" - exit $E_SUSPENDED + check_result $E_UNSUSPENDED "$(basename $1) $3 is not suspended" fi } # Check if object is unsupended is_object_unsuspended() { if [ $2 = 'USER' ]; then - spnd=$(cat $USER_DATA/$1.conf|grep "SUSPENDED='yes'") + spnd=$(cat $USER_DATA/$1.conf |grep "SUSPENDED='yes'") else - spnd=$(grep "$2='$3'" $USER_DATA/$1.conf|grep "SUSPENDED='yes'") + spnd=$(grep "$2='$3'" $USER_DATA/$1.conf |grep "SUSPENDED='yes'") fi if [ ! -z "$spnd" ]; then - echo "Error: $(basename $1) $3 is suspended" - log_event "$E_UNSUSPENDED" "$EVENT" - exit $E_UNSUSPENDED + check_result $E_SUSPENDED "$(basename $1) $3 is suspended" fi } @@ -270,9 +256,7 @@ is_object_value_empty() { eval $str eval value=$4 if [ ! -z "$value" ] && [ "$value" != 'no' ]; then - echo "Error: ${4//$}=$value (not empty)" - log_event "$E_EXISTS" "$EVENT" - exit $E_EXISTS + check_result $E_EXISTS "${4//$}=$value is already exists" fi } @@ -282,9 +266,7 @@ is_object_value_exist() { eval $str eval value=$4 if [ -z "$value" ] || [ "$value" = 'no' ]; then - echo "Error: ${4//$}=$value (doesn't exist)" - log_event "$E_NOTEXIST" "$EVENT" - exit $E_NOTEXIST + check_result $E_NOTEXIST "${4//$}=$value doesn't exist" fi } @@ -387,62 +369,6 @@ decrease_user_value() { sed -i "s/$key='$old'/$key='$new'/g" $conf } -# Json listing function -json_list() { - echo '{' - fileds_count=$(echo $fields| wc -w ) - #for line in $(cat $conf); do - while read line; do - eval $line - if [ -n "$data_output" ]; then - echo -e ' },' - fi - i=1 - for field in $fields; do - eval value=$field - if [ $i -eq 1 ]; then - (( ++i)) - echo -e "\t\"$value\": {" - else - if [ $i -lt $fileds_count ]; then - (( ++i)) - echo -e "\t\t\"${field//$/}\": \"$value\"," - else - echo -e "\t\t\"${field//$/}\": \"$value\"" - data_output=yes - fi - fi - done - done < $conf - - if [ "$data_output" = 'yes' ]; then - echo -e ' }' - fi - echo -e '}' -} - -# Shell listing function -shell_list() { - if [ -z "$nohead" ] ; then - echo "${fields//$/}" - for a in $fields; do - echo -e "------ \c" - done - echo - fi - while read line ; do - eval $line - for field in $fields; do - eval value=$field - if [ -z "$value" ]; then - value='NULL' - fi - echo -n "$value " - done - echo - done < $conf -} - # Recalculate U_DISK value recalc_user_disk_usage() { u_usage=0 @@ -517,13 +443,12 @@ sort_cron_jobs() { # Sync cronjobs with system cron sync_cron_jobs() { source $USER_DATA/user.conf - if [ -e "/var/spool/cron/crontabs" ]; then - sys_cron="/var/spool/cron/crontabs/$user" + crontab="/var/spool/cron/crontabs/$user" else - sys_cron="/var/spool/cron/$user" + crontab="/var/spool/cron/$user" fi - rm -f $sys_cron + rm -f $crontab if [ "$CRON_REPORTS" = 'yes' ]; then echo "MAILTO=$CONTACT" > $sys_cron fi @@ -532,423 +457,77 @@ sync_cron_jobs() { if [ "$SUSPENDED" = 'no' ]; then echo "$MIN $HOUR $DAY $MONTH $WDAY $CMD" |\ sed -e "s/%quote%/'/g" -e "s/%dots%/:/g" \ - >> $sys_cron + >> $crontab fi done < $USER_DATA/cron.conf - - # Set proper permissions - chown $user:$user $sys_cron - chmod 600 $sys_cron + chown $user:$user $crontab + chmod 600 $crontab } - -### Format Validators ### -# Shell -validate_format_shell() { - if [ -z "$(grep -w $1 /etc/shells)" ]; then - echo "Error: shell $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID +# User format validator +is_user_format_valid() { + if ! [[ "$1" =~ ^[a-zA-Z0-9][-|\.|_|a-zA-Z0-9]{0,28}[a-zA-Z0-9]$ ]]; then + check_result $E_INVALID "invalid user format :: $1" fi } -# Password -validate_format_password() { - if [ "${#1}" -lt '6' ]; then - echo "Error: password is too short" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID +# Domain format validator +is_domain_format_valid() { + exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%|\`| ]" + if [[ "$1" =~ $exclude ]]; then + check_result $E_INVALID "invalid domain format :: $1" fi } -# Integer -validate_format_int() { - if ! [[ "$1" =~ ^[0-9]+$ ]] ; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Boolean -validate_format_boolean() { - if [ "$1" != 'yes' ] && [ "$1" != 'no' ]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Network interface -validate_format_interface() { - netdevices=$(cat /proc/net/dev | grep : | cut -f 1 -d : | tr -d ' ') - if [ -z $(echo "$netdevices"| grep -x $1) ]; then - echo "Error: intreface $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# IP address -validate_format_ip() { - t_ip=$(echo $1 |awk -F / '{print $1}') - t_cidr=$(echo $1 |awk -F / '{print $2}') - valid_octets=0 - valid_cidr=1 - for octet in ${t_ip//./ }; do - if [[ $octet =~ ^[0-9]{1,3}$ ]] && [[ $octet -le 255 ]]; then - ((++valid_octets)) +# Alias forman validator +is_alias_format_valid() { + for object in ${1//,/ }; do + exclude="[!|@|#|$|^|&|(|)|+|=|{|}|:|<|>|?|_|/|\|\"|'|;|%|\`| ]" + if [[ "$object" =~ $exclude ]]; then + check_result $E_INVALID "invalid alias format :: $object" + fi + if [[ "$object" =~ [*] ]] && ! [[ "$object" =~ ^[*]\..* ]]; then + check_result $E_INVALID "invalid alias format :: $object" fi done +} - if [ ! -z "$(echo $1|grep '/')" ]; then - if [[ "$t_cidr" -lt 0 ]] || [[ "$t_cidr" -gt 32 ]]; then - valid_cidr=0 - fi - if ! [[ "$t_cidr" =~ ^[0-9]+$ ]]; then - valid_cidr=0 - fi - fi - if [ "$valid_octets" -lt 4 ] || [ "$valid_cidr" -eq 0 ]; then - echo "Error: ip $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID +# IP format validator +is_ip_format_valid() { + ip_regex='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])' + if ! [[ $1 =~ ^$ip_regex\.$ip_regex\.$ip_regex\.$ip_regex$ ]]; then + check_result $E_INVALID "invalid IP format :: $1" fi } -# IP address status -validate_format_ip_status() { - if [ -z "$(echo shared,dedicated | grep -w $1 )" ]; then - echo "Error: ip_status $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Email address -validate_format_email() { - if [[ ! "$1" =~ "@" ]] ; then - echo "Error: email $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Name -validate_format_name() { - if ! [[ "$1" =~ ^[[:alnum:]][-|\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Name with space -validate_format_name_s() { - if ! [[ "$1" =~ ^[[:alnum:]][-|\ |\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Username -validate_format_username() { - if [ "${#1}" -eq 1 ]; then - if ! [[ "$1" =~ [a-z] ]]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit 1 - fi - else - if ! [[ "$1" =~ ^[a-zA-Z0-9][-|\.|_|a-zA-Z0-9]{0,28}[a-zA-Z0-9]$ ]] - then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit 1 - fi - fi -} - -# Domain -validate_format_domain() { - exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%|\`| ]" - if [[ "$1" =~ $exclude ]] || [[ "$1" =~ "^[0-9]+$" ]]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Domain alias -validate_format_domain_alias() { - exclude="[!|@|#|$|^|&|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%|\`| ]" - if [[ "$1" =~ $exclude ]] || [[ "$1" =~ "^[0-9]+$" ]]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Database -validate_format_database() { - exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]" - if [[ "$1" =~ $exclude ]] || [ 65 -le ${#1} ]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Database user -validate_format_dbuser() { - exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]" - if [[ "$1" =~ $exclude ]] || [ 17 -le ${#1} ]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# DNS type -validate_format_dns_type() { - known_dnstype='A,AAAA,NS,CNAME,MX,TXT,SRV,DNSKEY,KEY,IPSECKEY,PTR,SPF' - if [ -z "$(echo $known_dnstype | grep -w $1)" ]; then - echo "Error: dnstype $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# DKIM key size -validate_format_key_size() { - known_size='128,256,512,768,1024,2048' - if [ -z "$(echo $known_size | grep -w $1)" ]; then - echo "Error: key_size $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Minute / Hour / Day / Month / Day of Week -validate_format_mhdmw() { - limit=60 - check_format='' - if [ "$2" = 'day' ]; then - limit=31 - fi - if [ "$2" = 'month' ]; then - limit=12 - fi - if [ "$2" = 'wday' ]; then - limit=7 - fi - if [ "$1" = '*' ]; then - check_format='ok' - fi - if [[ "$1" =~ ^[\*]+[/]+[0-9] ]]; then - if [ "$(echo $1 |cut -f 2 -d /)" -lt $limit ]; then - check_format='ok' - fi - fi - if [[ "$1" =~ ^[0-9][-|,|0-9]{0,28}[0-9]$ ]]; then - check_format='ok' - crn_values=${1//,/ } - crn_values=${crn_values//-/ } - for crn_vl in $crn_values; do - if [ "$crn_vl" -gt $limit ]; then - check_format='invalid' - fi - done - fi - if [[ "$1" =~ ^[0-9]+$ ]] && [ "$1" -lt $limit ]; then - check_format='ok' - fi - if [ "$check_format" != 'ok' ]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# proxy extention or DNS record -validate_format_common() { - exclude="[!|#|$|^|&|(|)|+|=|{|}|:|<|>|?|/|\|\"|'|;|%|\`| ]" +# Proxy extention format validator +is_extention_format_valid() { + exclude="[!|#|$|^|&|(|)|+|=|{|}|:|@|<|>|?|/|\|\"|'|;|%|\`| ]" if [[ "$1" =~ $exclude ]]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi - if [ 400 -le ${#1} ]; then - echo "Error: $2 $1 is too long" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi - if [[ "$1" =~ @ ]] && [ ${#1} -gt 1 ] ; then - echo "Error: @ can not be mixed" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi - if [[ $1 =~ \* ]]; then - if [ "$(echo $1 | grep -o '*'|wc -l)" -gt 1 ]; then - log_event "$E_INVALID" "$EVENT" - echo "Error: * can be used only once" - fi + check_result $E_INVALID "invalid proxy extention format :: $1" fi } -# DNS record value -validate_format_dvalue() { - record_types="$(echo A,AAAA,NS,CNAME | grep -w "$rtype")" - if [[ "$1" =~ [\ ] ]] && [ ! -z "$record_types" ]; then - echo "Error: dvalue $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi - if [ "$rtype" = 'A' ]; then - validate_format_ip "$1" - fi - if [ "$rtype" = 'NS' ]; then - validate_format_domain "$1" 'ns_record' - fi - if [ "$rtype" = 'MX' ]; then - validate_format_domain "$1" 'mx_record' - validate_format_int "$priority" 'priority_record' - fi - -} - -# Date -validate_format_date() { - if ! [[ "$1" =~ ^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$ ]]; then - echo "Error: date $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Autoreply -validate_format_autoreply() { - exclude="[$|\`]" - if [[ "$1" =~ $exclude ]] || [ 10240 -le ${#1} ]; then - echo "Error: autoreply is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Firewall action -validate_format_fw_action() { - if [ "$1" != "ACCEPT" ] && [ "$1" != 'DROP' ] ; then - echo "Error: $1 is not valid action" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Firewall protocol -validate_format_fw_protocol() { - if [ "$1" != "ICMP" ] && [ "$1" != 'UDP' ] && [ "$1" != 'TCP' ] ; then - echo "Error: $1 is not valid protocol" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID - fi -} - -# Firewall port -validate_format_fw_port() { - if [ "${#1}" -eq 1 ]; then - if ! [[ "$1" =~ [0-9] ]]; then - echo "Error: port $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit 1 - fi - else - if ! [[ "$1" =~ ^[0-9][-|,|:|0-9]{0,30}[0-9]$ ]] - then - echo "Error: port $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit 1 - fi +# Number format validator +is_number_format_valid() { + object_name=${2-number} + if ! [[ "$1" =~ ^[0-9]+$ ]] ; then + check_result $E_INVALID "invalid $object_name format :: $1" fi } # Format validation controller -validate_format(){ +is_format_valid() { for arg_name in $*; do eval arg=\$$arg_name - if [ -z "$arg" ]; then - echo "Error: argument $arg_name is not valid (empty)" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID + if [ ! -z "$arg" ]; then + case $arg_name in + aliases) is_alias_format_valid "$arg" ;; + domain) is_domain_format_valid "$arg" ;; + proxy_ext) is_extention_format_valid "$arg" ;; + ip) is_ip_format_valid "$arg" ;; + user) is_user_format_valid "$arg" ;; + esac fi - - case $arg_name in - account) validate_format_username "$arg" "$arg_name" ;; - action) validate_format_fw_action "$arg";; - antispam) validate_format_boolean "$arg" 'antispam' ;; - antivirus) validate_format_boolean "$arg" 'antivirus' ;; - autoreply) validate_format_autoreply "$arg" ;; - backup) validate_format_domain "$arg" 'backup' ;; - charset) validate_format_name "$arg" "$arg_name" ;; - charsets) validate_format_common "$arg" 'charsets' ;; - comment) validate_format_name "$arg" 'comment' ;; - database) validate_format_database "$arg" 'database';; - day) validate_format_mhdmw "$arg" $arg_name ;; - dbpass) validate_format_password "$arg" ;; - dbuser) validate_format_dbuser "$arg" 'db_user';; - dkim) validate_format_boolean "$arg" 'dkim' ;; - dkim_size) validate_format_key_size "$arg" ;; - domain) validate_format_domain "$arg" 'domain';; - dom_alias) validate_format_domain_alias "$arg" 'alias';; - dvalue) validate_format_dvalue "$arg";; - email) validate_format_email "$arg" ;; - exp) validate_format_date "$arg" ;; - extentions) validate_format_common "$arg" 'extentions' ;; - fname) validate_format_name_s "$arg" "$arg_name" ;; - forward) validate_format_email "$arg" ;; - ftp_password) validate_format_password "$arg" ;; - ftp_user) validate_format_username "$arg" "$arg_name" ;; - host) validate_format_domain "$arg" "$arg_name" 'host';; - hour) validate_format_mhdmw "$arg" $arg_name ;; - id) validate_format_int "$arg" 'id' ;; - interface) validate_format_interface "$arg" ;; - ip) validate_format_ip "$arg" ;; - ip_name) validate_format_domain "$arg" 'domain';; - ip_status) validate_format_ip_status "$arg" ;; - job) validate_format_int "$arg" 'job' ;; - key) validate_format_username "$arg" "$arg_name" ;; - lname) validate_format_name_s "$arg" "$arg_name" ;; - malias) validate_format_username "$arg" "$arg_name" ;; - max_db) validate_format_int "$arg" 'max db';; - min) validate_format_mhdmw "$arg" $arg_name ;; - month) validate_format_mhdmw "$arg" $arg_name ;; - nat_ip) validate_format_ip "$arg" ;; - netmask) validate_format_ip "$arg" ;; - newid) validate_format_int "$arg" 'id' ;; - ns1) validate_format_domain "$arg" 'name_server';; - ns2) validate_format_domain "$arg" 'name_server';; - ns3) validate_format_domain "$arg" 'name_server';; - ns4) validate_format_domain "$arg" 'name_server';; - object) validate_format_name_s "$arg" 'object';; - package) validate_format_name "$arg" "$arg_name" ;; - password) validate_format_password "$arg" ;; - port) validate_format_int "$arg" 'port' ;; - port_ext) validate_format_fw_port "$arg";; - protocol) validate_format_fw_protocol "$arg" ;; - quota) validate_format_int "$arg" 'quota' ;; - restart) validate_format_boolean "$arg" 'restart' ;; - record) validate_format_common "$arg" 'record';; - rtype) validate_format_dns_type "$arg" ;; - rule) validate_format_int "$arg" "rule id" ;; - shell) validate_format_shell "$arg" ;; - soa) validate_format_domain "$arg" 'soa_record';; - stats_pass) validate_format_password "$arg" ;; - stats_user) validate_format_username "$arg" "$arg_name" ;; - template) validate_format_name "$arg" "$arg_name" ;; - ttl) validate_format_int "$arg" 'ttl';; - user) validate_format_username "$arg" "$arg_name" ;; - wday) validate_format_mhdmw "$arg" $arg_name ;; - esac done } diff --git a/func/remote.sh b/func/remote.sh index f680ce0d..ba93f448 100644 --- a/func/remote.sh +++ b/func/remote.sh @@ -111,7 +111,7 @@ remote_dns_health_check() { # Deleting tmp file rm -f $tmpfile - log_event "$E_CONNECT" "$EVENT" + log_event "$E_CONNECT" "$ARGUMENTS" # Suspending remote host dconf="../../conf/dns-cluster"