Merge branch 'master' into feature/800

Conflicts:
	bin/v-add-letsencrypt-user
This commit is contained in:
Derrick Hammer 2016-09-25 02:37:42 -04:00
commit 4daa17f54f
248 changed files with 6127 additions and 2139 deletions

23
ISSUE_TEMPLATE.md Normal file
View file

@ -0,0 +1,23 @@
### Operating System (OS/VERSION):
Type here, e.g. CentOS 6
### VestaCP Version:
Type here, e.g. 3.14159
### Installed Software (what you got with the installer):
Type here, e.g. php-fpm, apache, nginx, mysql
### Steps to Reproduce:
Type here, e.g. install vesta and type rm -rf / --no-preserve-root
### Related Issues/Forum Threads:
Found anything that might be related to this? It might help us find the cause.
### Other Notes:
Anything else?

View file

@ -5,8 +5,7 @@
* Vesta has a clean and focused interface without the clutter. * Vesta has a clean and focused interface without the clutter.
* Vesta has the latest of very innovative technologies. * Vesta has the latest of very innovative technologies.
How to install (2 step)
How to install
---------------------------- ----------------------------
Connect to your server as root via SSH Connect to your server as root via SSH
```bash ```bash
@ -18,7 +17,13 @@ Download the installation script, and run it:
curl http://vestacp.com/pub/vst-install.sh | bash curl http://vestacp.com/pub/vst-install.sh | bash
``` ```
If the above example does not work, try this 2 step method: How to install (3 step)
----------------------------
If the above example does not work, try this 3 step method:
Connect to your server as root via SSH
```bash
ssh root@your.server
```
Download the installation script: Download the installation script:
```bash ```bash

View file

