Skip to content

Commit 594911c

Browse files
author
Alexandros Ioannides
authored
Roundcube permissions (hestiacp#2203)
* Roundcube permission fixes
1 parent e695ac4 commit 594911c

File tree

5 files changed

+33
-25
lines changed

5 files changed

+33
-25
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file.
77

88
- Add support for Dovecote Sieve #2163 (@2163)
99
- Improve HELO based system and use RDNS lookup instead our old system
10-
- Set default php version for new installs to PHP8.0
10+
- Set default php version for new installs to PHP 8.0
1111

1212
### Bugfixes
1313

@@ -16,14 +16,15 @@ All notable changes to this project will be documented in this file.
1616
- Prevent SOA count up after v-change-dns-records with no changes are made
1717
- Fix #1296 Logrotate does not rotate logs any more on Ubuntu 20.04 and Debian 11
1818
- Run shellcheck to improve code quality
19-
- Improve ssh port detection for filemanager. Allowing users to create /etc/ssh/sshd.conf.d/custom.conf with custom port.
19+
- Improve ssh port detection for filemanager. Allowing users to create /etc/ssh/sshd.conf.d/custom.conf with custom port
2020
- Fix an bug in v-add-letsencrypt-host due to changes of Lets Encrypt causing issues with rate limiting
2121
- Improve Update process Hestia and allow versions to decide a a rebuild is required
2222
- Add Download SSL certificate function for self generated ssl cerrtificates #2181
2323
- Block access to .user.ini for Nginx + Apache2 #2179
2424
- Add support for download B2 backup to local server to allow for restore #2199
2525
- Update permissions /var/kog/roundcube on older installations #2173
2626
- Update translations
27+
- Fix Roundcube persmissions
2728

2829
### Dependencies
2930

bin/v-add-sys-roundcube

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ if [ "$UPDATE" == "no" ]; then
100100
# Replace with Hestia config
101101
cp -f $HESTIA_INSTALL_DIR/roundcube/main.inc.php $RC_CONFIG_DIR/config.inc.php
102102
cp -f $HESTIA_INSTALL_DIR/roundcube/mimetypes.php $RC_CONFIG_DIR/mimetypes.php
103+
chmod 644 $RC_CONFIG_DIR/*.php
103104

104105
cp -f $HESTIA_INSTALL_DIR/roundcube/hestia.php $RC_INSTALL_DIR/plugins/password/drivers/
105106
mkdir -p $RC_CONFIG_DIR/plugins/password

install/hst-install-debian.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ fi
17891789
#----------------------------------------------------------#
17901790

17911791
echo "[ * ] Install Roundcube..."
1792-
# Min requirements Dovecote + Exim + Mysql
1792+
# Min requirements Dovecot + Exim + Mysql
17931793

17941794
if [ "$mysql" == 'yes' ] && [ "$dovecot" == "yes" ]; then
17951795
$HESTIA/bin/v-add-sys-roundcube
@@ -1799,13 +1799,13 @@ fi
17991799
#----------------------------------------------------------#
18001800
# Install Sieve #
18011801
#----------------------------------------------------------#
1802-
# Min requirements Dovecote + Exim + Mysql + roundcube
1802+
# Min requirements Dovecot + Exim + Mysql + Roundcube
18031803
if [ "$sieve" = 'yes' ]; then
18041804
# Folder paths
18051805
RC_INSTALL_DIR="/var/lib/roundcube"
18061806
RC_CONFIG_DIR="/etc/roundcube"
18071807

1808-
echo "[ * ] Install Sieve ..."
1808+
echo "[ * ] Install Sieve..."
18091809

18101810
# dovecot.conf install
18111811
sed -i "s/namespace/service stats \{\n unix_listener stats-writer \{\n group = mail\n mode = 0660\n user = dovecot\n \}\n\}\n\nnamespace/g" /etc/dovecot/dovecot.conf
@@ -1829,24 +1829,23 @@ if [ "$sieve" = 'yes' ]; then
18291829
sed -i "s/address_pipe:/dovecot_virtual_delivery:\n driver = pipe\n command = \/usr\/lib\/dovecot\/dovecot-lda -e -d \$local_part@\$domain -f \$sender_address -a \$original_local_part@\$original_domain\n delivery_date_add\n envelope_to_add\n return_path_add\n log_output = true\n log_defer_output = true\n user = \${extract{2}{:}{\${lookup{\$local_part}lsearch{\/etc\/exim4\/domains\/\${lookup{\$domain}dsearch{\/etc\/exim4\/domains\/}}\/passwd}}}}\n group = mail\n return_output\n\naddress_pipe:/g" /etc/exim4/exim4.conf.template
18301830

18311831

1832-
# Modify roundcube install install
1832+
# Modify Roundcube install
18331833
mkdir -p $RC_CONFIG_DIR/plugins/managesieve
18341834

18351835
cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_managesieve.inc.php $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
18361836
ln -s $RC_CONFIG_DIR/plugins/managesieve/config.inc.php $RC_INSTALL_DIR/plugins/managesieve/config.inc.php
18371837

1838-
# permission changes
1838+
# Permission changes
18391839
chown -R dovecot:mail /var/log/dovecot.log
18401840
chmod 660 /var/log/dovecot.log
1841-
18421841
chown -R root:www-data $RC_CONFIG_DIR/
1843-
chmod 751 -R $RC_CONFIG_DIR
1844-
1842+
chmod 751 -R $RC_CONFIG_DIR
1843+
chmod 644 $RC_CONFIG_DIR/*.php
18451844
chmod 644 $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
18461845

18471846
sed -i "s/'archive'/'archive', 'managesieve'/g" $RC_CONFIG_DIR/config.inc.php
18481847

1849-
#restart dovecot and exim4
1848+
# Restart Dovecot and exim4
18501849
systemctl restart dovecot > /dev/null 2>&1
18511850
systemctl restart exim4 > /dev/null 2>&1
18521851
fi

install/hst-install-ubuntu.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,23 +1794,25 @@ fi
17941794
#----------------------------------------------------------#
17951795

17961796
echo "[ * ] Install Roundcube..."
1797-
# Min requirements Dovecote + Exim + Mysql
1797+
# Min requirements Dovecot + Exim + Mysql
17981798

17991799
if [ "$mysql" == 'yes' ] && [ "$dovecot" == "yes" ]; then
18001800
$HESTIA/bin/v-add-sys-roundcube
18011801
write_config_value "WEBMAIL_ALIAS" "webmail"
18021802
fi
18031803

1804+
18041805
#----------------------------------------------------------#
18051806
# Install Sieve #
18061807
#----------------------------------------------------------#
1807-
# Min requirements Dovecote + Exim + Mysql + roundcube
1808+
1809+
# Min requirements Dovecot + Exim + Mysql + Roundcube
18081810
if [ "$sieve" = 'yes' ]; then
18091811
# Folder paths
18101812
RC_INSTALL_DIR="/var/lib/roundcube"
18111813
RC_CONFIG_DIR="/etc/roundcube"
18121814

1813-
echo "[ * ] Install Sieve ..."
1815+
echo "[ * ] Install Sieve..."
18141816

18151817
# dovecot.conf install
18161818
sed -i "s/namespace/service stats \{\n unix_listener stats-writer \{\n group = mail\n mode = 0660\n user = dovecot\n \}\n\}\n\nnamespace/g" /etc/dovecot/dovecot.conf
@@ -1826,36 +1828,36 @@ if [ "$sieve" = 'yes' ]; then
18261828
# replace dovecot-sieve config files
18271829
cp -f $HESTIA_INSTALL_DIR/dovecot/sieve/* /etc/dovecot/conf.d
18281830

1829-
# dovecot default file install
1831+
# Dovecot default file install
18301832
echo -e "require [\"fileinto\"];\n# rule:[SPAM]\nif header :contains \"X-Spam-Flag\" \"YES\" {\n fileinto \"INBOX.Spam\";\n}\n" > /etc/dovecot/sieve/default
18311833

18321834
# exim4 install
18331835
sed -i "s/\stransport = local_delivery/ transport = dovecot_virtual_delivery/" /etc/exim4/exim4.conf.template
18341836

18351837
sed -i "s/address_pipe:/dovecot_virtual_delivery:\n driver = pipe\n command = \/usr\/lib\/dovecot\/dovecot-lda -e -d \$local_part@\$domain -f \$sender_address -a \$original_local_part@\$original_domain\n delivery_date_add\n envelope_to_add\n return_path_add\n log_output = true\n log_defer_output = true\n user = \${extract{2}{:}{\${lookup{\$local_part}lsearch{\/etc\/exim4\/domains\/\${lookup{\$domain}dsearch{\/etc\/exim4\/domains\/}}\/passwd}}}}\n group = mail\n return_output\n\naddress_pipe:/g" /etc/exim4/exim4.conf.template
18361838

1837-
# Modify roundcube install install
1839+
# Modify Roundcube install
18381840
mkdir -p $RC_CONFIG_DIR/plugins/managesieve
18391841

18401842
cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_managesieve.inc.php $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
18411843
ln -s $RC_CONFIG_DIR/plugins/managesieve/config.inc.php $RC_INSTALL_DIR/plugins/managesieve/config.inc.php
18421844

1843-
# permission changes
1845+
# Permission changes
18441846
chown -R dovecot:mail /var/log/dovecot.log
18451847
chmod 660 /var/log/dovecot.log
1846-
18471848
chown -R root:www-data $RC_CONFIG_DIR/
1848-
chmod 751 -R $RC_CONFIG_DIR
1849-
1849+
chmod 751 -R $RC_CONFIG_DIR
1850+
chmod 644 $RC_CONFIG_DIR/*.php
18501851
chmod 644 $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
1851-
1852+
18521853
sed -i "s/'archive'/'archive', 'managesieve'/g" $RC_CONFIG_DIR/config.inc.php
18531854

1854-
#restart dovecot and exim4
1855+
# Restart Dovecot and exim4
18551856
systemctl restart dovecot > /dev/null 2>&1
18561857
systemctl restart exim4 > /dev/null 2>&1
18571858
fi
18581859

1860+
18591861
#----------------------------------------------------------#
18601862
# Configure API #
18611863
#----------------------------------------------------------#

install/upgrade/versions/1.5.0.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [ -n "$MAIL_SYSTEM" ]; then
3939

4040
# Clean up legacy ip variable
4141
for ip in $($BIN/v-list-sys-ips plain | cut -f1); do
42-
sed '/^HELO/d' $HESTIA/data/ips/$ip;
42+
sed '/^HELO/d' $HESTIA/data/ips/$ip > /dev/null
4343
done
4444
fi
4545

@@ -53,7 +53,12 @@ if [ -L "/var/log/hestia" ]; then
5353
touch /var/log/hestia/auth.log /var/log/hestia/error.log /var/log/hestia/system.log /var/log/hestia/nginx-error.log /var/log/hestia/nginx-access.log
5454
fi
5555

56-
if [ -d "/var/log/roundcube" ]; then
56+
if [ -d "/var/log/roundcube" ]; then
5757
chown www-data:root /var/log/roundcube
5858
chmod 751 /var/log/roundcube
59-
fi
59+
fi
60+
61+
if [ -d "/etc/roundcube" ]; then
62+
chmod 644 /etc/roundcube/defaults.inc.php
63+
chmod 644 /etc/roundcube/mimetypes.php
64+
fi

0 commit comments

Comments
 (0)