|
|
@@ -647,17 +647,17 @@ if ! [[ "$servername" =~ ^${mask1}${mask2}$ ]]; then
|
|
|
else
|
|
|
servername="example.com"
|
|
|
fi
|
|
|
- echo "127.0.0.1 $servername" >> /etc/hosts
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- echo "::1 $servername" >> /etc/hosts
|
|
|
- fi
|
|
|
+ echo "127.0.0.1 $servername" >> /etc/hosts
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ echo "::1 $servername" >> /etc/hosts
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
if [[ -z $(grep -i "$servername" /etc/hosts) ]]; then
|
|
|
- echo "127.0.0.1 $servername" >> /etc/hosts
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- echo "::1 $servername" >> /etc/hosts
|
|
|
- fi
|
|
|
+ echo "127.0.0.1 $servername" >> /etc/hosts
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ echo "::1 $servername" >> /etc/hosts
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
# Set email if it wasn't set
|
|
|
@@ -1081,18 +1081,18 @@ if [ ! -e "/sbin/iptables" ]; then
|
|
|
fi
|
|
|
fi
|
|
|
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- if which ip6tables; then
|
|
|
- ln -s "$(which ip6tables)" /sbin/ip6tables
|
|
|
- elif [ -e "/usr/sbin/ip6tables" ]; then
|
|
|
- ln -s /usr/sbin/ip6tables /sbin/ip6tables
|
|
|
- elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables; then
|
|
|
- autoip6tables=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables | cut -d '' -f 2)
|
|
|
- if [ -x "$autoip6tables" ]; then
|
|
|
- ln -s "$autoip6tables" /sbin/ip6tables
|
|
|
- fi
|
|
|
- fi
|
|
|
- fi
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ if which ip6tables; then
|
|
|
+ ln -s "$(which ip6tables)" /sbin/ip6tables
|
|
|
+ elif [ -e "/usr/sbin/ip6tables" ]; then
|
|
|
+ ln -s /usr/sbin/ip6tables /sbin/ip6tables
|
|
|
+ elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables; then
|
|
|
+ autoip6tables=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables | cut -d '' -f 2)
|
|
|
+ if [ -x "$autoip6tables" ]; then
|
|
|
+ ln -s "$autoip6tables" /sbin/ip6tables
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
if [ ! -e "/sbin/iptables-save" ]; then
|
|
|
@@ -1106,18 +1106,18 @@ if [ ! -e "/sbin/iptables-save" ]; then
|
|
|
ln -s "$autoiptables_save" /sbin/iptables-save
|
|
|
fi
|
|
|
fi
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- if which ip6tables-save; then
|
|
|
- ln -s "$(which ip6tables-save)" /sbin/ip6tables-save
|
|
|
- elif [ -e "/usr/sbin/ip6tables-save" ]; then
|
|
|
- ln -s /usr/sbin/ip6tables-save /sbin/ip6tables-save
|
|
|
- elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables-save; then
|
|
|
- autoip6tables_save=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-save | cut -d '' -f 2)
|
|
|
- if [ -x "$autoip6tables_save" ]; then
|
|
|
- ln -s "$autoip6tables_save" /sbin/ip6tables-save
|
|
|
- fi
|
|
|
- fi
|
|
|
- fi
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ if which ip6tables-save; then
|
|
|
+ ln -s "$(which ip6tables-save)" /sbin/ip6tables-save
|
|
|
+ elif [ -e "/usr/sbin/ip6tables-save" ]; then
|
|
|
+ ln -s /usr/sbin/ip6tables-save /sbin/ip6tables-save
|
|
|
+ elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables-save; then
|
|
|
+ autoip6tables_save=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-save | cut -d '' -f 2)
|
|
|
+ if [ -x "$autoip6tables_save" ]; then
|
|
|
+ ln -s "$autoip6tables_save" /sbin/ip6tables-save
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
if [ ! -e "/sbin/iptables-restore" ]; then
|
|
|
@@ -1131,18 +1131,18 @@ if [ ! -e "/sbin/iptables-restore" ]; then
|
|
|
ln -s "$autoiptables_restore" /sbin/iptables-restore
|
|
|
fi
|
|
|
fi
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- if which ip6tables-restore; then
|
|
|
- ln -s "$(which ip6tables-restore)" /sbin/ip6tables-restore
|
|
|
- elif [ -e "/usr/sbin/ip6tables-restore" ]; then
|
|
|
- ln -s /usr/sbin/ip6tables-restore /sbin/ip6tables-restore
|
|
|
- elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables-restore; then
|
|
|
- autoip6tables_restore=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-restore | cut -d '' -f 2)
|
|
|
- if [ -x "$autoip6tables_restore" ]; then
|
|
|
- ln -s "$autoip6tables_restore" /sbin/ip6tables-restore
|
|
|
- fi
|
|
|
- fi
|
|
|
- fi
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ if which ip6tables-restore; then
|
|
|
+ ln -s "$(which ip6tables-restore)" /sbin/ip6tables-restore
|
|
|
+ elif [ -e "/usr/sbin/ip6tables-restore" ]; then
|
|
|
+ ln -s /usr/sbin/ip6tables-restore /sbin/ip6tables-restore
|
|
|
+ elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ip6tables-restore; then
|
|
|
+ autoip6tables_restore=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-restore | cut -d '' -f 2)
|
|
|
+ if [ -x "$autoip6tables_restore" ]; then
|
|
|
+ ln -s "$autoip6tables_restore" /sbin/ip6tables-restore
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
# Restrict access to /proc fs
|
|
|
@@ -1440,21 +1440,21 @@ dns_resolver=$(cat /etc/resolv.conf | grep -i '^nameserver' | cut -d ' ' -f2 | t
|
|
|
for ip in $dns_resolver; do
|
|
|
if [[ $ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
resolver="$ip $resolver"
|
|
|
- fi
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- if [[ $ip =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then
|
|
|
- resolver="[$ip] $resolver"
|
|
|
- fi
|
|
|
- fi
|
|
|
+ fi
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ if [[ $ip =~ ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$ ]]; then
|
|
|
+ resolver="[$ip] $resolver"
|
|
|
+ fi
|
|
|
+ fi
|
|
|
done
|
|
|
if [ -n "$resolver" ]; then
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- sed -i "s/1.0.0.1 \[2606:4700:4700::1111\] 1.0.0.1 \[2606:4700:4700::1001\]/$resolver/g" /etc/nginx/nginx.conf
|
|
|
- sed -i "s/1.0.0.1 \[2606:4700:4700::1111\] 1.0.0.1 \[2606:4700:4700::1001\]/$resolver/g" /usr/local/hestia/nginx/
|
|
|
- else
|
|
|
- sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /etc/nginx/nginx.conf
|
|
|
- sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /usr/local/hestia/nginx/conf/nginx.conf
|
|
|
- fi
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ sed -i "s/1.0.0.1 \[2606:4700:4700::1111\] 1.0.0.1 \[2606:4700:4700::1001\]/$resolver/g" /etc/nginx/nginx.conf
|
|
|
+ sed -i "s/1.0.0.1 \[2606:4700:4700::1111\] 1.0.0.1 \[2606:4700:4700::1001\]/$resolver/g" /usr/local/hestia/nginx/
|
|
|
+ else
|
|
|
+ sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /etc/nginx/nginx.conf
|
|
|
+ sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /usr/local/hestia/nginx/conf/nginx.conf
|
|
|
+ fi
|
|
|
fi
|
|
|
|
|
|
update-rc.d nginx defaults > /dev/null 2>&1
|
|
|
@@ -1477,9 +1477,9 @@ if [ "$apache" = 'yes' ]; then
|
|
|
cp -f /etc/apache2/mods-available/status.load /etc/apache2/mods-available/hestia-status.load
|
|
|
cp -f $HESTIA_INSTALL_DIR/logrotate/apache2 /etc/logrotate.d/
|
|
|
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- cp -f $HESTIA_INSTALL_DIR/apache2/status-ipv6.conf /etc/apache2/mods-available/hestia-status.conf
|
|
|
- fi
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ cp -f $HESTIA_INSTALL_DIR/apache2/status-ipv6.conf /etc/apache2/mods-available/hestia-status.conf
|
|
|
+ fi
|
|
|
|
|
|
# Enable needed modules
|
|
|
a2enmod rewrite > /dev/null 2>&1
|
|
|
@@ -1573,9 +1573,9 @@ chmod 755 /etc/cron.daily/php-session-cleanup
|
|
|
if [ "$vsftpd" = 'yes' ]; then
|
|
|
echo "[ * ] Configuring Vsftpd server..."
|
|
|
cp -f $HESTIA_INSTALL_DIR/vsftpd/vsftpd.conf /etc/
|
|
|
- if [ "$ipv6" = 'yes' ]; then
|
|
|
- cp -f $HESTIA_INSTALL_DIR/vsftpd/vsftpd-ipv6.conf /etc/vsftpd.conf
|
|
|
- fi
|
|
|
+ if [ "$ipv6" = 'yes' ]; then
|
|
|
+ cp -f $HESTIA_INSTALL_DIR/vsftpd/vsftpd-ipv6.conf /etc/vsftpd.conf
|
|
|
+ fi
|
|
|
touch /var/log/vsftpd.log
|
|
|
chown root:adm /var/log/vsftpd.log
|
|
|
chmod 640 /var/log/vsftpd.log
|