@ -49,6 +49,12 @@ if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then
fi fi
fi fi
dvalue=${dvalue//\"/}
if [[ "$dvalue" =~ [\;[:space:]] ]]; then
dvalue='"'"$dvalue"'"'
fi
#----------------------------------------------------------# #----------------------------------------------------------#
# Verifications # # Verifications #

View file

@ -6,11 +6,11 @@
user=$1 user=$1
archive=$2 archive=$2
src=$3 src0=$3
# Checking arguments # Checking arguments
if [ -z "$src" ]; then if [ -z "$src0" ]; then
echo "Usage: USER ARCHIVE SOURCE" echo "Usage: USER ARCHIVE FILE [FILE_2] [FILE_3] [FILE ...]"
exit 1 exit 1
fi fi
@ -21,36 +21,56 @@ if [ ! -e "$VESTA/data/users/$user" ]; then
fi fi
# Checking user homedir # Checking user homedir
homedir=$(grep "^$user:" /etc/passwd | cut -f 6 -d :) homedir=$(grep "^$user:" /etc/passwd |cut -f 6 -d :)
if [ -z $homedir ]; then if [ -z $homedir ]; then
echo "Error: user home directory doesn't exist" echo "Error: user home directory doesn't exist"
exit 12 exit 12
fi fi
# Checking archive # Checking archive
if [ -e "$archive.tar.gz" ]; then if [ -e "$archive" ]; then
echo "Error: archive already exist $archive.tar.gz" echo "Error: archive already exist $archive"
exit 1 exit 1
fi fi
# Checking source path # Checking source path
rpath=$(readlink -f "$src") IFS=$'\n'
if [ -z "$(echo $rpath |egrep "^/tmp|^$homedir")" ]; then i=1
for src in $*; do
if [ "$i" -gt 2 ]; then
rpath=$(readlink -f "$src")
if [ -z "$(echo $rpath |egrep "^/tmp|^$homedir")" ]; then
echo "Error: invalid source path $src" echo "Error: invalid source path $src"
exit 1 exit 1
fi fi
fi
((i++))
done
# Parsing current directory i=1
d=$(dirname "$src") for src in $*; do
if [ "$i" -gt 2 ]; then
# Deleting leading home path
src=$(echo "$src"| sed -e "s|/home/$user/||")
# Removing leading file path # Creating tar.gz archive
f=$(echo "$src" |sed -e "s|$d/||") sudo -u $user tar -rf "${archive/.gz/}" -C /home/$user $src >\
/dev/null 2>&1
# Creating tar.gz archive if [ "$?" -ne 0 ]; then
sudo -u $user tar -czf "$archive.tar.gz" -C $d $f >/dev/null 2>&1 echo "Error: archive $archive was not created"
if [ "$?" -ne 0 ]; then
echo "Error: archive $archive.tar.gz was not created"
exit 3 exit 3
fi
fi
((i++))
done
# Checking gzip
if [[ "$archive" =~ \.gz$ ]]; then
sudo -u $user gzip "${archive/.gz/}" >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
echo "Error: archive $archive was not gziped"
exit 3
fi
fi fi
exit exit

View file

@ -12,7 +12,7 @@
# Argument definition # Argument definition
user=$1 user=$1
email=$2 email=$2
key_size=2048 key_size=4096
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh

View file

@ -63,11 +63,11 @@ fi
# Adding dns records # Adding dns records
if [ ! -z "$DNS_SYSTEM" ] && [ -e "$USER_DATA/dns/$domain.conf" ]; then if [ ! -z "$DNS_SYSTEM" ] && [ -e "$USER_DATA/dns/$domain.conf" ]; then
p=$(cat $USER_DATA/mail/$domain.pub |grep -v ' KEY---' |tr -d '\n') p=$(cat $USER_DATA/mail/$domain.pub |grep -v ' KEY---' |tr -d '\n')
record='_domainkey' record="_domainkey.$domain_idn"
policy="\"t=y; o=~;\"" policy="\"t=y; o=~;\""
$BIN/v-add-dns-record $user $domain $record TXT "$policy" $BIN/v-add-dns-record $user $domain $record TXT "$policy"
record='mail._domainkey' record="mail._domainkey.$domain_idn"
selector="\"k=rsa\; p=$p\"" selector="\"k=rsa\; p=$p\""
$BIN/v-add-dns-record $user $domain $record TXT "$selector" $BIN/v-add-dns-record $user $domain $record TXT "$selector"
fi fi

View file

@ -14,6 +14,7 @@ user=$1
domain=$2 domain=$2
flush=$3 flush=$3
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/func/remote.sh source $VESTA/func/remote.sh
@ -27,12 +28,7 @@ source $VESTA/conf/vesta.conf
check_args '2' "$#" 'USER DOMAIN [FLUSH]' check_args '2' "$#" 'USER DOMAIN [FLUSH]'
is_format_valid 'user' 'domain' is_format_valid 'user' 'domain'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -29,12 +29,7 @@ is_format_valid 'user' 'domain' 'id'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_valid 'dns' 'DOMAIN' "$domain" is_object_valid 'dns' 'DOMAIN' "$domain"
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -66,8 +66,9 @@ mkdir $HOMEDIR/$user/conf
if [ ! -z "$WEB_SYSTEM" ]; then if [ ! -z "$WEB_SYSTEM" ]; then
mkdir $HOMEDIR/$user/conf/web $HOMEDIR/$user/web $HOMEDIR/$user/tmp mkdir $HOMEDIR/$user/conf/web $HOMEDIR/$user/web $HOMEDIR/$user/tmp
chmod 751 $HOMEDIR/$user/conf/web $HOMEDIR/$user/web chmod 751 $HOMEDIR/$user/conf/web
chmod 771 $HOMEDIR/$user/tmp chmod 710 $HOMEDIR/$user/web
chmod 700 $HOMEDIR/$user/tmp
chown $user:$user $HOMEDIR/$user/web $HOMEDIR/$user/tmp chown $user:$user $HOMEDIR/$user/web $HOMEDIR/$user/tmp
fi fi

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# info: add web domain # info: add web domain
# options: USER DOMAIN [IP] [ALIASES] [PROXY_EXTENTIONS] [RESTART] # options: USER DOMAIN [IP] [ALIASES] [PROXY_EXTENSIONS] [RESTART]
# #
# The function adds virtual host to a server. In cases when ip is # The function adds virtual host to a server. In cases when ip is
# undefined in the script, "default" template will be used. The alias of # undefined in the script, "default" template will be used. The alias of
@ -55,7 +55,7 @@ source $VESTA/conf/vesta.conf
#----------------------------------------------------------# #----------------------------------------------------------#
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
check_args '2' "$#" 'USER DOMAIN [IP] [RESTART] [ALIASES] [PROXY_EXTENTIONS]' check_args '2' "$#" 'USER DOMAIN [IP] [RESTART] [ALIASES] [PROXY_EXTENSIONS]'
is_format_valid 'user' 'domain' 'aliases' 'ip' 'proxy_ext' is_format_valid 'user' 'domain' 'aliases' 'ip' 'proxy_ext'
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user"
@ -120,12 +120,21 @@ if [ ! -z "$WEB_BACKEND" ]; then
check_result $? "Backend error" >/dev/null check_result $? "Backend error" >/dev/null
fi fi
# Preparing domain variables # Preparing domain aliases
if [ "$aliases" != 'none' ]; then if [ "$aliases" = 'none' ]; then
ALIAS="www.$domain,$aliases,$(get_ip_alias $domain)"
else
ALIAS='' ALIAS=''
else
ALIAS="www.$domain"
if [ ! -z "$aliases" ]; then
ALIAS="$ALIAS,$aliases"
fi
ip_alias=$(get_ip_alias $domain)
if [ ! -z "$ip_alias" ]; then
ALIAS="$ALIAS,$ip_alias"
fi
fi fi
# Preparing domain variables
prepare_web_domain_values prepare_web_domain_values
# Adding web server config # Adding web server config

View file

@ -12,8 +12,7 @@
# Argument definition # Argument definition
user=$1 user=$1
domain=$(idn -t --quiet -u "$2" ) domain=$2
domain_idn=$(idn -t --quiet -a "$domain")
template=$3 template=$3
default_extentions="jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,\ default_extentions="jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,\
exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm" exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm"
@ -51,6 +50,7 @@ is_proxy_template_valid $template
# Defining domain parameters # Defining domain parameters
get_domain_values 'web' get_domain_values 'web'
prepare_web_domain_values
local_ip=$(get_real_ip $IP) local_ip=$(get_real_ip $IP)
# Preparing domain values for the template substitution # Preparing domain values for the template substitution

View file

@ -485,7 +485,7 @@ local_backup(){
# Removing old backup # Removing old backup
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar$//") backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar$//")
echo -e "$(date "+%F %T") Roated: $backup_date" |\ echo -e "$(date "+%F %T") Rotated: $backup_date" |\
tee -a $BACKUP/$user.log tee -a $BACKUP/$user.log
rm -f $BACKUP/$backup rm -f $BACKUP/$backup
done done
@ -509,8 +509,6 @@ local_backup(){
localbackup='yes' localbackup='yes'
echo -e "$(date "+%F %T") Local: $BACKUP/$user.$date.tar" |\ echo -e "$(date "+%F %T") Local: $BACKUP/$user.$date.tar" |\
tee -a $BACKUP/$user.log tee -a $BACKUP/$user.log
U_BACKUPS=$(ls $BACKUP/ |grep "^$user." |wc -l)
update_user_value "$user" '$U_BACKUPS' "$U_BACKUPS"
} }
@ -594,7 +592,7 @@ ftp_backup() {
backups_rm_number=$((backups_count - BACKUPS + 1)) backups_rm_number=$((backups_count - BACKUPS + 1))
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar$//") backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar$//")
echo -e "$(date "+%F %T") Roated ftp backup: $backup_date" |\ echo -e "$(date "+%F %T") Rotated ftp backup: $backup_date" |\
tee -a $BACKUP/$user.log tee -a $BACKUP/$user.log
ftpc "cd $BPATH" "delete $backup" ftpc "cd $BPATH" "delete $backup"
done done
@ -729,7 +727,7 @@ sftp_backup() {
backups_rm_number=$((backups_count - BACKUPS + 1)) backups_rm_number=$((backups_count - BACKUPS + 1))
for backup in $(echo "$backup_list" |head -n $backups_rm_number); do for backup in $(echo "$backup_list" |head -n $backups_rm_number); do
backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar.*$//") backup_date=$(echo $backup |sed -e "s/$user.//" -e "s/.tar.*$//")
echo -e "$(date "+%F %T") Roated sftp backup: $backup_date" |\ echo -e "$(date "+%F %T") Rotated sftp backup: $backup_date" |\
tee -a $BACKUP/$user.log tee -a $BACKUP/$user.log
sftpc "cd $BPATH" "rm $backup" > /dev/null 2>&1 sftpc "cd $BPATH" "rm $backup" > /dev/null 2>&1
done done
@ -807,11 +805,14 @@ chmod 660 $USER_DATA/backup.conf
# Deleting task from queue # Deleting task from queue
sed -i "/v-backup-user $user /d" $VESTA/data/queue/backup.pipe sed -i "/v-backup-user $user /d" $VESTA/data/queue/backup.pipe
U_BACKUPS=$(grep BACKUP $USER_DATA/backup.conf |wc -l)
update_user_value "$user" '$U_BACKUPS' "$U_BACKUPS"
# Send notification # Send notification
if [ -e "$BACKUP/$user.log" ]; then if [ -e "$BACKUP/$user.log" ]; then
subj="$user → backup has been completed" subj="$user → backup has been completed"
email=$(get_user_value '$CONTACT') email=$(get_user_value '$CONTACT')
cat $BACKUP/$user.log #|$SENDMAIL -s "$subj" $email $notify cat $BACKUP/$user.log |$SENDMAIL -s "$subj" $email $notify
rm $BACKUP/$user.log rm $BACKUP/$user.log
fi fi

View file

@ -28,12 +28,7 @@ is_format_valid 'user' 'domain'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_valid 'dns' 'DOMAIN' "$domain" is_object_valid 'dns' 'DOMAIN' "$domain"
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -28,12 +28,7 @@ is_format_valid 'user' 'domain'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_valid 'dns' 'DOMAIN' "$domain" is_object_valid 'dns' 'DOMAIN' "$domain"
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result 1 $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $VESTA/bin/$SCRIPT |wc -l)" -gt 2 ]; then
check_result 1 $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -28,12 +28,7 @@ is_format_valid 'user' 'domain'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_valid 'dns' 'DOMAIN' "$domain" is_object_valid 'dns' 'DOMAIN' "$domain"
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -18,6 +18,8 @@ value=$2
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
#----------------------------------------------------------# #----------------------------------------------------------#
# Verifications # # Verifications #

119
bin/v-change-sys-service-config Executable file
View file

@ -0,0 +1,119 @@
#!/bin/bash
# info: change service config
# options: CONFIG SERVICE [RESTART]
#
# The function for changing service confguration.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
src=$1
service=$2
restart=$3
echo "$0 $*" >/tmp/t.log
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'CONFIG SERVICE [RESTART]'
if [ ! -e "$src" ]; then
check_result "$E_NOTEXIST" "$src config doesn't exist"
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining dst config path
case $service in
nginx) dst='/etc/nginx/nginx.conf';;
httpd) dst='/etc/httpd/conf/httpd.conf';;
apache2) dst='/etc/apache2/apache2.conf';;
exim) dst='/etc/exim/exim.conf';;
exim4) dst='/etc/exim4/exim4.conf.template';;
vsftpd) dst=$(find /etc/vsftpd* -name 'vsftpd.conf');;
proftpd) dst=$(find /etc/proftpd* -name 'proftpd.conf');;
php) dst=$(find /etc/php* -name php.ini);;
mysql) dst=$(find /etc/my* -name my.cnf);;
mariadb) dst=$(find /etc/my* -name my.cnf);;
postgresql) dst=$($BIN/v-list-sys-pgsql-config plain |cut -f 1);;
postgresql-hba) dst=$($BIN/v-list-sys-pgsql-config plain |cut -f 2);;
dovecot) dst=$(find /etc/dovecot* -name dovecot.conf);;
dovecot-1) dst='/etc/dovecot/conf.d/10-auth.conf';;
dovecot-2) dst='/etc/dovecot/conf.d/10-logging.conf';;
dovecot-3) dst='/etc/dovecot/conf.d/10-mail.conf';;
dovecot-4) dst='/etc/dovecot/conf.d/10-master.conf';;
dovecot-5) dst='/etc/dovecot/conf.d/10-ssl.conf';;
dovecot-6) dst='/etc/dovecot/conf.d/20-imap.conf';;
dovecot-7) dst='/etc/dovecot/conf.d/20-pop3.conf';;
dovecot-8) dst='/etc/dovecot/conf.d/auth-passwdfile.conf.ext';;
named) dst='/etc/named.conf';;
bind9) dst='/etc/bind/named.conf';;
bind9-opt) dst='/etc/bind/named.conf.options';;
spamd) dst=$($BIN/v-list-sys-spamd-config plain);;
spamassassin) dst=$($BIN/v-list-sys-spamd-config plain);;
clamd) dst=$($BIN/v-list-sys-clamd-config plain);;
cron) dst='/etc/crontab';;
crond) dst='/etc/crontab';;
fail2ban) dst='/etc/fail2ban/jail.local';;
*) check_result $E_NOTEXIST "service $service doesn't exist"
esac
# Checking config path
for config in $dst; do
if [ ! -e "$config" ]; then
check_result $E_NOTEXIST "$service config doesn't exist"
fi
done
# Checking diff between src and dst configs
for config in $dst; do
diff -q $src $config >/dev/null
if [ $? -ne 0 ]; then
cp $config $config.vst.back
cp $src $config
update="yes"
fi
done
# Restarting service
if [ "$update" = 'yes' ] && [ "$restart" != 'no' ]; then
if [ "$service" = 'php' ]; then
if [ "$WEB_SYSTEM" = "nginx" ]; then
service=$WEB_BACKEND
else
service=$WEB_SYSTEM
fi
fi
if [[ "$service" =~ - ]]; then
service=$(echo ${service%-*})
fi
service $service restart >/dev/null 2>&1
if [ $? -ne 0 ]; then
for config in $dst; do
mv -f $config.vst.back $config
done
check_result $E_RESTART "$service failed to start with new config"
fi
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -45,7 +45,7 @@ is_backend_template_valid $template
prepare_web_backend prepare_web_backend
# Deleting backend # Deleting backend
rm -f $pool/$backend.conf rm -f $pool/$backend_type.conf
# Allocating backend port # Allocating backend port
backend_port=9000 backend_port=9000
@ -63,10 +63,10 @@ cat $WEBTPL/$WEB_BACKEND/$template.tpl |\
-e "s|%user%|$user|"\ -e "s|%user%|$user|"\
-e "s|%domain%|$domain|"\ -e "s|%domain%|$domain|"\
-e "s|%domain_idn%|$domain_idn|"\ -e "s|%domain_idn%|$domain_idn|"\
-e "s|%backend%|$backend|g" > $pool/$backend.conf -e "s|%backend%|$backend_type|g" > $pool/$backend_type.conf
# Checking backend pool configuration # Checking backend pool configuration
if [ "$backend" = "$user" ]; then if [ "$backend_type" = "$user" ]; then
conf=$USER_DATA/web.conf conf=$USER_DATA/web.conf
fields='$DOMAIN' fields='$DOMAIN'
nohead=1 nohead=1

