Skip to content

Commit 6f18e7f

Browse files
LupulKristan Kenney
authored andcommitted
Update install scripts
- Add check before appending information to files, add missing folders, permissions - Remove references to old Roundcube files. Thanks @Lupul re: hestiacp#260
1 parent a97f37d commit 6f18e7f

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

install/hst-install-debian.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -878,20 +878,30 @@ rm -f /usr/sbin/policy-rc.d
878878
sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
879879

880880
# Disable SSH suffix broadcast
881-
echo '' >> /etc/ssh/sshd_config
882-
echo 'DebianBanner no' >> /etc/ssh/sshd_config
881+
if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
882+
echo '' >> /etc/ssh/sshd_config
883+
echo 'DebianBanner no' >> /etc/ssh/sshd_config
884+
service ssh restart
885+
fi
883886

884887
service ssh restart
885888

886889
# Disable AWStats cron
887890
rm -f /etc/cron.d/awstats
888891

889892
# Set directory color
890-
echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
893+
if [ -z "$(grep 'LS_COLORS="$LS_COLORS:di=00;33"' /etc/profile)" ]; then
894+
echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
895+
fi
891896

892897
# Register /sbin/nologin and /usr/sbin/nologin
893-
echo "/sbin/nologin" >> /etc/shells
894-
echo "/usr/sbin/nologin" >> /etc/shells
898+
if [ -z "$(grep ^/sbin/nologin /etc/shells)" ]; then
899+
echo "/sbin/nologin" >> /etc/shells
900+
fi
901+
902+
if [ -z "$(grep ^/usr/sbin/nologin /etc/shells)" ]; then
903+
echo "/usr/sbin/nologin" >> /etc/shells
904+
fi
895905

896906
# Configuring NTP
897907
echo '#!/bin/sh' > /etc/cron.daily/ntpdate
@@ -1058,6 +1068,8 @@ chmod 751 $HESTIA/data/templates/web/unassigned/css
10581068
chmod 751 $HESTIA/data/templates/web/unassigned/js
10591069
chmod 751 $HESTIA/data/templates/web/unassigned/webfonts
10601070

