Thorsten Zöller

Installation and Setup of the RainLoop Webmail Client on OpenBSD

2021-12-22

RainLoop is a modern, simple and rather lightweight webmail client. This article describes its installation and setup on a local OpenBSD machine and the configuration necessary for accessing a Posteo e-mail account.

Tested with OpenBSD 6.9, PHP 8.0 and RainLoop 1.16.0.

Prerequisites

On a default OpenBSD installation, only a few things are required in order to get RainLoop set up and running:

No database is required for the core functionality; it is only needed for storing contacts, which is optional.

Installation and Setup

httpd

Create an entry in /etc/httpd.conf for a HTTP server listening on localhost:8080 (of course, any other port can be specified):

server "default" {
  listen on "127.0.0.1" port 8080
  log {
    access "default-access.log"
    error "default-error.log"
  }
  root "/rainloop"
  directory index index.php
  location "/data/*" { block }
  location "*.php" {
    fastcgi socket "/run/php-fpm.sock"
  }
}

Here, it is assumed that RainLoop will be installed in /var/www/rainloop, which therefore needs to be set as the document root for the server. Also, web access to the data subdirectory must be blocked.

Start httpd(8) unless it is already running:

$ doas rcctl enable httpd
$ doas rcctl start httpd
Otherwise, simply restart it:
$ doas rcctl restart httpd

PHP

Install php(1) unless already done:

$ doas pkg_add php

Start the PHP FastCGI Process Manager (PHP-FPM):

$ doas rcctl enable php80_fpm
$ doas rcctl start php80_fpm

Install the PHP-cURL extension and make it known to PHP:

$ doas pkg_add php-curl
$ doas ln -sf /etc/php-8.0.sample/curl.ini /etc/php-8.0/

Optionally, install the corresponding PHP-PDO extension for the database to be used (in this case SQLite; other options are MySQL and PostgreSQL) and make it known to PHP:

$ doas pkg_add php-pdo_sqlite
$ doas ln -sf /etc/php-8.0.sample/pdo_sqlite.ini /etc/php-8.0/

RainLoop

Create a directory for RainLoop under /var/www:

$ doas mkdir /var/www/rainloop

Get the latest version of the RainLoop Community edition and unzip it in /var/www/rainloop:

$ doas mkdir /var/www/rainloop
$ cd /var/www/rainloop
$ doas ftp https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip
$ doas unzip rainloop-community-latest.zip
$ doas rm rainloop-community-latest.zip

Set the owner of the data subdirectory to “www”:

$ doas chown -R www data

Finally, copy /etc/resolv.conf to /var/www (otherwise, the domain names of the mail servers may not get resolved to their corresponding IP addresses):

$ mkdir -p /var/www/etc
$ doas cp /etc/resolv.conf /var/www/etc/resolv.conf

RainLoop can then be accessed via the URL localhost:8080, and it can be configured in the admin panel which can be accessed via localhost:8080?admin.

Accessing a Posteo E-Mail Account

Access to a Posteo e-mail account can be set up by creating the file /var/www/rainloop/data/_data_/_default_/domains/posteo.de.ini with the following contents:

imap_host = "posteo.de"
imap_port = 993
imap_secure = "SSL"
imap_short_login = Off
sieve_use = Off
sieve_allow_raw = Off
sieve_host = ""
sieve_port = 4190
sieve_secure = "None"
smtp_host = "posteo.de"
smtp_port = 587
smtp_secure = "TLS"
smtp_short_login = Off
smtp_auth = On
smtp_php_mail = Off

Alternatively, the account can be set up via the admin panel.

References