97
bin/v-change-web-domain-name Executable file
View file

@ -0,0 +1,97 @@
#!/bin/bash
# info: change web domain name
# options: USER DOMAIN NEW_DOMAIN [RESTART]
#
# The call is used for changing the domain name.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
domain=$2
new_domain=$3
restart=$4
domain_idn="$domain"
if [[ "$domain" = *[![:ascii:]]* ]]; then
domain_idn=$(idn -t --quiet -a $domain)
fi
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/func/ip.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN NEW_DOMAIN [RESTART]'
is_format_valid 'user' 'domain'
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
check_new_domain=$(grep "DOMAIN='$new_domain'" $VESTA/data/users/*/web.conf)
if [ ! -z "$check_new_domain" ]; then
check_result $E_EXISTS "$new_domain already exists"
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Fetching domain variables
get_domain_values 'web'
# Changing domain in web.conf
sed -i "s/DOMAIN='$domain'/DOMAIN='$new_domain'/" $USER_DATA/web.conf
new_alias=$(echo "$ALIAS,$domain" |\
sed -e "s/,/\n/g"|\
sed -e "s/^$new_domain$//g"|\
sed -e "/^$/d"|\
sed -e ':a;N;$!ba;s/\n/,/g')
# Updating domain alias
if [ "$ALIAS" != "$new_alias" ]; then
sed -i "s/ALIAS='$ALIAS'/ALIAS='$new_alias'/" $USER_DATA/web.conf
fi
# Moving document root and domain logs
mv $HOMEDIR/$user/web/$domain $HOMEDIR/$user/web/$new_domain/
cd /var/log/$WEB_SYSTEM/domains
mv $domain.log $new_domain.log
mv $domain.error.log $new_domain.error.log
mv $domain.bytes $new_domain.bytes
rm -f $HOMEDIR/$user/web/$new_domain/logs/$domain.*
# Updating domain certificates
if [ -e "$USER_DATA/ssl/$domain.crt" ]; then
cd $USER_DATA/ssl
mv $domain.crt $new_domain.crt
mv $domain.ca $new_domain.ca
mv $domain.pem $new_domain.pem
mv $domain.key $new_domain.key
rm -f $HOMEDIR/$user/conf/web/ssl.$domain.*
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Rebuilding vhosts
$BIN/v-rebuild-web-domains $user $restart
# Logging
log_history "changed web domain name $old_domain to $new_domain"
log_event "$OK" "$EVENT"
exit

View file

@ -54,9 +54,9 @@ fi
# Defining variables for new vhost config # Defining variables for new vhost config
prepare_web_domain_values prepare_web_domain_values
add_web_config "$WEB_SYSTEM" "$TPL.tpl" add_web_config "$WEB_SYSTEM" "$template.tpl"
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
add_web_config "$WEB_SYSTEM" "$TPL.stpl" add_web_config "$WEB_SYSTEM" "$template.stpl"
fi fi

View file

@ -26,12 +26,7 @@ source $VESTA/conf/vesta.conf
check_args '2' "$#" 'USER DOMAIN' check_args '2' "$#" 'USER DOMAIN'
is_format_valid 'user' 'domain' is_format_valid 'user' 'domain'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -22,12 +22,7 @@ source $VESTA/conf/vesta.conf
#----------------------------------------------------------# #----------------------------------------------------------#
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -27,12 +27,7 @@ source $VESTA/conf/vesta.conf
check_args '3' "$#" 'USER DOMAIN ID' check_args '3' "$#" 'USER DOMAIN ID'
is_format_valid 'user' 'domain' 'id' is_format_valid 'user' 'domain' 'id'
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check remote_dns_health_check

View file

@ -21,7 +21,7 @@ org=$6
org_unit=$7 org_unit=$7
aliases=$8 aliases=$8
format=${9-shell} format=${9-shell}
KEY_SIZE=2048 KEY_SIZE=4096
DAYS=365 DAYS=365
# Includes # Includes

View file

@ -23,7 +23,7 @@ json_list() {
echo -n ' "'$job'": { echo -n ' "'$job'": {
"MIN": "'$MIN'", "MIN": "'$MIN'",
"HOUR": "'$HOUR'", "HOUR": "'$HOUR'",
"DAY": "'$HOUR'", "DAY": "'$DAY'",
"MONTH": "'$MONTH'", "MONTH": "'$MONTH'",
"WDAY": "'$WDAY'", "WDAY": "'$WDAY'",
"CMD": "'$CMD'", "CMD": "'$CMD'",

73
bin/v-list-sys-clamd-config Executable file
View file

@ -0,0 +1,73 @@
#!/bin/bash
# info: list clamd config parameters
# options: [FORMAT]
#
# The function for obtaining the list of clamd config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
echo '{
"CONFIG": {
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "config_path: $config_path"
}
# PLAIN list function
plain_list() {
echo "$config_path"
}
# CSV list function
csv_list() {
echo "config_path"
echo "$config_path"
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
if [ -e '/etc/clamav/clamd.conf' ]; then
config_path='/etc/clamav/clamd.conf'
else
if [ -e '/etc/clamd.conf' ]; then
config_path='/etc/clamd.conf'
fi
if [ -e '/etc/clamd.d/clamd.conf' ]; then
config_path='/etc/clamav/clamd.conf'
fi
fi
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

103
bin/v-list-sys-dovecot-config Executable file
View file

@ -0,0 +1,103 @@
#!/bin/bash
# info: list dovecot config parameters
# options: [FORMAT]
#
# The function for obtaining the list of dovecot config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
echo '{
"CONFIG": {
"config_path": "'$config_path'",
"config_path1": "'$config_path1'",
"config_path2": "'$config_path2'",
"config_path3": "'$config_path3'",
"config_path4": "'$config_path4'",
"config_path5": "'$config_path5'",
"config_path6": "'$config_path6'",
"config_path7": "'$config_path7'",
"config_path8": "'$config_path8'"
}
}'
}
# SHELL list function
shell_list() {
echo "config_path: $config_path"
echo "config_path1: $config_path1"
echo "config_path2: $config_path2"
echo "config_path3: $config_path3"
echo "config_path4: $config_path4"
echo "config_path5: $config_path5"
echo "config_path6: $config_path6"
echo "config_path7: $config_path7"
echo "config_path8: $config_path8"
}
# PLAIN list function
plain_list() {
echo -en "$config_path\t"
echo -en "$config_path1\t"
echo -en "$config_path2\t"
echo -en "$config_path3\t"
echo -en "$config_path4\t"
echo -en "$config_path5\t"
echo -en "$config_path6\t"
echo -en "$config_path7\t"
echo -e "$config_path8\t"
}
# CSV list function
csv_list() {
echo -n "config_path,config_path1,config_path2,config_path3,"
echo "config_path4,config_path5,config_path6,config_path7,config_path8"
echo -n "$config_path,$config_path1,$config_path2,$config_path3,"
echo -n "$config_path4,$config_path5,$config_path6,$config_path7,"
echo "$config_path8"
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
if [ -e '/etc/dovecot.conf' ]; then
config_path='/etc/dovecot.conf'
else
config_path='/etc/dovecot/dovecot.conf'
config_path1='/etc/dovecot/conf.d/10-auth.conf'
config_path2='/etc/dovecot/conf.d/10-logging.conf'
config_path3='/etc/dovecot/conf.d/10-mail.conf'
config_path4='/etc/dovecot/conf.d/10-master.conf'
config_path5='/etc/dovecot/conf.d/10-ssl.conf'
config_path6='/etc/dovecot/conf.d/20-imap.conf'
config_path7='/etc/dovecot/conf.d/20-pop3.conf'
config_path8='/etc/dovecot/conf.d/auth-passwdfile.conf.ext'
fi
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

82
bin/v-list-sys-mysql-config Executable file
View file

@ -0,0 +1,82 @@
#!/bin/bash
# info: list mysql config parameters
# options: [FORMAT]
#
# The function for obtaining the list of mysql config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
# JSON list function
json_list() {
eval $(echo "$config"|egrep "$keys"|\
sed -e "s/[ ]*=/=/" -e "s/=[ ]*/=\'/" -e "s/$/'/")
echo '{
"CONFIG": {
"max_user_connections": "'$max_user_connections'",
"max_connections": "'$max_connections'",
"wait_timeout": "'$wait_timeout'",
"interactive_timeout": "'$interactive_timeout'",
"max_allowed_packet": "'$max_allowed_packet'",
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "$config" |egrep "$keys" |tr '=' ' '
echo "config_path $config_path"
}
# PLAIN list function
plain_list() {
echo "$config" |egrep "$keys" |tr '=' ' '
echo "config_path $config_path"
}
# CSV list function
csv_list() {
echo "$keys" |sed "s/|/,/g"
echo "$config" |egrep "$keys" |tr '=' ' ' |awk '{print $2}' |tr '\n' ','
echo
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
config_path=$(find /etc/my* -name my.cnf)
# Defining keys
keys="max_user_connections|max_connections|wait_timeout|interactive_timeout"
keys="${keys}|max_allowed_packet"
# Reading config
config=$(cat $config_path|grep -v "^;")
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list |column -t;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

88
bin/v-list-sys-nginx-config Executable file
View file

@ -0,0 +1,88 @@
#!/bin/bash
# info: list nginx config parameters
# options: [FORMAT]
#
# The function for obtaining the list of nginx config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
eval $(echo "$config" |egrep "$keys" |tr -d ';'| awk '{print $1"="$2}')
echo '{
"CONFIG": {
"worker_processes": "'$worker_processes'",
"worker_connections": "'$worker_connections'",
"send_timeout": "'$send_timeout'",
"proxy_connect_timeout": "'$proxy_connect_timeout'",
"proxy_send_timeout": "'$proxy_send_timeout'",
"proxy_read_timeout": "'$proxy_read_timeout'",
"client_max_body_size": "'$client_max_body_size'",
"gzip": "'$gzip'",
"gzip_comp_level": "'$gzip_comp_level'",
"charset": "'$charset'",
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "$config" |egrep "$keys" |tr -d ';'
echo "config_path $config_path"
}
# PLAIN list function
plain_list() {
echo "$config" |egrep "$keys" |tr -d ';'
echo "config_path $config_path"
}
# CSV list function
csv_list() {
echo "$keys" |sed "s/ |/,/g"
echo "$config" |egrep "$keys" |awk '{print $2}' |tr -d ';' |tr '\n' ','
echo
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
config_path='/etc/nginx/nginx.conf'
# Defining keys
keys="worker_processes |worker_connections |send_timeout"
keys="$keys |proxy_connect_timeout |proxy_send_timeout"
keys="$keys |proxy_read_timeout |client_max_body_size"
keys="$keys |gzip |gzip_comp_level |charset "
# Reading nginx config
config=$(cat $config_path)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list |column -t;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

70
bin/v-list-sys-pgsql-config Executable file
View file

@ -0,0 +1,70 @@
#!/bin/bash
# info: list postgresql config parameters
# options: [FORMAT]
#
# The function for obtaining the list of postgresql config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
echo '{
"CONFIG": {
"pg_hba_path": "'$pg_hba_path'",
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "config_path: $config_path"
echo "pg_hba_path: $pg_hba_path"
}
# PLAIN list function
plain_list() {
echo -e "$config_path\t$pg_hba_path"
}
# CSV list function
csv_list() {
echo "config_path,pg_hba_path"
echo "$config_path,$pg_hba_path"
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
config_path=$(find /etc/postgresql /var/lib/pgsql/data -name \
postgresql.conf 2>/dev/null)
pg_hba_path=$(find /etc/postgresql /var/lib/pgsql/data -name \
pg_hba.conf 2>/dev/null)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

94
bin/v-list-sys-php-config Executable file
View file

@ -0,0 +1,94 @@
#!/bin/bash
# info: list php config parameters
# options: [FORMAT]
#
# The function for obtaining the list of php config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
# JSON list function
json_list() {
eval $(echo "$config"|egrep "$keys"|\
sed -e "s/[ ]*=/=/" -e "s/=[ ]*/=\'/" -e "s/$/'/")
echo '{
"CONFIG": {
"memory_limit": "'$memory_limit'",
"max_execution_time": "'$max_execution_time'",
"max_input_time": "'$max_input_time'",
"upload_max_filesize": "'$upload_max_filesize'",
"post_max_size": "'$post_max_size'",
"display_errors": "'$display_errors'",
"error_reporting": "'$error_reporting'",
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "$config" |egrep "$keys" |tr -d '='
echo "config_path $config_path"
}
# PLAIN list function
plain_list() {
echo "$config" |egrep "$keys" |tr -d '='
echo "config_path $config_path"
}
# CSV list function
csv_list() {
echo "$keys" |sed "s/ |/,/g"
echo "$config" |egrep "$keys" |tr -d '=' |awk '{print $2}' |tr '\n' ','
echo
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
config_path=$(find /etc/php* -name php.ini)
config_count=$(echo "$config_path" |wc -l)
if [ "$config_count" -gt 1 ]; then
if [ "$WEB_SYSTEM" = "nginx" ]; then
config_path=$(echo "$config_path"| grep fpm)
else
config_path=$(echo "$config_path"| grep apache)
fi
fi
# Defining keys
keys="memory_limit |max_execution_time |max_input_time"
keys="$keys |upload_max_filesize |post_max_size"
keys="$keys |display_errors |error_reporting "
# Reading config
config=$(cat $config_path|grep -v "^;")
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list |column -t;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

64
bin/v-list-sys-proftpd-config Executable file
View file

@ -0,0 +1,64 @@
#!/bin/bash
# info: list proftpd config parameters
# options: [FORMAT]
#
# The function for obtaining the list of proftpd config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
echo '{
"CONFIG": {
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "config_path: $config_path"
}
# PLAIN list function
plain_list() {
echo "$config_path"
}
# CSV list function
csv_list() {
echo "config_path"
echo "$config_path"
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
config_path=$(find /etc/proftpd* -name proftpd.conf 2>/dev/null)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

64
bin/v-list-sys-spamd-config Executable file
View file

@ -0,0 +1,64 @@
#!/bin/bash
# info: list spamassassin config parameters
# options: [FORMAT]
#
# The function for obtaining the list of spamassassin config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
echo '{
"CONFIG": {
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "config_path: $config_path"
}
# PLAIN list function
plain_list() {
echo "$config_path"
}
# CSV list function
csv_list() {
echo "config_path"
echo "$config_path"
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
config_path=$(find /etc/spamassassin /etc/mail -name local.cf 2>/dev/null)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

View file

@ -81,7 +81,7 @@ else
TIME=$(date -d @$pkg_date +"%T") TIME=$(date -d @$pkg_date +"%T")
fi fi
UPDATED='yes' UPDATED='yes'
if [ ! -z "$latest" ] && [ "$latest" != "vesta-$VERSION-$RELEASE" ]; then if [ ! -z "$latest" ] && [ "$latest" \> "vesta-$VERSION-$RELEASE" ]; then
UPDATED='no' UPDATED='no'
fi fi
data="NAME='vesta' VERSION='$VERSION' RELEASE='$RELEASE' ARCH='$ARCH'" data="NAME='vesta' VERSION='$VERSION' RELEASE='$RELEASE' ARCH='$ARCH'"

64
bin/v-list-sys-vsftpd-config Executable file
View file

@ -0,0 +1,64 @@
#!/bin/bash
# info: list vsftpd config parameters
# options: [FORMAT]
#
# The function for obtaining the list of vsftpd config parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# JSON list function
json_list() {
echo '{
"CONFIG": {
"config_path": "'$config_path'"
}
}'
}
# SHELL list function
shell_list() {
echo "config_path: $config_path"
}
# PLAIN list function
plain_list() {
echo "$config_path"
}
# CSV list function
csv_list() {
echo "config_path"
echo "$config_path"
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config path
config_path=$(find /etc/vsftpd* -name vsftpd.conf 2>/dev/null)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit

View file

@ -18,6 +18,7 @@ source $VESTA/func/main.sh
# JSON list function # JSON list function
json_list() { json_list() {
set -f
i=1 i=1
echo '{' echo '{'
echo ' "WEB": {' echo ' "WEB": {'
@ -27,7 +28,7 @@ json_list() {
object_keys=$(echo ${object//:/ } |wc -w) object_keys=$(echo ${object//:/ } |wc -w)
for key in $(echo "${object/:/ }"); do for key in $(echo "${object/:/ }"); do
if [ "$j" -eq 1 ]; then if [ "$j" -eq 1 ]; then
echo -n " \"$key\": " echo -n " \"${key}\": "
if [ "$object_keys" -eq 1 ]; then if [ "$object_keys" -eq 1 ]; then
echo -n '""' echo -n '""'
fi fi

View file

@ -27,7 +27,7 @@ json_list() {
echo -n ' "'$ID'": { echo -n ' "'$ID'": {
"CMD": "'$CMD'", "CMD": "'$CMD'",
"UNDO": "'$UNDO'", "UNDO": "'$UNDO'",
"DATE": "'$DATE'", "TIME": "'$TIME'",
"DATE": "'$DATE'" "DATE": "'$DATE'"
}' }'
if [ "$i" -lt "$objects" ]; then if [ "$i" -lt "$objects" ]; then

47
bin/v-open-fs-config Executable file
View file

@ -0,0 +1,47 @@
#!/bin/bash
# info: open config
# options: CONFIG
#
# The function opens/reads config files on the file system
src_file=$1
# Checking arguments
if [ -z "$src_file" ]; then
echo "Usage: CONFIG"
exit 1
fi
# Checking vesta user
if [ ! -e "$VESTA/data/users/$user" ]; then
echo "Error: vesta user $user doesn't exist"
exit 3
fi
# Checking file on fs
if [ ! -e "$src_file" ]; then
echo "Error: $src_file file doesn't exist"
exit 3
fi
# Checking path
if [ ! -z "$src_file" ]; then
rpath=$(readlink -f "$src_file")
services="nginx|apache|httpd|php|ftp|bind|named|exim|dovecot|spamassassin"
services="$services|clam|mysql|postgresql|pgsql|cron|fail2ban|iptables"
spath=$(echo "$rpath" |egrep "$services")
if [ -z "$spath" ]; then
echo "Error: invalid source path $src_file"
exit 2
fi
fi
# Reading conf
cat "$src_file" 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: file $src_file was not opened"
exit 3
fi
# Exiting
exit

View file

@ -33,6 +33,11 @@ if [ ! -z "$src_file" ]; then
echo "Error: invalid source path $src_file" echo "Error: invalid source path $src_file"
exit 2 exit 2
fi fi
if [ ! -f "$src_file" ]; then
echo "Error: file not found $src_file"
exit 2
fi
fi fi
# Reading file # Reading file

View file

@ -12,6 +12,7 @@
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
send_email_report() { send_email_report() {
email=$(grep CONTACT $VESTA/data/users/admin/user.conf) email=$(grep CONTACT $VESTA/data/users/admin/user.conf)

View file

@ -12,6 +12,7 @@
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
send_email_report() { send_email_report() {
if [ -e '/etc/named.conf' ]; then if [ -e '/etc/named.conf' ]; then

View file

@ -12,6 +12,7 @@
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
send_email_report() { send_email_report() {
email=$(grep CONTACT $VESTA/data/users/admin/user.conf) email=$(grep CONTACT $VESTA/data/users/admin/user.conf)

View file

@ -12,6 +12,7 @@
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
send_email_report() { send_email_report() {
email=$(grep CONTACT $VESTA/data/users/admin/user.conf) email=$(grep CONTACT $VESTA/data/users/admin/user.conf)

View file

@ -12,6 +12,7 @@
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
send_email_report() { send_email_report() {
email=$(grep CONTACT $VESTA/data/users/admin/user.conf) email=$(grep CONTACT $VESTA/data/users/admin/user.conf)

View file

@ -14,6 +14,7 @@ service=$1
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
#----------------------------------------------------------# #----------------------------------------------------------#

View file

@ -12,6 +12,7 @@
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
send_email_report() { send_email_report() {
email=$(grep CONTACT $VESTA/data/users/admin/user.conf) email=$(grep CONTACT $VESTA/data/users/admin/user.conf)

View file

@ -12,6 +12,7 @@
# Includes # Includes
source $VESTA/func/main.sh source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf source $VESTA/conf/vesta.conf
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
send_email_report() { send_email_report() {
email=$(grep CONTACT $VESTA/data/users/admin/user.conf) email=$(grep CONTACT $VESTA/data/users/admin/user.conf)

View file

@ -488,7 +488,7 @@ if [ "$db" != 'no' ] && [ ! -z "$DB_SYSTEM" ]; then
echo -e "$(date "+%F %T") $database" |tee -a $tmpdir/restore.log echo -e "$(date "+%F %T") $database" |tee -a $tmpdir/restore.log
# Checking database existance # Checking database existance
check_config=$(grep "DB='$db'" $USER_DATA/db.conf) check_config=$(grep "DB='$database'" $USER_DATA/db.conf)
# Unpacking database container # Unpacking database container
tar xf $BACKUP/$backup -C $tmpdir ./db/$database tar xf $BACKUP/$backup -C $tmpdir ./db/$database

View file

@ -22,12 +22,7 @@ source $VESTA/conf/vesta.conf
#----------------------------------------------------------# #----------------------------------------------------------#
is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then is_procces_running
check_result $E_NOTEXIST "dns-cluster.conf doesn't exist"
fi
if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then
check_result $E_EXISTS "another sync process already running"
fi
remote_dns_health_check 'no_email' remote_dns_health_check 'no_email'

View file

@ -61,9 +61,9 @@ fi
# Parsing data # Parsing data
if [ "$period" = 'daily' ]; then if [ "$period" = 'daily' ]; then
mem=$(free -m) mem=$(free -m)
used=$(echo "$mem" |awk '{print $3}'|head -n3 |tail -n1) used=$(echo "$mem" |grep Mem |awk '{print $3}')
free=$(echo "$mem" |awk '{print $4}'|head -n3 |tail -n1) free=$(echo "$mem" |grep Mem |awk '{print $4}')
swap=$(echo "$mem" |awk '{print $3}'|tail -n1) swap=$(echo "$mem" |grep Swap |awk '{print $3}')
# Updating rrd # Updating rrd
rrdtool update $RRD/mem/mem.rrd N:$used:$swap:$free rrdtool update $RRD/mem/mem.rrd N:$used:$swap:$free

View file

@ -37,9 +37,7 @@ fi
# Parsing db hosts # Parsing db hosts
conf="$VESTA/conf/mysql.conf" conf="$VESTA/conf/mysql.conf"
fields='$HOST' hosts=$(grep HOST $conf |awk '{print $1}' |cut -f 2 -d \')
nohead=1
hosts=$(shell_list)
check_row=$(echo "$hosts" |wc -l) check_row=$(echo "$hosts" |wc -l)
if [ 0 -eq "$check_row" ]; then if [ 0 -eq "$check_row" ]; then
exit exit

View file

@ -37,9 +37,7 @@ fi
# Parsing db hosts # Parsing db hosts
conf="$VESTA/conf/pgsql.conf" conf="$VESTA/conf/pgsql.conf"
fields='$HOST' hosts=$(grep HOST $conf |awk '{print $1}' |cut -f 2 -d \')
nohead=1
hosts=$(shell_list)
check_row=$(echo "$hosts" |wc -l) check_row=$(echo "$hosts" |wc -l)
if [ 0 -eq "$check_row" ]; then if [ 0 -eq "$check_row" ]; then
exit exit

View file

@ -0,0 +1,91 @@
#!/bin/bash
# info: updating ssl certificate for domain
# options: USER DOMAIN SSL_DIR [RESTART]
#
# The function updates the SSL certificate for a domain. Parameter ssl_dir is a path
# to directory where 2 or 3 ssl files can be found. Certificate file
# domain.tld.crt and its key domain.tld.key are mandatory. Certificate
# authority domain.tld.ca file is optional.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
ssl_dir=$3
restart="$4"
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/func/ip.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN SSL_DIR [RESTART]'
validate_format 'user' 'domain' 'ssl_dir'
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
is_system_enabled "$WEB_SSL" 'SSL_SUPPORT'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$SSL'
is_web_domain_cert_valid
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Adding certificate to user data directory
cp -f $ssl_dir/$domain.crt $USER_DATA/ssl/$domain.crt
cp -f $ssl_dir/$domain.key $USER_DATA/ssl/$domain.key
cp -f $ssl_dir/$domain.crt $USER_DATA/ssl/$domain.pem
if [ -e "$ssl_dir/$domain.ca" ]; then
cp -f $ssl_dir/$domain.ca $USER_DATA/ssl/$domain.ca
echo >> $USER_DATA/ssl/$domain.pem
cat $USER_DATA/ssl/$domain.ca >> $USER_DATA/ssl/$domain.pem
fi
chmod 660 $USER_DATA/ssl/$domain.*
# Adding certificate to user dir
cp -f $USER_DATA/ssl/$domain.crt $HOMEDIR/$user/conf/web/ssl.$domain.crt
cp -f $USER_DATA/ssl/$domain.key $HOMEDIR/$user/conf/web/ssl.$domain.key
cp -f $USER_DATA/ssl/$domain.pem $HOMEDIR/$user/conf/web/ssl.$domain.pem
if [ -e "$USER_DATA/ssl/$domain.ca" ]; then
cp -f $USER_DATA/ssl/$domain.ca $HOMEDIR/$user/conf/web/ssl.$domain.ca
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restarting web server
if [ "$restart" != 'no' ]; then
$BIN/v-restart-web
check_result $? "Web restart failed" >/dev/null
if [ ! -z "$PROXY_SYSTEM" ]; then
$BIN/v-restart-proxy
check_result $? "Proxy restart failed" >/dev/null
fi
fi
# Logging
log_history "update ssl certificate for $domain"
log_event "$OK" "$EVENT"
exit

View file

@ -387,7 +387,7 @@ get_mysql_disk_usage() {
query="SELECT SUM( data_length + index_length ) / 1024 / 1024 \"Size\" query="SELECT SUM( data_length + index_length ) / 1024 / 1024 \"Size\"
FROM information_schema.TABLES WHERE table_schema='$database'" FROM information_schema.TABLES WHERE table_schema='$database'"
usage=$(mysql_query "$query" |tail -n1) usage=$(mysql_query "$query" |tail -n1)
if [ "$usage" == 'NULL' ] || [ "${usage:0:1}" -eq '0' ]; then if [ "$usage" == '' ] || [ "$usage" == 'NULL' ] || [ "${usage:0:1}" -eq '0' ]; then
usage=1 usage=1
fi fi
export LC_ALL=C export LC_ALL=C

View file

@ -223,7 +223,7 @@ add_web_config() {
trigger="${2/.*pl/.sh}" trigger="${2/.*pl/.sh}"
if [ -x "$WEBTPL/$1/$WEB_BACKEND/$trigger" ]; then if [ -x "$WEBTPL/$1/$WEB_BACKEND/$trigger" ]; then
$WEBTPL/$1/$WEB_BACKEND/$trigger \ $WEBTPL/$1/$WEB_BACKEND/$trigger \
$user $domain $ip $HOMEDIR $HOMEDIR/$user/web/$domain/public_html $user $domain $local_ip $HOMEDIR $HOMEDIR/$user/web/$domain/public_html
fi fi
} }
@ -237,7 +237,7 @@ get_web_config_lines() {
fi fi
vhost_lines=$(grep -niF "name $domain_idn" $2) vhost_lines=$(grep -niF "name $domain_idn" $2)
vhost_lines=$(echo "$vhost_lines" |egrep "$domain_idn$|$domain_idn ") vhost_lines=$(echo "$vhost_lines" |egrep "$domain_idn($| |;)") #"
vhost_lines=$(echo "$vhost_lines" |cut -f 1 -d :) vhost_lines=$(echo "$vhost_lines" |cut -f 1 -d :)
if [ -z "$vhost_lines" ]; then if [ -z "$vhost_lines" ]; then
check_result $E_PARSING "can't parse config $2" check_result $E_PARSING "can't parse config $2"
@ -271,8 +271,8 @@ del_web_config() {
get_web_config_lines $WEBTPL/$1/$WEB_BACKEND/$2 $conf get_web_config_lines $WEBTPL/$1/$WEB_BACKEND/$2 $conf
sed -i "$top_line,$bottom_line d" $conf sed -i "$top_line,$bottom_line d" $conf
web_domains=$(grep DOMAIN $USER_DATA/web.conf |wc -l) web_domain=$(grep $domain $USER_DATA/web.conf |wc -l)
if [ "$web_domains" -eq '0' ]; then if [ "$web_domain" -eq '0' ]; then
sed -i "/.*\/$user\/.*$1.conf/d" /etc/$1/conf.d/vesta.conf sed -i "/.*\/$user\/.*$1.conf/d" /etc/$1/conf.d/vesta.conf
rm -f $conf rm -f $conf
fi fi
@ -281,29 +281,21 @@ del_web_config() {
# SSL certificate verification # SSL certificate verification
is_web_domain_cert_valid() { is_web_domain_cert_valid() {
if [ ! -e "$ssl_dir/$domain.crt" ]; then if [ ! -e "$ssl_dir/$domain.crt" ]; then
echo "Error: $ssl_dir/$domain.crt not found" check_result $E_NOTEXIST "$ssl_dir/$domain.crt not found"
log_event "$E_NOTEXIST" "$ARGUMENTS"
exit $E_NOTEXIST
fi fi
if [ ! -e "$ssl_dir/$domain.key" ]; then if [ ! -e "$ssl_dir/$domain.key" ]; then
echo "Error: $ssl_dir/$domain.key not found" check_result $E_NOTEXIST "$ssl_dir/$domain.key not found"
log_event "$E_NOTEXIST" "$ARGUMENTS"
exit $E_NOTEXIST
fi fi
crt_vrf=$(openssl verify $ssl_dir/$domain.crt 2>&1) crt_vrf=$(openssl verify $ssl_dir/$domain.crt 2>&1)
if [ ! -z "$(echo $crt_vrf | grep 'unable to load')" ]; then if [ ! -z "$(echo $crt_vrf |grep 'unable to load')" ]; then
echo "Error: SSL Certificate is not valid" check_result $E_INVALID "SSL Certificate is not valid"
log_event "$E_INVALID" "$ARGUMENTS"
exit $E_INVALID
fi fi
if [ ! -z "$(echo $crt_vrf | grep 'unable to get local issuer')" ]; then if [ ! -z "$(echo $crt_vrf |grep 'unable to get local issuer')" ]; then
if [ ! -e "$ssl_dir/$domain.ca" ]; then if [ ! -e "$ssl_dir/$domain.ca" ]; then
echo "Error: Certificate Authority not found" check_result $E_NOTEXIST "Certificate Authority not found"
log_event "$E_NOTEXIST" "$ARGUMENTS"
exit $E_NOTEXIST
fi fi
fi fi
@ -313,17 +305,16 @@ is_web_domain_cert_valid() {
s2=$(openssl x509 -text -in $ssl_dir/$domain.ca 2>/dev/null) s2=$(openssl x509 -text -in $ssl_dir/$domain.ca 2>/dev/null)
s2=$(echo "$s2" |grep Subject |awk -F = '{print $6}' |head -n1) s2=$(echo "$s2" |grep Subject |awk -F = '{print $6}' |head -n1)
if [ "$s1" != "$s2" ]; then if [ "$s1" != "$s2" ]; then
echo "Error: SSL intermediate chain is not valid" check_result $E_NOTEXIST "SSL intermediate chain is not valid"
log_event "$E_NOTEXIST" "$ARGUMENTS"
exit $E_NOTEXIST
fi fi
fi fi
key_vrf=$(grep 'PRIVATE KEY' $ssl_dir/$domain.key | wc -l) key_vrf=$(grep 'PRIVATE KEY' $ssl_dir/$domain.key |wc -l)
if [ "$key_vrf" -ne 2 ]; then if [ "$key_vrf" -ne 2 ]; then
echo "Error: SSL Key is not valid" check_result $E_INVALID "SSL Key is not valid"
log_event "$E_INVALID" "$ARGUMENTS" fi
exit $E_INVALID if [ ! -z "$(grep 'ENCRYPTED' $ssl_dir/$domain.key)" ]; then
check_result $E_FORBIDEN "SSL Key is protected (remove pass_phrase)"
fi fi
openssl s_server -quiet -cert $ssl_dir/$domain.crt \ openssl s_server -quiet -cert $ssl_dir/$domain.crt \
@ -332,11 +323,7 @@ is_web_domain_cert_valid() {
sleep 0.5 sleep 0.5
disown &> /dev/null disown &> /dev/null
kill $pid &> /dev/null kill $pid &> /dev/null
if [ "$?" -ne '0' ]; then check_result $? "ssl certificate key pair is not valid" $E_INVALID
echo "Error: ssl certificate key pair is not valid"
log_event "$E_INVALID" "$ARGUMENTS"
exit $E_INVALID
fi
} }

View file

@ -87,9 +87,9 @@ increase_ip_value() {
fi fi
sed -i "s/$web_key='$current_web'/$web_key='$new_web'/g" \ sed -i "s/$web_key='$current_web'/$web_key='$new_web'/g" \
$VESTA/data/ips/$ip $VESTA/data/ips/$sip
sed -i "s/$usr_key='$current_usr'/$usr_key='$new_usr'/g" \ sed -i "s/$usr_key='$current_usr'/$usr_key='$new_usr'/g" \
$VESTA/data/ips/$ip $VESTA/data/ips/$sip
} }
# Decrease ip value # Decrease ip value

View file

@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Internal variables # Internal variables
HOMEDIR='/home' HOMEDIR='/home'
BACKUP='/backup' BACKUP='/backup'
@ -97,7 +98,7 @@ check_result() {
# Argument list checker # Argument list checker
check_args() { check_args() {
if [ "$1" -gt "$2" ]; then if [ "$1" -gt "$2" ]; then
echo "Usage: $SCRIPT $3" echo "Usage: $(basename $0) $3"
check_result $E_ARGS "not enought arguments" >/dev/null check_result $E_ARGS "not enought arguments" >/dev/null
fi fi
} }
@ -448,6 +449,7 @@ sync_cron_jobs() {
rm -f $crontab rm -f $crontab
if [ "$CRON_REPORTS" = 'yes' ]; then if [ "$CRON_REPORTS" = 'yes' ]; then
echo "MAILTO=$CONTACT" > $crontab echo "MAILTO=$CONTACT" > $crontab
echo 'CONTENT_TYPE="text/plain; charset=utf-8"' >> $crontab
fi fi
while read line; do while read line; do
eval $line eval $line
@ -465,12 +467,12 @@ sync_cron_jobs() {
is_user_format_valid() { is_user_format_valid() {
if [ ${#1} -eq 1 ]; then if [ ${#1} -eq 1 ]; then
if ! [[ "$1" =~ ^^[[:alnum:]]$ ]]; then if ! [[ "$1" =~ ^^[[:alnum:]]$ ]]; then
echo "invalid $2 format :: $1" check_result $E_INVALID "invalid $2 format :: $1"
fi fi
else else
if ! [[ "$1" =~ ^[[:alnum:]][-|\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]] if ! [[ "$1" =~ ^[[:alnum:]][-|\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]]
then then
echo "invalid $2 format :: $1" check_result $E_INVALID "invalid $2 format :: $1"
fi fi
fi fi
} }
@ -479,7 +481,7 @@ is_user_format_valid() {
is_domain_format_valid() { is_domain_format_valid() {
object_name=${2-domain} object_name=${2-domain}
exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%|\`| ]" exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%|\`| ]"
if [[ $1 =~ $exclude ]] || [[ $1 =~ ^[0-9]+$ ]] || [[ $1 =~ \.\. ]]; then if [[ $1 =~ $exclude ]] || [[ $1 =~ ^[0-9]+$ ]] || [[ $1 =~ "\.\." ]]; then
check_result $E_INVALID "invalid $object_name format :: $1" check_result $E_INVALID "invalid $object_name format :: $1"
fi fi
} }
@ -501,15 +503,14 @@ is_alias_format_valid() {
is_ip_format_valid() { is_ip_format_valid() {
object_name=${2-ip} object_name=${2-ip}
ip_regex='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])' ip_regex='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
ip_clean=$(echo "${1%/[0-9][0-9]}") ip_clean=$(echo "${1%/*}")
ip_clean=$(echo "${1%/[0-9]}")
if ! [[ $ip_clean =~ ^$ip_regex\.$ip_regex\.$ip_regex\.$ip_regex$ ]]; then if ! [[ $ip_clean =~ ^$ip_regex\.$ip_regex\.$ip_regex\.$ip_regex$ ]]; then
check_result $E_INVALID "invalid $object_name format :: $1" check_result $E_INVALID "invalid $object_name format :: $1"
fi fi
if [ $1 != "$ip_clean" ]; then if [ $1 != "$ip_clean" ]; then
ip_cidr="$ip_clean/" ip_cidr="$ip_clean/"
ip_cidr=$(echo "${1#$ip_cidr}") ip_cidr=$(echo "${1#$ip_cidr}")
if [[ "$ip_cidr" -gt 32 ]]; then if [[ "$ip_cidr" -gt 32 ]] || [[ "$ip_cidr" =~ [:alnum:] ]]; then
check_result $E_INVALID "invalid $object_name format :: $1" check_result $E_INVALID "invalid $object_name format :: $1"
fi fi
fi fi
@ -589,7 +590,7 @@ is_dbuser_format_valid() {
# DNS record type validator # DNS record type validator
is_dns_type_format_valid() { is_dns_type_format_valid() {
known_dnstype='A,AAAA,NS,CNAME,MX,TXT,SRV,DNSKEY,KEY,IPSECKEY,PTR,SPF' known_dnstype='A,AAAA,NS,CNAME,MX,TXT,SRV,DNSKEY,KEY,IPSECKEY,PTR,SPF,TLSA'
if [ -z "$(echo $known_dnstype |grep -w $1)" ]; then if [ -z "$(echo $known_dnstype |grep -w $1)" ]; then
check_result $E_INVALID "invalid dns record type format :: $1" check_result $E_INVALID "invalid dns record type format :: $1"
fi fi
@ -601,10 +602,10 @@ is_dns_record_format_valid() {
is_ip_format_valid "$1" is_ip_format_valid "$1"
fi fi
if [ "$rtype" = 'NS' ]; then if [ "$rtype" = 'NS' ]; then
is_domain_format_valid "$1" 'ns_record' is_domain_format_valid "${1::-1}" 'ns_record'
fi fi
if [ "$rtype" = 'MX' ]; then if [ "$rtype" = 'MX' ]; then
is_domain_format_valid "$1" 'mx_record' is_domain_format_valid "${1::-1}" 'mx_record'
is_int_format_valid "$priority" 'priority_record' is_int_format_valid "$priority" 'priority_record'
fi fi
@ -612,7 +613,7 @@ is_dns_record_format_valid() {
# Email format validator # Email format validator
is_email_format_valid() { is_email_format_valid() {
if [[ ! "$1" =~ "@" ]] ; then if [[ ! "$1" =~ ^[A-Za-z0-9._%+-]+@[[:alnum:].-]+\.[A-Za-z]{2,63}$ ]] ; then
check_result $E_INVALID "invalid email format :: $1" check_result $E_INVALID "invalid email format :: $1"
fi fi
} }

View file

@ -1,3 +1,13 @@
# Check if script already running or not
is_procces_running() {
SCRIPT=$(basename $0)
for pid in $(pidof -x $SCRIPT); do
if [ $pid != $$ ]; then
check_result $E_INUSE "$SCRIPT is already running"
fi
done
}
send_api_cmd() { send_api_cmd() {
answer=$(curl -s -k \ answer=$(curl -s -k \
--data-urlencode "user=$USER" \ --data-urlencode "user=$USER" \

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -0,0 +1,10 @@
[www]
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
user = www-data
group = www-data
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 35

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -8,7 +8,7 @@ LocalSocketMode 666
# TemporaryDirectory is not set to its default /tmp here to make overriding # TemporaryDirectory is not set to its default /tmp here to make overriding
# the default with environment variables TMPDIR/TMP/TEMP possible # the default with environment variables TMPDIR/TMP/TEMP possible
User clamav User clamav
AllowSupplementaryGroups true # AllowSupplementaryGroups true
ScanMail true ScanMail true
ScanArchive true ScanArchive true
ArchiveBlockEncrypted false ArchiveBlockEncrypted false

View file

@ -8,6 +8,9 @@
#SPAM_SCORE = 50 #SPAM_SCORE = 50
#CLAMD = yes #CLAMD = yes
add_environment=<; PATH=/bin:/usr/bin
keep_environment=
domainlist local_domains = dsearch;/etc/exim4/domains/ domainlist local_domains = dsearch;/etc/exim4/domains/
domainlist relay_to_domains = dsearch;/etc/exim4/domains/ domainlist relay_to_domains = dsearch;/etc/exim4/domains/
hostlist relay_from_hosts = 127.0.0.1 hostlist relay_from_hosts = 127.0.0.1

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -1,4 +1,4 @@
# Fail2Ban filter for unsuccessful Vesta authentication attempts # Fail2Ban filter for unsuccesfull Vesta authentication attempts
# #
[INCLUDES] [INCLUDES]

View file

@ -12,4 +12,8 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -1,4 +1,4 @@
# Fail2Ban filter for unsuccessful Vesta authentication attempts # Fail2Ban filter for unsuccesfull Vesta authentication attempts
# #
[INCLUDES] [INCLUDES]

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -197,7 +197,7 @@ AllowSupplementaryGroups yes
# Don't fork into background. # Don't fork into background.
# Default: no # Default: no
#Foreground yes Foreground yes
# Enable debug messages in libclamav. # Enable debug messages in libclamav.
# Default: no # Default: no

View file

@ -4,7 +4,7 @@ After = syslog.target nss-lookup.target network.target
[Service] [Service]
Type = simple Type = simple
ExecStart = /usr/sbin/clamd -c /etc/clamd.conf --nofork=yes ExecStart = /usr/sbin/clamd -c /etc/clamd.conf
Restart = on-failure Restart = on-failure
PrivateTmp = true PrivateTmp = true

View file

@ -143,7 +143,7 @@ acl_check_data:
hosts = !+relay_from_hosts hosts = !+relay_from_hosts
condition = ${if < {$message_size}{100K}} condition = ${if < {$message_size}{100K}}
condition = ${if eq{$acl_m1}{yes}{yes}{no}} condition = ${if eq{$acl_m1}{yes}{yes}{no}}
spam = nobody:true/defer_ok spam = spamd:true/defer_ok
add_header = X-Spam-Score: $spam_score_int add_header = X-Spam-Score: $spam_score_int
add_header = X-Spam-Bar: $spam_bar add_header = X-Spam-Bar: $spam_bar
add_header = X-Spam-Report: $spam_report add_header = X-Spam-Report: $spam_report

View file

@ -1,4 +1,4 @@
# Fail2Ban filter for unsuccessful Vesta authentication attempts # Fail2Ban filter for unsuccesfull Vesta authentication attempts
# #
[INCLUDES] [INCLUDES]

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -0,0 +1,52 @@
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
location / {
try_files $uri $uri/ @opencart;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain%.conf*;
}

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

View file

@ -12,4 +12,7 @@ location /phpmyadmin {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
} }

View file

@ -5,8 +5,8 @@ listen.allowed_clients = 127.0.0.1
user = %user% user = %user%
group = %user% group = %user%
listen.owner = %user% listen.owner = www-data
listen.group = nginx listen.group = www-data
pm = dynamic pm = dynamic
pm.max_children = 50 pm.max_children = 50

Some files were not shown because too many files have changed in this diff Show more