1071+
mkdir -p /var/www/html
1072+
10611073
# Install default success page
10621074
cp -rf $hestiacp/templates/web/unassigned/* /var/www/html/
10631075

@@ -1095,7 +1107,6 @@ if [ "$nginx" = 'yes' ]; then
10951107
cp -f $hestiacp/nginx/status.conf /etc/nginx/conf.d/
10961108
cp -f $hestiacp/nginx/phpmyadmin.inc /etc/nginx/conf.d/
10971109
cp -f $hestiacp/nginx/phppgadmin.inc /etc/nginx/conf.d/
1098-
cp -f $hestiacp/nginx/webmail.inc /etc/nginx/conf.d/
10991110
cp -f $hestiacp/logrotate/nginx /etc/logrotate.d/
11001111
mkdir -p /etc/nginx/conf.d/domains
11011112
mkdir -p /var/log/nginx/domains
@@ -1366,6 +1377,7 @@ if [ "$named" = 'yes' ]; then
13661377
cp -f $hestiacp/bind/named.conf.options /etc/bind/
13671378
chown root:bind /etc/bind/named.conf
13681379
chown root:bind /etc/bind/named.conf.options
1380+
chown bind:bind /var/cache/bind
13691381
chmod 640 /etc/bind/named.conf
13701382
chmod 640 /etc/bind/named.conf.options
13711383
aa-complain /usr/sbin/named 2>/dev/null

install/hst-install-ubuntu.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -846,16 +846,19 @@ rm -f /usr/sbin/policy-rc.d
846846
sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
847847

848848
# Disable SSH suffix broadcast
849-
echo '' >> /etc/ssh/sshd_config
850-
echo 'DebianBanner no' >> /etc/ssh/sshd_config
851-
852-
service ssh restart
849+
if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
850+
echo '' >> /etc/ssh/sshd_config
851+
echo 'DebianBanner no' >> /etc/ssh/sshd_config
852+
service ssh restart
853+
fi
853854

854855
# Disable AWStats cron
855856
rm -f /etc/cron.d/awstats
856857

857858
# Set directory color
858-
echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
859+
if [ -z "$(grep 'LS_COLORS="$LS_COLORS:di=00;33"' /etc/profile)" ]; then
860+
echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
861+
fi
859862

860863
# Registering /usr/sbin/nologin
861864
if [ -z "$(grep nologin /etc/shells)" ]; then
@@ -1021,6 +1024,8 @@ chmod 751 $HESTIA/data/templates/web/unassigned/css
10211024
chmod 751 $HESTIA/data/templates/web/unassigned/js
10221025
chmod 751 $HESTIA/data/templates/web/unassigned/webfonts
10231026

1027+
mkdir -p /var/www/html
1028+
10241029
# Install default success page
10251030
cp -rf $hestiacp/templates/web/unassigned/* /var/www/html/
10261031

@@ -1063,7 +1068,6 @@ if [ "$nginx" = 'yes' ]; then
10631068
cp -f $hestiacp/nginx/status.conf /etc/nginx/conf.d/
10641069
cp -f $hestiacp/nginx/phpmyadmin.inc /etc/nginx/conf.d/
10651070
cp -f $hestiacp/nginx/phppgadmin.inc /etc/nginx/conf.d/
1066-
cp -f $hestiacp/nginx/webmail.inc /etc/nginx/conf.d/
10671071
cp -f $hestiacp/logrotate/nginx /etc/logrotate.d/
10681072
mkdir -p /etc/nginx/conf.d/domains
10691073
mkdir -p /var/log/nginx/domains
@@ -1331,6 +1335,7 @@ if [ "$named" = 'yes' ]; then
13311335
cp -f $hestiacp/bind/named.conf.options /etc/bind/
13321336
chown root:bind /etc/bind/named.conf
13331337
chown root:bind /etc/bind/named.conf.options
1338+
chown bind:bind /var/cache/bind
13341339
chmod 640 /etc/bind/named.conf
13351340
chmod 640 /etc/bind/named.conf.options
13361341
aa-complain /usr/sbin/named > /dev/null 2>&1
@@ -1471,32 +1476,30 @@ if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
14711476
ln -s /etc/roundcube/apache.conf /etc/apache2/conf.d/roundcube.conf
14721477
fi
14731478
cp -f $hestiacp/roundcube/main.inc.php /etc/roundcube/
1474-
cp -f $hestiacp/roundcube/db.inc.php /etc/roundcube/
1475-
chmod 640 /etc/roundcube/debian-db*
1476-
chown root:www-data /etc/roundcube/debian-db*
1477-
cp -f $hestiacp/roundcube/hestia.php \
1478-
/usr/share/roundcube/plugins/password/drivers/
1479+
cp -f $hestiacp/roundcube/db.inc.php /etc/roundcube/
14791480
cp -f $hestiacp/roundcube/config.inc.php /etc/roundcube/plugins/password/
1481+
cp -f $hestiacp/roundcube/hestia.php /usr/share/roundcube/plugins/password/drivers/
1482+
14801483
r="$(gen_pass)"
14811484
mysql -e "CREATE DATABASE roundcube"
14821485
mysql -e "GRANT ALL ON roundcube.*
14831486
TO roundcube@localhost IDENTIFIED BY '$r'"
14841487
sed -i "s/%password%/$r/g" /etc/roundcube/db.inc.php
14851488

14861489
# Send all emails through SMTP and add user information
1487-
sed -i "/\$config\['smtp_server'\]/c\$config\['smtp_server'\] = 'localhost';" /etc/roundcube/defaults.inc.php
1488-
sed -i "/\$config\['smtp_user'\]/c\$config\['smtp_user'\] = '%u';" /etc/roundcube/defaults.inc.php
1489-
sed -i "/\$config\['smtp_pass'\]/c\$config\['smtp_pass'\] = '%p';" /etc/roundcube/defaults.inc.php
1490+
sed -i "/\$config\['smtp_server'\]/c\$config\['smtp_server'\] = 'localhost';" /etc/roundcube/main.inc.php
1491+
sed -i "/\$config\['smtp_user'\]/c\$config\['smtp_user'\] = '%u';" /etc/roundcube/main.inc.php
1492+
sed -i "/\$config\['smtp_pass'\]/c\$config\['smtp_pass'\] = '%p';" /etc/roundcube/main.inc.php
14901493

14911494
touch /var/log/roundcube/errors
14921495
chmod 640 /var/log/roundcube/errors
14931496
chown www-data:adm /var/log/roundcube/errors
14941497
if [ "$release" = '16.04' ] || [ "$release" = '18.04' ]; then
14951498
mv /etc/roundcube/db.inc.php /etc/roundcube/debian-db-roundcube.php
14961499
mv /etc/roundcube/main.inc.php /etc/roundcube/config.inc.php
1497-
chmod 640 /etc/roundcube/debian-db-roundcube.php
1498-
chown root:www-data /etc/roundcube/debian-db-roundcube.php
14991500
fi
1501+
chmod 640 /etc/roundcube/debian-db*
1502+
chown root:www-data /etc/roundcube/debian-db*
15001503

15011504
mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
15021505
phpenmod mcrypt > /dev/null 2>&1

0 commit comments

Comments
 (0)