2013-09-07 20:53:25 +00:00
|
|
|
# Webmail: Using roundcube
|
|
|
|
##########################
|
|
|
|
|
2014-05-01 19:13:00 +00:00
|
|
|
source scripts/functions.sh # load our functions
|
2014-03-17 00:46:59 +00:00
|
|
|
source /etc/mailinabox.conf # load global vars
|
|
|
|
|
2014-04-25 12:25:47 +00:00
|
|
|
# Ubuntu's roundcube-core has a dependency on Apache & MySQL, which we don't want, so we can't
|
|
|
|
# install roundcube directly via apt-get install. We'll use apt-get to manually install the
|
|
|
|
# dependencies of roundcube that we know we need, and then we'll manually install debs for the
|
|
|
|
# roundcube version we want from Debian.
|
|
|
|
#
|
|
|
|
# The dependencies are from 'apt-cache showpkg roundcube-core'.
|
|
|
|
|
2014-05-01 19:13:00 +00:00
|
|
|
apt_install \
|
2014-04-25 12:25:47 +00:00
|
|
|
dbconfig-common \
|
|
|
|
php5 php5-sqlite php5-mcrypt php5-intl php5-json php5-common php-auth php-net-smtp php-net-socket php-net-sieve php-mail-mime php-crypt-gpg php5-gd php5-pspell \
|
|
|
|
tinymce libjs-jquery libjs-jquery-mousewheel libmagic1
|
2013-09-07 20:53:25 +00:00
|
|
|
|
|
|
|
mkdir -p externals
|
2014-03-17 00:52:20 +00:00
|
|
|
pkg_ver=0.9.5-4_all
|
2013-09-07 20:53:25 +00:00
|
|
|
wget -nc -P externals http://ftp.debian.org/debian/pool/main/r/roundcube/{roundcube,roundcube-core,roundcube-sqlite3,roundcube-plugins}_$pkg_ver.deb
|
|
|
|
DEBIAN_FRONTEND=noninteractive dpkg -Gi externals/{roundcube,roundcube-core,roundcube-sqlite3,roundcube-plugins}_$pkg_ver.deb
|
|
|
|
|
|
|
|
# Buuuut.... the .deb is missing things?
|
2014-03-17 01:05:02 +00:00
|
|
|
src_fn=roundcube_0.9.5.orig.tar.gz
|
|
|
|
src_dir=roundcubemail-0.9.5-dep
|
|
|
|
wget -nc -P externals http://ftp.debian.org/debian/pool/main/r/roundcube/$src_fn
|
|
|
|
tar -C /tmp -xzf $(pwd)/externals/$src_fn
|
2014-04-23 18:41:04 +00:00
|
|
|
if [ ! -d /var/lib/roundcube/SQL ]; then mv /tmp/$src_dir/SQL/ /var/lib/roundcube/; fi
|
2014-03-17 01:05:02 +00:00
|
|
|
rm -rf /tmp/$src_dir
|
2013-09-07 20:53:25 +00:00
|
|
|
|
|
|
|
# Settings
|
|
|
|
tools/editconf.py /etc/roundcube/main.inc.php \
|
|
|
|
"\$rcmail_config['default_host']='ssl://localhost';" \
|
|
|
|
"\$rcmail_config['default_port']=993;" \
|
|
|
|
"\$rcmail_config['imap_timeout']=30;" \
|
|
|
|
"\$rcmail_config['smtp_server']='tls://localhost';"\
|
|
|
|
"\$rcmail_config['smtp_user']='%u';"\
|
|
|
|
"\$rcmail_config['smtp_pass']='%p';"\
|
|
|
|
"\$rcmail_config['smtp_timeout']=30;" \
|
|
|
|
"\$rcmail_config['use_https']=true;" \
|
|
|
|
"\$rcmail_config['session_lifetime']=60*24*3;" \
|
|
|
|
"\$rcmail_config['password_charset']='utf8';" \
|
|
|
|
"\$rcmail_config['message_sort_col']='arrival';" \
|
|
|
|
"\$rcmail_config['junk_mbox']='Spam';" \
|
|
|
|
"\$rcmail_config['default_folders']=array('INBOX', 'Drafts', 'Sent', 'Spam', 'Trash');" \
|
2014-04-30 17:07:15 +00:00
|
|
|
"\$rcmail_config['draft_autosave']=30;" \
|
|
|
|
"\$rcmail_config['plugins']=array('password');"
|
2013-09-07 20:53:25 +00:00
|
|
|
|
2014-04-30 17:07:15 +00:00
|
|
|
# Password changing plugin settings
|
|
|
|
# The config comes empty by default, so we need the settings
|
|
|
|
# we're not planning to change in config.inc.dist...
|
|
|
|
cp /usr/share/roundcube/plugins/password/config.inc.php.dist \
|
|
|
|
/etc/roundcube/plugins/password/config.inc.php
|
|
|
|
|
|
|
|
tools/editconf.py /etc/roundcube/plugins/password/config.inc.php \
|
|
|
|
"\$rcmail_config['password_minimum_length']=6;" \
|
2014-04-30 18:52:23 +00:00
|
|
|
"\$rcmail_config['password_db_dsn']='sqlite:///$STORAGE_ROOT/mail/users.sqlite';" \
|
2014-04-30 17:07:15 +00:00
|
|
|
"\$rcmail_config['password_query']='UPDATE users SET password=%D WHERE email=%u';" \
|
|
|
|
"\$rcmail_config['password_dovecotpw']='/usr/bin/doveadm pw';" \
|
|
|
|
"\$rcmail_config['password_dovecotpw_method']='SHA512-CRYPT';" \
|
|
|
|
"\$rcmail_config['password_dovecotpw_with_method']=true;"
|
2013-09-07 20:53:25 +00:00
|
|
|
|
|
|
|
# Configure storage of user preferences.
|
|
|
|
mkdir -p $STORAGE_ROOT/mail/roundcube
|
|
|
|
cat - > /etc/roundcube/debian-db.php <<EOF;
|
|
|
|
<?php
|
|
|
|
\$dbtype = 'sqlite';
|
|
|
|
\$basepath = '$STORAGE_ROOT/mail/roundcube';
|
|
|
|
\$dbname = 'roundcube.sqlite';
|
|
|
|
?>
|
|
|
|
EOF
|
|
|
|
chown -R www-data.www-data $STORAGE_ROOT/mail/roundcube
|
|
|
|
|
2014-04-30 17:07:15 +00:00
|
|
|
# so PHP can use doveadm
|
|
|
|
usermod -a -G dovecot www-data
|
|
|
|
|
|
|
|
# set permissions so that PHP can use users.sqlite
|
|
|
|
# could use dovecot instead of www-data, but not sure it matters
|
|
|
|
chown root.www-data $STORAGE_ROOT/mail
|
|
|
|
chmod 775 $STORAGE_ROOT/mail
|
2014-04-30 18:50:11 +00:00
|
|
|
chown root.www-data $STORAGE_ROOT/mail/users.sqlite
|
|
|
|
chmod 664 $STORAGE_ROOT/mail/users.sqlite
|
2014-04-30 17:07:15 +00:00
|
|
|
|
2014-04-18 00:17:24 +00:00
|
|
|
# Enable PHP modules.
|
|
|
|
php5enmod mcrypt
|
|
|
|
service php-fastcgi restart
|