User Tools

Site Tools


computing:roundcube

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
computing:roundcube [2025/02/15 22:01] – created oemb1905computing:roundcube [2026/11/07 17:28] (current) – oemb1905
Line 97: Line 97:
   <$config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcube';>   <$config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcube';>
   <$config['des_key'] = 'rcmail-!24ByteDESkey*Str';?   <$config['des_key'] = 'rcmail-!24ByteDESkey*Str';?
 +  <$config['imap_host'] = 'ssl://mail.domain.com:993';>
 +  <$config['smtp_host'] = 'tls://mail.domain.com:587';>
 +  <$config['mail_domain'] = 'domain.com';>
 +  <$config['username_domain'] = 'domain.com';>
   <$config['enable_spellcheck'] = true;>   <$config['enable_spellcheck'] = true;>
  
-Change "pass" to whatever your password is. Take care not to use special characters and/or adjust the syntax accordingly to accept them. Change the destination key to something unique instead of the default. Add spell check by adding the above spell check line to the bottom of the config. You can also append more plugins at this time. Here are some common additions:+Change "pass" to whatever your password is. Take care not to use special characters and/or adjust the syntax accordingly to accept them. Change the destination key to something unique instead of the default. When specifying the imap and smtp host, make sure to prepend the tls prefix. Add spell check by adding the above spell check line to the bottom of the config. You can also append more plugins at this time. Here are some common additions:
  
 +  sudo nano config.inc.php
   $config['plugins'] = [   $config['plugins'] = [
     'archive',     'archive',
Line 136: Line 141:
   ];   ];
  
 +Alright, the basic configuration is now done. I can send and receive emails using jonathan@domain.com, with full health spf, dkim, and appropriate dmarc setup. To update:
  
 +<code>
 +cd /var/www
 +wget https://github.com/roundcube/roundcubemail/releases/download/1.6.15/roundcubemail-1.6.15-complete.tar.gz
 +tar xvf roundcubemail-1.6.15-complete.tar.gz
 +rm roundcubemail-1.6.15-complete.tar.gz
 +rm -f roundcube
 +ln -s roundcubemail-1.6.15 roundcube
 +cp roundcubemail-1.6.10/config/config.inc.php roundcube/config/config.inc.php
 +chown root:root -R roundcube
 +chown www-data:www-data roundcube/temp roundcube/logs -R
 +systemctl restart apache2 php8.4-fpm
 +</code>
  
- --- //[[alerts@haacksnetworking.org|oemb1905]] 2025/02/15 21:42//+After update, you might need to update db tables or what not. Check the forums. Here's a 1.6 to 1.7 change and the script that roundcube provided to update the db:
  
 +  cd /var/www/roundcube
 +  sudo -u www-data ./bin/updatedb.sh --package=roundcube --dir=SQL
 +
 +To setup a fail2ban filter that works with this setup, use something like the following:
 +
 +<code>
 +nano /etc/fail2ban/filter.d/roundcube-haack.conf
 +[Definition]
 +failregex = ^\[\S+\s+\S+\s+\S+\]: <\S+> IMAP Error: Login failed for .* from <HOST>\..*$
 +ignoreregex =
 +</code>
 +
 +Inside jail.local or an appropriate sub-directory, enter something like:
 +<code>
 +[roundcube-haack]
 +enabled  = true
 +filter   = roundcube-haack
 +logpath  = /var/www/roundcube/logs/errors.log
 +port     = http,https
 +maxretry = 2
 +datepattern = ^\[DayMONExYear 24hour:Minute:Second
 +</code>
 +
 +This command can help during testing the jail:
 +
 +  fail2ban-client reload --restart --unban roundcube-haack
 +
 +Make sure the log directories and files exist and have proper perms:
 +
 +  mkdir -p /var/www/roundcube/logs
 +  touch /var/www/roundcube/logs/errors.log
 +  chown www-data:www-data /var/www/roundcube/logs/errors.log
 +
 +For nginx, you can use these:
 +
 +<code>
 +server {
 +    listen 80;
 +    listen [::]:80;
 +    server_name mail.domain.com;
 +    return 301 https://$host$request_uri;
 +}
 +
 +server {
 +    listen 443 ssl http2;
 +    listen [::]:443 ssl http2;
 +    server_name mail.domain.com;
 +
 +    root /var/www/roundcube/public_html;
 +    index index.php;
 +
 +    ssl_certificate     /etc/letsencrypt/live/mail.domain.com/fullchain.pem;
 +    ssl_certificate_key /etc/letsencrypt/live/mail.domain.com/privkey.pem;
 +
 +    access_log /var/log/nginx/roundcube_access.log;
 +    error_log  /var/log/nginx/roundcube_error.log;
 +
 +    location / {
 +        try_files $uri $uri/ /index.php?$query_string;
 +    }
 +
 +    # Required for 1.7+ static assets (skins, plugins, program)
 +    location ~ ^/(assets|skins|plugins|program)/ {
 +        try_files $uri /static.php?$args;
 +    }
 +
 +    location ~ \.php(?:$|/) {
 +        fastcgi_split_path_info ^(.+\.php)(/.+)$;
 +        include snippets/fastcgi-php.conf;
 +        fastcgi_pass unix:/run/php/php8.4-fpm.sock;
 +        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 +        fastcgi_param PATH_INFO $fastcgi_path_info;
 +        include fastcgi_params;
 +    }
 +
 +    # Lock down installer after setup - UNLOCK / COMMENT OUT when fixing
 +    #location ~ ^/(installer|SQL)/ {
 +    #    deny all;
 +    #}
 +
 +    location ~ /\.ht {
 +        deny all;
 +    }
 +}
 +</code>
 +
 +And for fail2ban:
 +
 +<code>
 +nano /etc/fail2ban/filter.d/roundcube-haack.conf
 +[Definition]
 +failregex = ^<HOST> .* "POST /.*\?_task=login HTTP.*" 401
 +            ^<HOST> .* "POST /index\.php\?_task=login HTTP.*" 401
 +            ^<HOST> .* "POST /.* HTTP.*" 401
 +ignoreregex =
 +</code>
 +
 +<code>
 +nano /etc/fail2ban/jail.local
 +[roundcube-haack]
 +enabled  = true
 +port     = http,https
 +filter   = roundcube-haack
 +logpath  = /var/log/nginx/roundcube_access.log
 +maxretry = 2
 +</code>
 +
 + --- //[[alerts@haacksnetworking.org|oemb1905]] 2026/11/07 17:19//
computing/roundcube.1739656892.txt.gz · Last modified: by oemb1905