Squirrelmail

(:redirect Squirrelmail.Install:)

For the application to work, the mail system must already be configured and started on the server.

Create a new subdomain to host the application

[=

/var/nsd/zones/master/example.com.zone:

; webmail service

webmail A 10.10.10.10

webmail AAAA 2605:6400:30:faa1::

doas rcctl -d restart nsd

doas rcctl -d restart unbound

=]

Creating a new virtual host where applications will be hosted'

[=

/etc/httpd.conf:

server "webmail.example.com.zone" {

    listen on * port 80

    #listen on * tls port 443

    #tls {

    #       certificate "/etc/ssl/webmail.example.com.fullchain.pem"

    #       key "/etc/ssl/private/webmail.example.com.org.key"

    #}

    directory index index.php

    root "/htdocs/webmail"

    location "/class/*" {

            block return 403

    }

    location "/config/*" {

            block return 403

    }

    location "/contrib/*" {

            block return 403

    }

    location "/data/*" {

            block return 403

    }

    location "/doc/*" {

            block return 403

    }

    location "/functions/*" {

            block return 403

    }

    location "/help/*" {

            block return 403

    }

    location "/include/*" {

            block return 403

    }

    location "/locale/*" {

            block return 403

    }

    location "/po/*" {

            block return 403

    }

    location "/.well-known/acme-challenge/*" {

            root "/acme"

            request strip 2

    }

    location "*.php" {

            fastcgi socket "/run/php-fpm.sock"

    }

    log access "webmail_access.log"

    log error "webmail_error.log"

}

=]

doas rcctl -d restart httpd

Configuring the certificate generation service

[=

/etc/acme-client.conf:

domain webmail.example.com {

    domain key "/etc/ssl/private/webmail.example.com.key"

    domain certificate "/etc/ssl/webmail.example.com.crt"

    domain full chain certificate "/etc/ssl/webmail.example.com.fullchain.pem"

    sign with letsencrypt

    challengedir "/var/www/acme"

}

=]

doas acme-client -Fv webmail.example.com

(!)you must set new certs to virtual host config and restart httpd again

Creating an environment for the application to work

[=

doas mkdir /var/www/webmail

doas mkdir /var/www/webmail/data

doas mkdir /var/www/webmail/attachments

doas chown www:www /var/www/webmail

doas chown www:www /var/www/webmail/data

doas chown www:www /var/www/webmail/attachments

doas chmod 700 /var/www/webmail

doas chmod 700 /var/www/webmail/data

doas chmod 700 /var/www/webmail/attachments

=]

Installing the application on the server

[=

cd ~/

wget https://sourceforge.net/projects/squirrelmail/files/stable/1.4.22/squirrelmail-webmail-1.4.22.tar.gz

tar -xvzf squirrelmail-webmail-1.4.22.tar.gz

doas cp -r squirrelmail-webmail-1.4.22/ /var/www/htdocs/webmail/

cd /var/www/htdocs/

doas chown root:bin webmail

doas find ./webmail -type d -exec chmod 755 {} \;

doas find ./webmail -type f -exec chmod 644 {} \;

doas rm /var/www/htdocs/webmail/README

doas rm /var/www/htdocs/webmail/configure

=]

PHP 7 compatibility fix

[=

functions/global.php (451):

function sqsession_is_active() {

if (session_status() === PHP_SESSION_ACTIVE) { return; }

sqsession_start();

}

=]

Configuring

[=

doas touch /var/www/htdocs/webmail/config/config.php

doas chown www:www /var/www/htdocs/webmail/config/config.php

doas chmod 400 /var/www/htdocs/webmail/config/config.php

=]

config.php.zip