mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
commit
caec3b555e
10 changed files with 183 additions and 184 deletions
|
@ -34,48 +34,72 @@ is_ip_valid "$ip"
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Changing nat ip
|
# Updating IP
|
||||||
if [ -z "$(grep NAT= $VESTA/data/ips/$ip)" ]; then
|
if [ -z "$(grep NAT= $VESTA/data/ips/$ip)" ]; then
|
||||||
sed -i "s/^TIME/NAT='$nat_ip'\nTIME/g" $VESTA/data/ips/$ip
|
sed -i "s/^TIME/NAT='$nat_ip'\nTIME/g" $VESTA/data/ips/$ip
|
||||||
|
old=''
|
||||||
|
new=$nat_ip
|
||||||
else
|
else
|
||||||
update_ip_value '$NAT' "$nat_ip"
|
old=$(get_ip_value '$NAT')
|
||||||
fi
|
new=$nat_ip
|
||||||
|
sed -i "s/NAT=.*/NAT='$new'/" $VESTA/data/ips/$ip
|
||||||
# Check ftp system
|
if [ -z "$nat_ip" ]; then
|
||||||
if [ "$FTP_SYSTEM" = 'vsftpd' ]; then
|
new=$ip
|
||||||
|
|
||||||
# Find configuration
|
|
||||||
if [ -e '/etc/vsftpd/vsftpd.conf' ]; then
|
|
||||||
conf='/etc/vsftpd/vsftpd.conf'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e '/etc/vsftpd.conf' ]; then
|
|
||||||
conf='/etc/vsftpd.conf'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update config
|
|
||||||
if [ -z "$(grep pasv_address $conf)" ]; then
|
|
||||||
if [ ! -z "$nat_ip" ]; then
|
|
||||||
echo "pasv_address=$nat_ip" >> $conf
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ ! -z "$nat_ip" ]; then
|
|
||||||
sed -i "s/pasv_address=.*/pasv_address='$nat_ip'/g" $conf
|
|
||||||
else
|
|
||||||
sed -i "/pasv_address/d" $conf
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Updating WEB configs
|
||||||
|
if [ ! -z "$old" ] && [ ! -z "$WEB_SYSTEM" ]; then
|
||||||
|
sed -i "s/$old/$new/" $VESTA/data/users/*/web.conf
|
||||||
|
for user in $(ls $VESTA/data/users/); do
|
||||||
|
$BIN/v-rebuild-web-domains $user no
|
||||||
|
done
|
||||||
|
$BIN/v-restart-dns $restart
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Updating DNS configs
|
||||||
|
if [ ! -z "$old" ] && [ ! -z "$DNS_SYSTEM" ]; then
|
||||||
|
sed -i "s/$old/$new/" $VESTA/data/users/*/dns.conf
|
||||||
|
sed -i "s/$old/$new/" $VESTA/data/users/*/dns/*.conf
|
||||||
|
for user in $(ls $VESTA/data/users/); do
|
||||||
|
$BIN/v-rebuild-dns-domains $user no
|
||||||
|
done
|
||||||
|
$BIN/v-restart-dns $restart
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Updating FTP
|
||||||
|
if [ ! -z "$old" ] && [ ! -z "$FTP_SYSTEM" ]; then
|
||||||
|
conf=$(find /etc -name $FTP_SYSTEM.conf)
|
||||||
|
if [ -e "$conf" ]; then
|
||||||
|
sed -i "s/$old/$new/g" $conf
|
||||||
|
if [ "$FTP_SYSTEM" = 'vsftpd' ]; then
|
||||||
|
check_pasv=$(grep pasv_address $conf)
|
||||||
|
if [ -z "$check_pasv" ] && [ ! -z "$nat_ip" ]; then
|
||||||
|
echo "pasv_address=$nat_ip" >> $conf
|
||||||
|
fi
|
||||||
|
if [ ! -z "$check_pasv" ] && [ -z "$nat_ip" ]; then
|
||||||
|
sed -i "/pasv_address/d" $conf
|
||||||
|
fi
|
||||||
|
if [ ! -z "$check_pasv" ] && [ ! -z "$nat_ip" ]; then
|
||||||
|
sed -i "s/pasv_address=.*/pasv_address='$nat_ip'/g" $conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
$BIN/v-restart-ftp $restart
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Updating firewall
|
||||||
|
if [ ! -z "$old" ] && [ ! -z "$FIREWALL_SYSTEM" ]; then
|
||||||
|
sed -i "s/$old/$new/g" $VESTA/data/firewall/*.conf
|
||||||
|
$BIN/v-update-firewall
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Restart ftp server
|
|
||||||
$BIN/v-restart-ftp $restart
|
|
||||||
check_result $? "FTP restart failed" >/dev/null
|
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_history "changed associated nat address on $ip to $nat_ip" '' 'admin'
|
log_history "changed associated nat address on $ip to $nat_ip" '' 'admin'
|
||||||
log_event "$OK" "$ARGUMENTS"
|
log_event "$OK" "$ARGUMENTS"
|
||||||
|
|
|
@ -49,7 +49,7 @@ is_ip_valid "$ip" "$user"
|
||||||
# Preparing variables for vhost replace
|
# Preparing variables for vhost replace
|
||||||
get_domain_values 'web'
|
get_domain_values 'web'
|
||||||
old=$(get_real_ip $IP)
|
old=$(get_real_ip $IP)
|
||||||
new=$ip
|
new=$(get_real_ip $ip)
|
||||||
|
|
||||||
# Replacing vhost
|
# Replacing vhost
|
||||||
replace_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
replace_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# info: update system ip
|
# info: update system ip
|
||||||
# options: [USER] [IP_STATUS]
|
# options: [NONE]
|
||||||
#
|
#
|
||||||
# The function scans configured ip in the system and register them with vesta
|
# The function scans configured ip in the system and register them with vesta
|
||||||
# internal database. This call is intended for use on vps servers, where ip is
|
# internal database. This call is intended for use on vps servers, where ip is
|
||||||
|
@ -11,14 +11,11 @@
|
||||||
# Variable&Function #
|
# Variable&Function #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Argument definition
|
# Importing system variables
|
||||||
user=${1-admin}
|
source /etc/profile
|
||||||
ip_status=${2-shared}
|
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
source /etc/profile.d/vesta.sh
|
|
||||||
source $VESTA/func/main.sh
|
source $VESTA/func/main.sh
|
||||||
source $VESTA/func/ip.sh
|
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,87 +23,84 @@ source $VESTA/conf/vesta.conf
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
check_args '0' "$#" '[USER] [IP_STATUS]'
|
|
||||||
is_format_valid 'user' 'ip_status'
|
|
||||||
is_object_valid 'user' 'USER' "$user" "$user"
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Get list of ip addresses
|
# Listing system ip addresses
|
||||||
ip_list=$(/sbin/ip addr|grep 'inet '|grep global|awk '{print $2}')
|
ips=$(/sbin/ip addr |grep 'inet ' |grep global |awk '{print $2}' |cut -f1 -d/)
|
||||||
ip_list=$(echo "$ip_list"|cut -f 1 -d /)
|
v_ips=$(ls $VESTA/data/ips/)
|
||||||
ip_num=$(echo "$ip_list" | wc -l)
|
ip_num=$(echo "$ips" |wc -l)
|
||||||
|
v_ip_num=$(echo "$v_ips" |wc -l)
|
||||||
|
|
||||||
# WorkAround for DHCP IP address
|
# Checking primary IP change
|
||||||
vst_ip_list=$(ls $VESTA/data/ips/)
|
if [[ "$ip_num" -eq '1' ]] && [[ "$v_ip_num" -eq 1 ]]; then
|
||||||
vst_ip_num=$(echo "$vst_ip_list" | wc -l)
|
if [ "$ips" != "$v_ips" ]; then
|
||||||
|
new=$ips
|
||||||
if [ ! -z "$vst_ip_list" ] && [ "$vst_ip_num" -eq '1' ]; then
|
old=$v_ips
|
||||||
if [ $ip_num -eq 1 ] && [ "$ip_list" != "$vst_ip_list" ]; then
|
|
||||||
new=$ip_list
|
|
||||||
old=$vst_ip_list
|
|
||||||
mv $VESTA/data/ips/$old $VESTA/data/ips/$new
|
|
||||||
if [ ! -z "$PROXY_SYSTEM" ]; then
|
|
||||||
mv /etc/$PROXY_SYSTEM/conf.d/$old.conf \
|
|
||||||
/etc/$PROXY_SYSTEM/conf.d/$new.conf
|
|
||||||
sed -i "s/$old/$new/g" /etc/$PROXY_SYSTEM/conf.d/$new.conf
|
|
||||||
fi
|
|
||||||
if [ ! -z "$WEB_SYSTEM" ]; then
|
|
||||||
mv /etc/$WEB_SYSTEM/conf.d/$old.conf \
|
|
||||||
/etc/$WEB_SYSTEM/conf.d/$new.conf
|
|
||||||
sed -i "s/$old/$new/g" /etc/$WEB_SYSTEM/conf.d/$new.conf
|
|
||||||
sed -i "s/$old/$new/g" $VESTA/data/users/*/web.conf
|
|
||||||
|
|
||||||
# Rebuild web domains
|
|
||||||
for user in $(ls $VESTA/data/users/); do
|
|
||||||
$BIN/v-rebuild-web-domains $user no
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
if [ ! -z "$FTP_SYSTEM" ];then
|
|
||||||
ftpd_conf_file=$(find /etc/ -maxdepth 2 -name $FTP_SYSTEM.conf)
|
|
||||||
sed -i "s/$old/$new/g" $ftpd_conf_file
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Restarting web server
|
|
||||||
$BIN/v-restart-web
|
|
||||||
|
|
||||||
# Restarting ftp server
|
|
||||||
$BIN/v-restart-ftp
|
|
||||||
|
|
||||||
# Restarting proxy server
|
|
||||||
if [ ! -z "$PROXY_SYSTEM" ]; then
|
|
||||||
$BIN/v-restart-proxy
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Restarting firewall
|
|
||||||
if [ ! -z "$FIREWALL_SYSTEM" ]; then
|
|
||||||
$BIN/v-update-firewall
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$DNS_SYSTEM" ]; then
|
|
||||||
# Rebuild dns domains
|
|
||||||
for user in $(ls $VESTA/data/users/); do
|
|
||||||
sed -i "s/$old/$new/g" $VESTA/data/users/$user/dns.conf
|
|
||||||
sed -i "s/$old/$new/g" $VESTA/data/users/$user/dns/*.conf
|
|
||||||
$BIN/v-rebuild-dns-domains $user no
|
|
||||||
done
|
|
||||||
$BIN/v-restart-dns
|
|
||||||
check_result $? "dns restart failed" >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# No further comparation is needed
|
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compare ips
|
# Updating configs
|
||||||
for ip in $ip_list; do
|
if [ ! -z "$new" ]; then
|
||||||
|
mv $VESTA/data/ips/$old $VESTA/data/ips/$new
|
||||||
|
|
||||||
|
# Updating PROXY
|
||||||
|
if [ ! -z "$PROXY_SYSTEM" ]; then
|
||||||
|
cd /etc/$PROXY_SYSTEM/conf.d
|
||||||
|
if [ -e "$old.conf" ]; then
|
||||||
|
mv $old.conf $new.conf
|
||||||
|
sed -i "s/$old/$new/g" $new.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Updating WEB
|
||||||
|
if [ ! -z "$WEB_SYSTEM" ]; then
|
||||||
|
cd /etc/$WEB_SYSTEM/conf.d
|
||||||
|
if [ -e "$old.conf" ]; then
|
||||||
|
mv $old.conf $new.conf
|
||||||
|
sed -i "s/$old/$new/g" $new.conf
|
||||||
|
fi
|
||||||
|
sed -i "s/$old/$new/g" $VESTA/data/users/*/web.conf
|
||||||
|
for user in $(ls $VESTA/data/users/); do
|
||||||
|
$BIN/v-rebuild-web-domains $user no
|
||||||
|
done
|
||||||
|
$BIN/v-restart-proxy
|
||||||
|
$BIN/v-restart-web
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Updating DNS
|
||||||
|
if [ ! -z "$DNS_SYSTEM" ]; then
|
||||||
|
sed -i "s/$old/$new/g" $VESTA/data/users/*/dns.conf
|
||||||
|
sed -i "s/$old/$new/g" $VESTA/data/users/*/dns/*.conf
|
||||||
|
for user in $(ls $VESTA/data/users/); do
|
||||||
|
$BIN/v-rebuild-dns-domains $user no
|
||||||
|
done
|
||||||
|
$BIN/v-restart-dns
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Updating FTP
|
||||||
|
if [ ! -z "$FTP_SYSTEM" ] && [ "$FTP_SYSTEM" = 'vsftpd' ]; then
|
||||||
|
conf=$(find /etc/ -maxdepth 2 -name $FTP_SYSTEM.conf)
|
||||||
|
if [ ! -z "$conf" ]; then
|
||||||
|
sed -i "s/$old/$new/g" $conf
|
||||||
|
$BIN/v-restart-ftp
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Updating firewall
|
||||||
|
if [ ! -z "$FIREWALL_SYSTEM" ]; then
|
||||||
|
sed -i "s/$old/$new/g" $VESTA/data/firewall/*.conf
|
||||||
|
$BIN/v-update-firewall
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Adding system IP
|
||||||
|
for ip in $ips; do
|
||||||
check_ifconfig=$(/sbin/ifconfig |grep "$ip")
|
check_ifconfig=$(/sbin/ifconfig |grep "$ip")
|
||||||
if [ ! -e "$VESTA/data/ips/$ip" ] && [ ! -z "$check_ifconfig" ]; then
|
if [ ! -e "$VESTA/data/ips/$ip" ] && [ ! -z "$check_ifconfig" ]; then
|
||||||
interface=$(/sbin/ip addr |grep $ip |awk '{print $NF}'|uniq)
|
interface=$(/sbin/ip addr |grep $ip |awk '{print $NF}' |uniq)
|
||||||
interface=$(echo "$interface" |cut -f 1 -d : |head -n 1)
|
interface=$(echo "$interface" |cut -f 1 -d : |head -n 1)
|
||||||
netmask=$(/sbin/ip addr |grep $ip |cut -f 2 -d / |cut -f 1 -d \ )
|
netmask=$(/sbin/ip addr |grep $ip |cut -f 2 -d / |cut -f 1 -d \ )
|
||||||
netmask=$(convert_cidr $netmask)
|
netmask=$(convert_cidr $netmask)
|
||||||
|
@ -114,12 +108,11 @@ for ip in $ip_list; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Checking NAT
|
# Updating NAT
|
||||||
pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
|
pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
|
||||||
if [ ! -z "$pub_ip" ] && [ ! -e "$VESTA/data/ips/$pub_ip" ]; then
|
if [ ! -e "$VESTA/data/ips/$pub_ip" ]; then
|
||||||
check_nat=$(grep -R "$pub_ip" $VESTA/data/ips/)
|
if [ -z "$(grep -R "$pub_ip" $VESTA/data/ips/)" ]; then
|
||||||
if [ -z "$check_nat" ]; then
|
ip=$(ls -t $VESTA/data/ips/ |head -n1)
|
||||||
ip=$(ls -t $VESTA/data/ips/|head -n1)
|
|
||||||
$BIN/v-change-sys-ip-nat $ip $pub_ip
|
$BIN/v-change-sys-ip-nat $ip $pub_ip
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author Serghey Rodin <skid@vestacp.com>
|
* @author Serghey Rodin <skid@vestacp.com>
|
||||||
*/
|
*/
|
||||||
|
class rcube_vesta_password
|
||||||
function password_save($curpass, $passwd)
|
{
|
||||||
|
function save($curpass, $passwd)
|
||||||
{
|
{
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$vesta_host = $rcmail->config->get('password_vesta_host');
|
$vesta_host = $rcmail->config->get('password_vesta_host');
|
||||||
|
@ -69,3 +70,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -6,8 +6,8 @@
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author Serghey Rodin <skid@vestacp.com>
|
* @author Serghey Rodin <skid@vestacp.com>
|
||||||
*/
|
*/
|
||||||
|
class rcube_vesta_password {
|
||||||
function password_save($curpass, $passwd)
|
function save($curpass, $passwd)
|
||||||
{
|
{
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$vesta_host = $rcmail->config->get('password_vesta_host');
|
$vesta_host = $rcmail->config->get('password_vesta_host');
|
||||||
|
@ -69,3 +69,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -6,8 +6,9 @@
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author Serghey Rodin <skid@vestacp.com>
|
* @author Serghey Rodin <skid@vestacp.com>
|
||||||
*/
|
*/
|
||||||
|
class rcube_vesta_password
|
||||||
function password_save($curpass, $passwd)
|
{
|
||||||
|
function save($curpass, $passwd)
|
||||||
{
|
{
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$vesta_host = $rcmail->config->get('password_vesta_host');
|
$vesta_host = $rcmail->config->get('password_vesta_host');
|
||||||
|
@ -69,3 +70,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -6,8 +6,8 @@
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author Serghey Rodin <skid@vestacp.com>
|
* @author Serghey Rodin <skid@vestacp.com>
|
||||||
*/
|
*/
|
||||||
|
class rcube_vesta_password {
|
||||||
function password_save($curpass, $passwd)
|
function save($curpass, $passwd)
|
||||||
{
|
{
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$vesta_host = $rcmail->config->get('password_vesta_host');
|
$vesta_host = $rcmail->config->get('password_vesta_host');
|
||||||
|
@ -69,3 +69,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author Serghey Rodin <skid@vestacp.com>
|
* @author Serghey Rodin <skid@vestacp.com>
|
||||||
*/
|
*/
|
||||||
|
class rcube_vesta_password {
|
||||||
function password_save($curpass, $passwd)
|
function save($curpass, $passwd)
|
||||||
{
|
{
|
||||||
$rcmail = rcmail::get_instance();
|
$rcmail = rcmail::get_instance();
|
||||||
$vesta_host = $rcmail->config->get('password_vesta_host');
|
$vesta_host = $rcmail->config->get('password_vesta_host');
|
||||||
|
@ -69,3 +69,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -18,45 +18,24 @@ release="$(lsb_release -s -r)"
|
||||||
codename="$(lsb_release -s -c)"
|
codename="$(lsb_release -s -c)"
|
||||||
vestacp="$VESTA/install/$VERSION/$release"
|
vestacp="$VESTA/install/$VERSION/$release"
|
||||||
|
|
||||||
if [ "$release" = '16.04' ] || [ "$release" = '18.04' ]; then
|
# Defining software pack for all distros
|
||||||
software="nginx apache2 apache2-utils apache2.2-common
|
software="apache2 apache2.2-common apache2-suexec-custom apache2-utils
|
||||||
apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
|
apparmor-utils awstats bc bind9 bsdmainutils bsdutils clamav-daemon
|
||||||
libapache2-mod-fcgid libapache2-mod-php php php-common php-cgi
|
cron curl dnsutils dovecot-imapd dovecot-pop3d e2fslibs e2fsprogs exim4
|
||||||
php-mysql php-curl php-fpm php-pgsql awstats webalizer vsftpd
|
exim4-daemon-heavy expect fail2ban flex ftp git idn imagemagick
|
||||||
proftpd-basic bind9 exim4 exim4-daemon-heavy clamav-daemon
|
libapache2-mod-fcgid libapache2-mod-php libapache2-mod-rpaf
|
||||||
spamassassin dovecot-imapd dovecot-pop3d roundcube-core
|
libapache2-mod-ruid2 lsof mc mysql-client mysql-common mysql-server nginx
|
||||||
roundcube-mysql roundcube-plugins mysql-server mysql-common
|
ntpdate php-cgi php-common php-curl php-fpm phpmyadmin php-mysql
|
||||||
mysql-client postgresql postgresql-contrib phppgadmin phpmyadmin mc
|
phppgadmin php-pgsql postgresql postgresql-contrib proftpd-basic quota
|
||||||
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
|
roundcube-core roundcube-mysql roundcube-plugins rrdtool rssh spamassassin
|
||||||
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
|
sudo vesta vesta-ioncube vesta-nginx vesta-php vesta-softaculous
|
||||||
bsdmainutils cron vesta vesta-nginx vesta-php expect vim-common
|
vim-common vsftpd webalizer whois zip"
|
||||||
vesta-ioncube vesta-softaculous apparmor-utils"
|
|
||||||
elif [ "$release" = '16.10' ] || [ "$release" = '17.10' ]; then
|
# Fix for old releases
|
||||||
software="nginx apache2 apache2-utils apache2.2-common
|
if [[ ${release:0:2} -lt 16 ]]; then
|
||||||
apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
|
software=$(echo "$software" |sed -e "s/php /php5 /")
|
||||||
libapache2-mod-fcgid libapache2-mod-php7.0 php7.0 php7.0-common
|
software=$(echo "$software" |sed -e "s/php-/php5-/")
|
||||||
php7.0-cgi php7.0-mysql php7.0-curl php7.0-fpm php7.0-pgsql awstats
|
software=$(echo "$software" |sed -e "s/mod-php/mod-php5/")
|
||||||
webalizer vsftpd proftpd-basic bind9 exim4 exim4-daemon-heavy
|
|
||||||
clamav-daemon spamassassin dovecot-imapd dovecot-pop3d roundcube-core
|
|
||||||
roundcube-mysql roundcube-plugins mysql-server mysql-common
|
|
||||||
mysql-client postgresql postgresql-contrib phppgadmin phpmyadmin mc
|
|
||||||
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
|
|
||||||
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
|
|
||||||
bsdmainutils cron vesta vesta-nginx vesta-php expect vim-common
|
|
||||||
vesta-ioncube vesta-softaculous apparmor-utils"
|
|
||||||
else
|
|
||||||
software="nginx apache2 apache2-utils apache2.2-common
|
|
||||||
apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
|
|
||||||
libapache2-mod-fcgid libapache2-mod-php5 php5 php5-common php5-cgi
|
|
||||||
php5-mysql php5-curl php5-fpm php5-pgsql awstats webalizer vsftpd
|
|
||||||
proftpd-basic bind9 exim4 exim4-daemon-heavy clamav-daemon
|
|
||||||
spamassassin dovecot-imapd dovecot-pop3d roundcube-core
|
|
||||||
roundcube-mysql roundcube-plugins mysql-server mysql-common
|
|
||||||
mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc
|
|
||||||
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
|
|
||||||
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
|
|
||||||
bsdmainutils cron vesta vesta-nginx vesta-php expect vim-common
|
|
||||||
vesta-ioncube vesta-softaculous"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Defining help function
|
# Defining help function
|
||||||
|
@ -516,7 +495,7 @@ cp -r /etc/bind/* $vst_backups/bind > /dev/null 2>&1
|
||||||
service vsftpd stop > /dev/null 2>&1
|
service vsftpd stop > /dev/null 2>&1
|
||||||
cp /etc/vsftpd.conf $vst_backups/vsftpd > /dev/null 2>&1
|
cp /etc/vsftpd.conf $vst_backups/vsftpd > /dev/null 2>&1
|
||||||
|
|
||||||
# Backing up ProFTPD configuration
|
# Backup ProFTPD configuration
|
||||||
service proftpd stop > /dev/null 2>&1
|
service proftpd stop > /dev/null 2>&1
|
||||||
cp /etc/proftpd.conf $vst_backups/proftpd > /dev/null 2>&1
|
cp /etc/proftpd.conf $vst_backups/proftpd > /dev/null 2>&1
|
||||||
|
|
||||||
|
@ -644,18 +623,18 @@ fi
|
||||||
# Install packages #
|
# Install packages #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Update system packages
|
# Updating system
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
# Disable daemon autostart /usr/share/doc/sysv-rc/README.policy-rc.d.gz
|
# Disabling daemon autostart /usr/share/doc/sysv-rc/README.policy-rc.d.gz
|
||||||
echo -e '#!/bin/sh \nexit 101' > /usr/sbin/policy-rc.d
|
#echo -e '#!/bin/sh \nexit 101' > /usr/sbin/policy-rc.d
|
||||||
chmod a+x /usr/sbin/policy-rc.d
|
#chmod a+x /usr/sbin/policy-rc.d
|
||||||
|
|
||||||
# Install apt packages
|
# Installing apt packages
|
||||||
apt-get -y install $software
|
apt-get -y install $software
|
||||||
check_result $? "apt-get install failed"
|
check_result $? "apt-get install failed"
|
||||||
|
|
||||||
# Restore policy
|
# Restoring policy
|
||||||
rm -f /usr/sbin/policy-rc.d
|
rm -f /usr/sbin/policy-rc.d
|
||||||
|
|
||||||
|
|
||||||
|
@ -663,26 +642,28 @@ rm -f /usr/sbin/policy-rc.d
|
||||||
# Configure system #
|
# Configure system #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Enable SSH password auth
|
# Enabling SSH password auth
|
||||||
sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
|
sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
|
||||||
service ssh restart
|
service ssh restart
|
||||||
|
|
||||||
# Disable AWStats cron
|
# Disabling AWStats cron
|
||||||
rm -f /etc/cron.d/awstats
|
rm -f /etc/cron.d/awstats
|
||||||
|
|
||||||
# Set directory color
|
# Set directory color
|
||||||
echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
|
echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
|
||||||
|
|
||||||
# Register /usr/sbin/nologin
|
# Registering /usr/sbin/nologin
|
||||||
echo "/usr/sbin/nologin" >> /etc/shells
|
if [ -z "$(grep nologin /etc/shells)" ]; then
|
||||||
|
echo "/usr/sbin/nologin" >> /etc/shells
|
||||||
|
fi
|
||||||
|
|
||||||
# NTP Sync
|
# Configuring NTP
|
||||||
echo '#!/bin/sh' > /etc/cron.daily/ntpdate
|
echo '#!/bin/sh' > /etc/cron.daily/ntpdate
|
||||||
echo "$(which ntpdate) -s ntp.ubuntu.com" >> /etc/cron.daily/ntpdate
|
echo "$(which ntpdate) -s ntp.ubuntu.com" >> /etc/cron.daily/ntpdate
|
||||||
chmod 775 /etc/cron.daily/ntpdate
|
chmod 775 /etc/cron.daily/ntpdate
|
||||||
ntpdate -s ntp.ubuntu.com
|
ntpdate -s ntp.ubuntu.com
|
||||||
|
|
||||||
# Setup rssh
|
# Adding rssh
|
||||||
if [ -z "$(grep /usr/bin/rssh /etc/shells)" ]; then
|
if [ -z "$(grep /usr/bin/rssh /etc/shells)" ]; then
|
||||||
echo /usr/bin/rssh >> /etc/shells
|
echo /usr/bin/rssh >> /etc/shells
|
||||||
fi
|
fi
|
||||||
|
@ -725,7 +706,6 @@ 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 $VESTA/log /var/log/vesta
|
ln -s $VESTA/log /var/log/vesta
|
||||||
chown admin:admin $VESTA/data/sessions
|
|
||||||
chmod 770 $VESTA/data/sessions
|
chmod 770 $VESTA/data/sessions
|
||||||
|
|
||||||
# Generating Vesta configuration
|
# Generating Vesta configuration
|
||||||
|
@ -943,7 +923,7 @@ done
|
||||||
|
|
||||||
if [ "$vsftpd" = 'yes' ]; then
|
if [ "$vsftpd" = 'yes' ]; then
|
||||||
cp -f $vestacp/vsftpd/vsftpd.conf /etc/
|
cp -f $vestacp/vsftpd/vsftpd.conf /etc/
|
||||||
touch /var/log//vsftpd.log
|
touch /var/log/vsftpd.log
|
||||||
chown root:adm /var/log/vsftpd.log
|
chown root:adm /var/log/vsftpd.log
|
||||||
chmod 640 /var/log/vsftpd.log
|
chmod 640 /var/log/vsftpd.log
|
||||||
touch /var/log/xferlog
|
touch /var/log/xferlog
|
||||||
|
@ -1267,7 +1247,6 @@ fi
|
||||||
|
|
||||||
# Adding default domain
|
# Adding default domain
|
||||||
$VESTA/bin/v-add-domain admin $servername
|
$VESTA/bin/v-add-domain admin $servername
|
||||||
codename="$codename:$(echo $vpass:$servername | base64)"
|
|
||||||
|
|
||||||
# Adding cron jobs
|
# Adding cron jobs
|
||||||
command="sudo $VESTA/bin/v-update-sys-queue disk"
|
command="sudo $VESTA/bin/v-update-sys-queue disk"
|
||||||
|
@ -1320,7 +1299,7 @@ $VESTA/bin/v-add-cron-vesta-autoupdate
|
||||||
wget vestacp.com/notify/?$codename -O /dev/null -q
|
wget vestacp.com/notify/?$codename -O /dev/null -q
|
||||||
|
|
||||||
# Comparing hostname and IP
|
# Comparing hostname and IP
|
||||||
host_ip=$(host $servername| head -n 1 | awk '{print $NF}')
|
host_ip=$(host $servername| head -n 1 |awk '{print $NF}')
|
||||||
if [ "$host_ip" = "$ip" ]; then
|
if [ "$host_ip" = "$ip" ]; then
|
||||||
ip="$servername"
|
ip="$servername"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
# CentOS 5, 6, 7
|
# CentOS 5, 6, 7
|
||||||
# Debian 7, 8
|
# Debian 7, 8
|
||||||
# Ubuntu 12.04 - 18.04
|
# Ubuntu 12.04 - 18.04
|
||||||
|
# Amazon Linux 2017
|
||||||
#
|
#
|
||||||
|
|
||||||
# Am I root?
|
# Am I root?
|
||||||
|
@ -45,11 +46,6 @@ case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
|
||||||
*) type="rhel" ;;
|
*) type="rhel" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Fallback to Ubuntu
|
|
||||||
if [ ! -e "/etc/redhat-release" ]; then
|
|
||||||
type='ubuntu'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check wget
|
# Check wget
|
||||||
if [ -e '/usr/bin/wget' ]; then
|
if [ -e '/usr/bin/wget' ]; then
|
||||||
wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
|
wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue