Skip to content

Commit c78a24a

Browse files
committed
Fix roundcube permissions
This patch basically changes the user group root:hestiamail to hestiamail:www-data for roundcube directories. Also changes the permissions from 644 to 640 to the file /etc/roundcube/config.inc.php so that it cannot be read by others as it contains the roundcube user's password for the database.
1 parent 836eaee commit c78a24a

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

bin/v-add-sys-roundcube

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ if [ "$UPDATE" == "no" ]; then
116116
ln -s $RC_CONFIG_DIR/plugins/zipdownload/config.inc.php ./plugins/zipdownload/config.inc.php
117117

118118
# Set up correct permissions roundcube
119-
chown -R root:hestiamail $RC_CONFIG_DIR/
119+
chown -R hestiamail:www-data $RC_CONFIG_DIR/
120120
chmod 751 -R $RC_CONFIG_DIR
121-
chmod 644 $RC_CONFIG_DIR/config.inc.php
121+
chmod 640 $RC_CONFIG_DIR/config.inc.php
122122
chmod 644 $RC_CONFIG_DIR/plugins/password/config.inc.php
123123
chmod 644 $RC_CONFIG_DIR/plugins/newmail_notifier/config.inc.php
124124
chmod 644 $RC_CONFIG_DIR/plugins/zipdownload/config.inc.php
@@ -127,13 +127,13 @@ if [ "$UPDATE" == "no" ]; then
127127
echo "User-agent: *" > /var/lib/roundcube/robots.txt
128128
echo "Disallow: /" >> /var/lib/roundcube/robots.txt
129129

130-
chown -R root:hestiamail $RC_INSTALL_DIR
130+
chown -R hestiamail:www-data $RC_INSTALL_DIR
131131

132132
# Log file
133133
if [ ! -d $RC_LOG ]; then
134134
mkdir $RC_LOG
135135
fi
136-
chown hestiamail:hestiamail $RC_LOG
136+
chown hestiamail:www-data $RC_LOG
137137
chmod 751 $RC_LOG
138138

139139
if [ ! -z "$(echo "$DB_SYSTEM" | grep -E 'mysql|pgsql')" ]; then
@@ -192,7 +192,7 @@ else
192192
export COMPOSER_ALLOW_SUPERUSER=1
193193
$RC_INSTALL_DIR/bin/update.sh --version "$version" > /dev/null 2>&1
194194
$RC_INSTALL_DIR/bin/indexcontacts.sh > /dev/null 2>&1
195-
chown -R root:hestiamail $RC_INSTALL_DIR
195+
chown -R hestiamail:www-data $RC_INSTALL_DIR
196196

197197
#clean up the mess
198198
if [ -d "$RC_INSTALL_DIR/installer" ]; then

install/hst-install-debian.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,11 +2190,12 @@ if [ "$sieve" = 'yes' ]; then
21902190
mkdir -p $RC_CONFIG_DIR/plugins/managesieve
21912191
cp -f $HESTIA_COMMON_DIR/roundcube/plugins/config_managesieve.inc.php $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
21922192
ln -s $RC_CONFIG_DIR/plugins/managesieve/config.inc.php $RC_INSTALL_DIR/plugins/managesieve/config.inc.php
2193-
chown -R root:hestiamail $RC_CONFIG_DIR/
2193+
chown -R hestiamail:www-data $RC_CONFIG_DIR/
21942194
chmod 751 -R $RC_CONFIG_DIR
21952195
chmod 644 $RC_CONFIG_DIR/*.php
21962196
chmod 644 $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
21972197
sed -i "s/\"archive\"/\"archive\", \"managesieve\"/g" $RC_CONFIG_DIR/config.inc.php
2198+
chmod 640 $RC_CONFIG_DIR/config.inc.php
21982199
fi
21992200

22002201
# Restart Dovecot and exim4

install/hst-install-ubuntu.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2165,11 +2165,12 @@ if [ "$sieve" = 'yes' ]; then
21652165
mkdir -p $RC_CONFIG_DIR/plugins/managesieve
21662166
cp -f $HESTIA_COMMON_DIR/roundcube/plugins/config_managesieve.inc.php $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
21672167
ln -s $RC_CONFIG_DIR/plugins/managesieve/config.inc.php $RC_INSTALL_DIR/plugins/managesieve/config.inc.php
2168-
chown -R root:hestiamail $RC_CONFIG_DIR/
2168+
chown -R hestiamail:www-data $RC_CONFIG_DIR/
21692169
chmod 751 -R $RC_CONFIG_DIR
21702170
chmod 644 $RC_CONFIG_DIR/*.php
21712171
chmod 644 $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
21722172
sed -i "s/\"archive\"/\"archive\", \"managesieve\"/g" $RC_CONFIG_DIR/config.inc.php
2173+
chmod 640 $RC_CONFIG_DIR/config.inc.php
21732174
fi
21742175

21752176
# Restart Dovecot and exim4

install/upgrade/versions/1.8.12.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,22 @@ if [ -d "/var/lib/snappymail" ]; then
3333
chown hestiamail:hestiamail /etc/snappymail
3434
fi
3535

36+
#Roundube folder paths
37+
RC_INSTALL_DIR="/var/lib/roundcube"
38+
RC_CONFIG_DIR="/etc/roundcube"
39+
RC_LOG="/var/log/roundcube"
40+
41+
if [ -d "$RC_INSTALL_DIR" ]; then
42+
chown -R hestiamail:www-data "$RC_INSTALL_DIR"
43+
fi
44+
if [ -d "$RC_CONFIG_DIR" ]; then
45+
chown -R hestiamail:www-data "$RC_CONFIG_DIR"
46+
fi
47+
if [ -f "$RC_CONFIG_DIR/config.inc.php" ]; then
48+
chmod 640 "$RC_CONFIG_DIR/config.inc.php"
49+
fi
50+
if [ -d "$RC_LOG" ]; then
51+
chown -R hestiamail:www-data "$RC_LOG"
52+
fi
53+
3654
sed -i "s/disable_functions =.*/disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority/g" /etc/php/*/cli/php.ini

0 commit comments

Comments
 (0)