Merge branch 'master' of github.com:serghey-rodin/vesta

This commit is contained in:
Serghey Rodin 2016-08-30 14:49:17 +03:00
commit 4f3b058aba
29 changed files with 175 additions and 62 deletions

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

@ -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

@ -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

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

@ -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

@ -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

@ -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

View file

@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Internal variables # Internal variables
HOMEDIR='/home' HOMEDIR='/home'
BACKUP='/backup' BACKUP='/backup'
@ -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
} }
@ -588,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
@ -611,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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -10,6 +10,7 @@ export DEBIAN_FRONTEND=noninteractive
RHOST='apt.vestacp.com' RHOST='apt.vestacp.com'
CHOST='c.vestacp.com' CHOST='c.vestacp.com'
VERSION='debian' VERSION='debian'
VESTA='/usr/local/vesta'
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9]) memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
arch=$(uname -i) arch=$(uname -i)
os='debian' os='debian'
@ -28,7 +29,7 @@ if [ "$release" -eq 8 ]; then
mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
bsdmainutils cron vesta vesta-nginx vesta-php" bsdmainutils cron vesta vesta-nginx vesta-php expect"
else else
software="nginx apache2 apache2-utils apache2.2-common software="nginx apache2 apache2-utils apache2.2-common
apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
@ -40,7 +41,7 @@ else
mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
bsdmainutils cron vesta vesta-nginx vesta-php" bsdmainutils cron vesta vesta-nginx vesta-php expect"
fi fi
# Defining help function # Defining help function
@ -506,10 +507,10 @@ mv -f /root/.my.cnf $vst_backups/mysql > /dev/null 2>&1
# Backup vesta # Backup vesta
service vesta stop > /dev/null 2>&1 service vesta stop > /dev/null 2>&1
cp -r /usr/local/vesta/* $vst_backups/vesta > /dev/null 2>&1 cp -r $VESTA/* $vst_backups/vesta > /dev/null 2>&1
apt-get -y remove vesta vesta-nginx vesta-php > /dev/null 2>&1 apt-get -y remove vesta vesta-nginx vesta-php > /dev/null 2>&1
apt-get -y purge vesta vesta-nginx vesta-php > /dev/null 2>&1 apt-get -y purge vesta vesta-nginx vesta-php > /dev/null 2>&1
rm -rf /usr/local/vesta > /dev/null 2>&1 rm -rf $VESTA > /dev/null 2>&1
#----------------------------------------------------------# #----------------------------------------------------------#
@ -641,10 +642,10 @@ wget $vestacp/sudo/admin -O /etc/sudoers.d/admin
chmod 440 /etc/sudoers.d/admin chmod 440 /etc/sudoers.d/admin
# Configuring system env # Configuring system env
echo "export VESTA='/usr/local/vesta'" > /etc/profile.d/vesta.sh echo "export VESTA='$VESTA'" > /etc/profile.d/vesta.sh
chmod 755 /etc/profile.d/vesta.sh chmod 755 /etc/profile.d/vesta.sh
source /etc/profile.d/vesta.sh source /etc/profile.d/vesta.sh
echo 'PATH=$PATH:/usr/local/vesta/bin' >> /root/.bash_profile echo 'PATH=$PATH:'$VESTA'/bin' >> /root/.bash_profile
echo 'export PATH' >> /root/.bash_profile echo 'export PATH' >> /root/.bash_profile
source /root/.bash_profile source /root/.bash_profile
@ -663,7 +664,7 @@ chmod 750 $VESTA/conf $VESTA/data/users $VESTA/data/ips $VESTA/log
chmod -R 750 $VESTA/data/queue chmod -R 750 $VESTA/data/queue
chmod 660 $VESTA/log/* chmod 660 $VESTA/log/*
rm -f /var/log/vesta rm -f /var/log/vesta
ln -s /usr/local/vesta/log /var/log/vesta ln -s $VESTA/log /var/log/vesta
chown admin:admin $VESTA/data/sessions chown admin:admin $VESTA/data/sessions
chmod 770 $VESTA/data/sessions chmod 770 $VESTA/data/sessions
@ -1072,6 +1073,7 @@ if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
mysql -e "CREATE DATABASE roundcube" mysql -e "CREATE DATABASE roundcube"
mysql -e "GRANT ALL ON roundcube.* TO roundcube@localhost IDENTIFIED BY '$r'" mysql -e "GRANT ALL ON roundcube.* TO roundcube@localhost IDENTIFIED BY '$r'"
sed -i "s/%password%/$r/g" /etc/roundcube/db.inc.php sed -i "s/%password%/$r/g" /etc/roundcube/db.inc.php
sed -i "s/localhost/$servername/g" /etc/roundcube/plugins/password/config.inc.php
mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
chmod a+r /etc/roundcube/main.inc.php chmod a+r /etc/roundcube/main.inc.php
if [ "$release" -eq 8 ]; then if [ "$release" -eq 8 ]; then
@ -1128,6 +1130,14 @@ check_result $? "can't create admin user"
$VESTA/bin/v-change-user-shell admin bash $VESTA/bin/v-change-user-shell admin bash
$VESTA/bin/v-change-user-language admin $lang $VESTA/bin/v-change-user-language admin $lang
# RoundCube permissions fix
if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
if [ ! -d "/var/log/roundcube" ]; then
mkdir /var/log/roundcube
fi
chown admin:admin /var/log/roundcube
fi
# Configuring system ips # Configuring system ips
$VESTA/bin/v-update-sys-ip $VESTA/bin/v-update-sys-ip
@ -1163,19 +1173,19 @@ $VESTA/bin/v-add-domain admin $servername
check_result $? "can't create $servername domain" check_result $? "can't create $servername domain"
# Adding cron jobs # Adding cron jobs
command='sudo /usr/local/vesta/bin/v-update-sys-queue disk' command="sudo $VESTA/bin/v-update-sys-queue disk"
$VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue traffic' command="sudo $VESTA/bin/v-update-sys-queue traffic"
$VESTA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue webstats' command="sudo $VESTA/bin/v-update-sys-queue webstats"
$VESTA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue backup' command="sudo $VESTA/bin/v-update-sys-queue backup"
$VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-backup-users' command="sudo $VESTA/bin/v-backup-users"
$VESTA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-user-stats' command="sudo $VESTA/bin/v-update-user-stats"
$VESTA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-rrd' command="sudo $VESTA/bin/v-update-sys-rrd"
$VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
service cron restart service cron restart

View file

@ -10,6 +10,7 @@ RHOST='r.vestacp.com'
CHOST='c.vestacp.com' CHOST='c.vestacp.com'
REPO='cmmnt' REPO='cmmnt'
VERSION='rhel' VERSION='rhel'
VESTA='/usr/local/vesta'
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9]) memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
arch=$(uname -i) arch=$(uname -i)
os=$(cut -f 1 -d ' ' /etc/redhat-release) os=$(cut -f 1 -d ' ' /etc/redhat-release)
@ -26,7 +27,7 @@ if [ "$release" -eq 7 ]; then
postgresql postgresql-server postgresql-contrib phpPgAdmin e2fsprogs postgresql postgresql-server postgresql-contrib phpPgAdmin e2fsprogs
openssh-clients ImageMagick curl mc screen ftp zip unzip flex sqlite pcre openssh-clients ImageMagick curl mc screen ftp zip unzip flex sqlite pcre
sudo bc jwhois mailx lsof tar telnet rrdtool net-tools ntp GeoIP freetype sudo bc jwhois mailx lsof tar telnet rrdtool net-tools ntp GeoIP freetype
fail2ban rsyslog iptables-services which vesta vesta-nginx vesta-php" fail2ban rsyslog iptables-services which vesta vesta-nginx vesta-php expect"
else else
software="nginx httpd mod_ssl mod_ruid2 mod_fcgid mod_extract_forwarded software="nginx httpd mod_ssl mod_ruid2 mod_fcgid mod_extract_forwarded
php php-common php-cli php-bcmath php-gd php-imap php-mbstring php-mcrypt php php-common php-cli php-bcmath php-gd php-imap php-mbstring php-mcrypt
@ -36,7 +37,7 @@ else
postgresql-server postgresql-contrib phpPgAdmin e2fsprogs openssh-clients postgresql-server postgresql-contrib phpPgAdmin e2fsprogs openssh-clients
ImageMagick curl mc screen ftp zip unzip flex sqlite pcre sudo bc jwhois ImageMagick curl mc screen ftp zip unzip flex sqlite pcre sudo bc jwhois
mailx lsof tar telnet rrdtool net-tools ntp GeoIP freetype fail2ban mailx lsof tar telnet rrdtool net-tools ntp GeoIP freetype fail2ban
which vesta vesta-nginx vesta-php" which vesta vesta-nginx vesta-php expect"
fi fi
# Defining help function # Defining help function
@ -528,8 +529,8 @@ mv /var/lib/pgsql/data $vst_backups/postgresql/ >/dev/null 2>&1
# Backing up Vesta configuration and data # Backing up Vesta configuration and data
service vesta stop > /dev/null 2>&1 service vesta stop > /dev/null 2>&1
mv /usr/local/vesta/data/* $vst_backups/vesta > /dev/null 2>&1 mv $VESTA/data/* $vst_backups/vesta > /dev/null 2>&1
mv /usr/local/vesta/conf/* $vst_backups/vesta > /dev/null 2>&1 mv $VESTA/conf/* $vst_backups/vesta > /dev/null 2>&1
#----------------------------------------------------------# #----------------------------------------------------------#
@ -678,10 +679,10 @@ wget $vestacp/sudo/admin -O /etc/sudoers.d/admin
chmod 440 /etc/sudoers.d/admin chmod 440 /etc/sudoers.d/admin
# Configuring system env # Configuring system env
echo "export VESTA='/usr/local/vesta'" > /etc/profile.d/vesta.sh echo "export VESTA='$VESTA'" > /etc/profile.d/vesta.sh
chmod 755 /etc/profile.d/vesta.sh chmod 755 /etc/profile.d/vesta.sh
source /etc/profile.d/vesta.sh source /etc/profile.d/vesta.sh
echo 'PATH=$PATH:/usr/local/vesta/bin' >> /root/.bash_profile echo 'PATH=$PATH:'$VESTA'/bin' >> /root/.bash_profile
echo 'export PATH' >> /root/.bash_profile echo 'export PATH' >> /root/.bash_profile
source /root/.bash_profile source /root/.bash_profile
@ -700,7 +701,7 @@ chmod 750 $VESTA/conf $VESTA/data/users $VESTA/data/ips $VESTA/log
chmod -R 750 $VESTA/data/queue chmod -R 750 $VESTA/data/queue
chmod 660 $VESTA/log/* chmod 660 $VESTA/log/*
rm -f /var/log/vesta rm -f /var/log/vesta
ln -s /usr/local/vesta/log /var/log/vesta ln -s $VESTA/log /var/log/vesta
chown admin:admin $VESTA/data/sessions chown admin:admin $VESTA/data/sessions
chmod 770 $VESTA/data/sessions chmod 770 $VESTA/data/sessions
@ -1234,20 +1235,19 @@ fi
$VESTA/bin/v-add-domain admin $servername $VESTA/bin/v-add-domain admin $servername
check_result $? "can't create $servername domain" check_result $? "can't create $servername domain"
# Adding cron jobs command="sudo $VESTA/bin/v-update-sys-queue disk"
command='sudo /usr/local/vesta/bin/v-update-sys-queue disk'
$VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue traffic' command="sudo $VESTA/bin/v-update-sys-queue traffic"
$VESTA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue webstats' command="sudo $VESTA/bin/v-update-sys-queue webstats"
$VESTA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue backup' command="sudo $VESTA/bin/v-update-sys-queue backup"
$VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-backup-users' command="sudo $VESTA/bin/v-backup-users"
$VESTA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-user-stats' command="sudo $VESTA/bin/v-update-user-stats"
$VESTA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-rrd' command="sudo $VESTA/bin/v-update-sys-rrd"
$VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
service crond restart service crond restart

View file

@ -10,6 +10,7 @@ export DEBIAN_FRONTEND=noninteractive
RHOST='apt.vestacp.com' RHOST='apt.vestacp.com'
CHOST='c.vestacp.com' CHOST='c.vestacp.com'
VERSION='ubuntu' VERSION='ubuntu'
VESTA='/usr/local/vesta'
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9]) memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
arch=$(uname -i) arch=$(uname -i)
os='ubuntu' os='ubuntu'
@ -26,7 +27,7 @@ software="nginx apache2 apache2-utils apache2.2-common
mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
bsdmainutils cron vesta vesta-nginx vesta-php" bsdmainutils cron vesta vesta-nginx vesta-php expect"
# Defining help function # Defining help function
help() { help() {
@ -491,10 +492,10 @@ mv -f /root/.my.cnf $vst_backups/mysql > /dev/null 2>&1
# Backup vesta # Backup vesta
service vesta stop > /dev/null 2>&1 service vesta stop > /dev/null 2>&1
cp -r /usr/local/vesta/* $vst_backups/vesta > /dev/null 2>&1 cp -r $VESTA/* $vst_backups/vesta > /dev/null 2>&1
apt-get -y remove vesta vesta-nginx vesta-php > /dev/null 2>&1 apt-get -y remove vesta vesta-nginx vesta-php > /dev/null 2>&1
apt-get -y purge vesta vesta-nginx vesta-php > /dev/null 2>&1 apt-get -y purge vesta vesta-nginx vesta-php > /dev/null 2>&1
rm -rf /usr/local/vesta > /dev/null 2>&1 rm -rf $VESTA > /dev/null 2>&1
#----------------------------------------------------------# #----------------------------------------------------------#
@ -631,10 +632,10 @@ wget $vestacp/sudo/admin -O /etc/sudoers.d/admin
chmod 440 /etc/sudoers.d/admin chmod 440 /etc/sudoers.d/admin
# Configuring system env # Configuring system env
echo "export VESTA='/usr/local/vesta'" > /etc/profile.d/vesta.sh echo "export VESTA='$VESTA'" > /etc/profile.d/vesta.sh
chmod 755 /etc/profile.d/vesta.sh chmod 755 /etc/profile.d/vesta.sh
source /etc/profile.d/vesta.sh source /etc/profile.d/vesta.sh
echo 'PATH=$PATH:/usr/local/vesta/bin' >> /root/.bash_profile echo 'PATH=$PATH:'$VESTA'/bin' >> /root/.bash_profile
echo 'export PATH' >> /root/.bash_profile echo 'export PATH' >> /root/.bash_profile
source /root/.bash_profile source /root/.bash_profile
@ -653,7 +654,7 @@ chmod 750 $VESTA/conf $VESTA/data/users $VESTA/data/ips $VESTA/log
chmod -R 750 $VESTA/data/queue chmod -R 750 $VESTA/data/queue
chmod 660 $VESTA/log/* chmod 660 $VESTA/log/*
rm -f /var/log/vesta rm -f /var/log/vesta
ln -s /usr/local/vesta/log /var/log/vesta ln -s $VESTA/log /var/log/vesta
chown admin:admin $VESTA/data/sessions chown admin:admin $VESTA/data/sessions
chmod 770 $VESTA/data/sessions chmod 770 $VESTA/data/sessions
@ -1150,19 +1151,19 @@ $VESTA/bin/v-add-domain admin $servername
check_result $? "can't create $servername domain" check_result $? "can't create $servername domain"
# Adding cron jobs # Adding cron jobs
command='sudo /usr/local/vesta/bin/v-update-sys-queue disk' command="sudo $VESTA/bin/v-update-sys-queue disk"
$VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue traffic' command="sudo $VESTA/bin/v-update-sys-queue traffic"
$VESTA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue webstats' command="sudo $VESTA/bin/v-update-sys-queue webstats"
$VESTA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-queue backup' command="sudo $VESTA/bin/v-update-sys-queue backup"
$VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-backup-users' command="sudo $VESTA/bin/v-backup-users"
$VESTA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-user-stats' command="sudo $VESTA/bin/v-update-user-stats"
$VESTA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command"
command='sudo /usr/local/vesta/bin/v-update-sys-rrd' command="sudo $VESTA/bin/v-update-sys-rrd"
$VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command" $VESTA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
service cron restart service cron restart

View file

@ -80,6 +80,7 @@
<option value="IPSECKEY" <?php if ($v_type == 'IPSECKEY') echo selected; ?>>IPSECKEY</option> <option value="IPSECKEY" <?php if ($v_type == 'IPSECKEY') echo selected; ?>>IPSECKEY</option>
<option value="PTR" <?php if ($v_type == 'PTR') echo selected; ?>>PTR</option> <option value="PTR" <?php if ($v_type == 'PTR') echo selected; ?>>PTR</option>
<option value="SPF" <?php if ($v_type == 'SPF') echo selected; ?>>SPF</option> <option value="SPF" <?php if ($v_type == 'SPF') echo selected; ?>>SPF</option>
<option value="TLSA" <?php if ($v_type == 'TLSA') echo selected; ?>>TLSA</option>
</select> </select>
</td> </td>
</tr> </tr>

View file

@ -132,6 +132,7 @@
<td class="mail-infoblock-td"> <td class="mail-infoblock-td">
<div class="mail-infoblock"> <div class="mail-infoblock">
<table> <table>
<?php $uname_arr=posix_uname(); $hostname=$uname_arr['nodename']; ?>
<tr> <tr>
<td><?=__('Username')?>:</td> <td><?=__('Username')?>:</td>
<td><span id="v_account">william.cage</span>@<?=htmlentities($v_domain)?></td> <td><span id="v_account">william.cage</span>@<?=htmlentities($v_domain)?></td>
@ -142,7 +143,7 @@
</tr> </tr>
<tr> <tr>
<td><?=__('IMAP hostname')?>:</td> <td><?=__('IMAP hostname')?>:</td>
<td><?=htmlentities($v_domain)?></td> <td><?=$hostname?></td>
</tr> </tr>
<tr> <tr>
<td><?=__('IMAP port')?>:</td> <td><?=__('IMAP port')?>:</td>
@ -158,7 +159,7 @@
</tr> </tr>
<tr> <tr>
<td><?=__('SMTP hostname')?></td> <td><?=__('SMTP hostname')?></td>
<td><?=htmlentities($v_domain)?></td> <td><?=$hostname?></td>
</tr> </tr>
<tr> <tr>
<td><?=__('SMTP port')?>:</td> <td><?=__('SMTP port')?>:</td>
@ -179,4 +180,4 @@
</tr> </tr>
</table> </table>
</form> </form>
</div> </div>