Roundcube

De Banane Atomic
Version datée du 20 septembre 2023 à 10:02 par Nicolas (discussion | contributions) (→‎Installation)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à la navigationAller à la recherche

Links

Configuration

/etc/roundcube/config.inc.php
$config['imap_host'] = 'localhost:143';
$config['smtp_host'] = 'localhost:25';
// use STARTTLS
$config['smtp_host'] = 'tls://hostname.domain.net';  // has to match the certificate

// compose html formatted messages by default
//  4 - always, except when replying to plain text message
$config['htmleditor'] = 4;

// by default: '', the value is asked at login ???
$config['default_host'] = 'domain.fr';
/etc/hosts
127.0.0.1    localhost domain.fr
::1          localhost ip6-localhost ip6-loopback domain.fr

Debug

/etc/roundcube/config.inc.php
$config['debug_level'] = 4;
$config['smtp_debug'] = true;

NGINX

/etc/nginx/sites-available/rouncube.conf
server {
    server_name roundcube.localserver;
    listen      80;
    root        /var/www/roundcube;
    index       index.php;

    allow 192.168.0.0/24;
    deny all;

    access_log  /var/log/nginx/roundcube-access.log;
    error_log   /var/log/nginx/roundcube-error.log;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }
}

Apache

conf

L'accès au site se fait via cette url http://[server-name]/roundcube
/etc/apache2/conf-available/roundcube.conf/etc/roundcube/apache.conf
/etc/roundcube/apache.conf
# Those aliases do not work properly with several hosts on your apache server
# Uncomment them to use it or adapt them to your configuration
Alias /roundcube /var/lib/roundcube

<Directory /var/lib/roundcube/>
  Options +FollowSymLinks
  # This is needed to parse /var/lib/roundcube/.htaccess. See its
  # content before setting AllowOverride to None.
  AllowOverride All
  <IfVersion >= 2.3>
    Require all granted
  </IfVersion> 
  <IfVersion < 2.3>
    Order allow,deny
    Allow from all
  </IfVersion>
</Directory>

# Protecting basic directories:
<Directory /var/lib/roundcube/config>
  Options -FollowSymLinks
  AllowOverride None
</Directory>

<Directory /var/lib/roundcube/temp>
  Options -FollowSymLinks
  AllowOverride None
  <IfVersion >= 2.3>
    Require all denied
  </IfVersion> 
  <IfVersion < 2.3>
    Order allow,deny
    Deny from all
  </IfVersion>
</Directory>

<Directory /var/lib/roundcube/logs>
  Options -FollowSymLinks
  AllowOverride None
  <IfVersion >= 2.3>
    Require all denied
  </IfVersion> 
  <IfVersion < 2.3>
    Order allow,deny
    Deny from all
  </IfVersion>
</Directory>

site

Pour utiliser un site plutôt qu'une conf.

Bash.svg
# désactiver la conf roundcube
sudo a2disconf roundcube
# activer le site roundcube
sudo a2ensite roundcube
/etc/apache2/sites-available/roundcube.conf
<VirtualHost *:80>
    ServerName roundcube.domain.fr
    Redirect   / https://roundcube.domain.fr/
</VirtualHost>

<VirtualHost *:443>
    ServerName roundcube.domain.fr
    DocumentRoot /var/lib/roundcube
    
    SSLCertificateFile      /etc/letsencrypt/live/domain.fr/fullchain.pem
    SSLCertificateKeyFile   /etc/letsencrypt/live/domain.fr/privkey.pem
    Include                 /etc/letsencrypt/options-ssl-apache.conf

    <FilesMatch "\.php$">
        SSLOptions +StdEnvVars
    </FilesMatch>

    ErrorLog ${APACHE_LOG_DIR}/roundcube-error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/roundcube-access.log combined
    
    <Directory /var/lib/roundcube/>
        Options +FollowSymLinks
        # This is needed to parse /var/lib/roundcube/.htaccess. See its
        # content before setting AllowOverride to None.
        AllowOverride All
        Require all granted
    </Directory>

    # Protecting basic directories:
    <Directory /var/lib/roundcube/config>
        Options -FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /var/lib/roundcube/temp>
        Options -FollowSymLinks
        AllowOverride None
        Require all denied
    </Directory>

    <Directory /var/lib/roundcube/logs>
        Options -FollowSymLinks
        AllowOverride None
        Require all denied
    </Directory>
</VirtualHost>

Upgrade

upgrade-roundcube.sh
#!/usr/bin/bash

set -e
set -o pipefail
set -u

echo
echo 'Upgrade roundcube installation'
read -p 'Target version (ex: 1.6.2): ' version

echo "Download and extract version $version"
cd /tmp
rm -f "roundcubemail-${version}-complete.tar.gz"
rm -rf "roundcubemail-${version}"

wget "https://github.com/roundcube/roundcubemail/releases/download/${version}/roundcubemail-${version}-complete.tar.gz" --no-verbose
tar xf "roundcubemail-${version}-complete.tar.gz"

echo
echo 'Deactivate current version'
sudo rm -f /etc/nginx/sites-enabled/roundcube.conf
sudo systemctl reload nginx

echo
echo 'Install new version'
sudo mv /var/www/roundcube /var/www/roundcube.bak
sudo mv "roundcubemail-${version}" /var/www/roundcube
sudo cp -f /var/www/roundcube.bak/config/config.inc.php /var/www/roundcube/config

echo
echo 'Run the update script'
sudo chown -R www-data:www-data /var/www/roundcube
sudo -u www-data /var/www/roundcube/bin/update.sh
sudo chown -R root:root /var/www/roundcube
sudo chown -R www-data:www-data /var/www/roundcube/temp

echo
echo 'Run post upgrade actions'
sudo ln -s /etc/nginx/sites-available/roundcube.conf /etc/nginx/sites-enabled/roundcube.conf
sudo systemctl reload nginx
sudo rm "roundcubemail-${version}-complete.tar.gz"
sudo rm -rf /var/www/roundcube/installer

Installation

GitHub

Bash.svg
wget https://github.com/roundcube/roundcubemail/releases/download/1.6.2/roundcubemail-1.6.2-complete.tar.gz
tar xf roundcubemail-1.6.2-complete.tar.gz
sudo mv roundcubemail-1.6.2 /var/www/roundcube
sudo chown www-data:www-data /var/www/roundcube/temp
Mariadb.svg
create database roundcube;
create user 'roundcube'@'localhost' identified by 'PassWord';
grant all on roundcube.* to 'roundcube'@'localhost';
flush privileges;
Bash.svg
# edit and add 'use roundcube;' at the beginnig of the sql script
sudo mariadb < /var/www/roundcube/SQL/mysql.initial.sql
  • setup the web configuration then go to http://roundcube.localserver/installer
Bash.svg
# when the installation is done, remove the installer folder
sudo rm -rf /var/www/roundcube/installer

APT

Bash.svg
sudo apt install roundcube roundcube-mysql
Mysql access configuration file /etc/dbconfig-common/roundcube.conf