Roundcube testing on bekkalokk now working. #14

Merged
oysteikt merged 2 commits from roundcube into main 2023-11-26 05:17:29 +01:00
2 changed files with 73 additions and 24 deletions
Showing only changes of commit 2a1e649eed - Show all commits

View File

@ -1,6 +1,15 @@
{ config, values, pkgs, ... }: { config, values, pkgs, lib, ... }:
{ {
imports = [ imports = [
./roundcube.nix ./roundcube.nix
]; ];
services.nginx.virtualHosts."webmail2.pvv.ntnu.no" = {
forceSSL = true;
enableACME = true;
#locations."/" = lib.mkForce { };
locations."= /" = {
return = "301 https://www.pvv.ntnu.no/mail/";
};
};
} }

View File

@ -3,32 +3,72 @@
with lib; with lib;
let let
cfg = config.services.roundcube; cfg = config.services.roundcube;
domain = "roundcube.pvv.ntnu.no"; domain = "webmail2.pvv.ntnu.no";
in in
{ {
services.roundcube = { services.roundcube = {
enable = true; enable = true;
package = pkgs.roundcube.withPlugins (plugins: [ plugins.persistent_login plugins.thunderbird_labels plugins.contextmenu plugins.custom_from]);
dicts = with pkgs.aspellDicts; [ en en-science en-computers nb nn fr de it];
maxAttachmentSize = 20;
# this is the url of the vhost, not necessarily the same as the fqdn of the mailserver
hostName = domain;
extraConfig = '' package = pkgs.roundcube.withPlugins (plugins: with plugins; [
# starttls needed for authentication, so the fqdn required to match persistent_login
# the certificate thunderbird_labels
$config['enable_installer'] = false; contextmenu
$config['default_host'] = "ssl://imap.pvv.ntnu.no"; custom_from
$config['default_port'] = 993; ]);
#$config['smtp_server'] = "tls://smtp.pvv.ntnu.no";
#$config['smtp_port'] = 25; dicts = with pkgs.aspellDicts; [ en en-science en-computers nb nn fr de it ];
$config['smtp_server'] = "ssl://smtp.pvv.ntnu.no"; maxAttachmentSize = 20;
$config['smtp_port'] = 465; hostName = "roundcubeplaceholder.example.com";
# $config['smtp_user'] = "%u@pvv.ntnu.no";
$config['mail_domain'] = "pvv.ntnu.no"; extraConfig = ''
$config['smtp_user'] = "%u"; $config['enable_installer'] = false;
# $config['smtp_pass'] = "%p"; $config['default_host'] = "ssl://imap.pvv.ntnu.no";
$config['support_url'] = ""; $config['default_port'] = 993;
$config['smtp_server'] = "ssl://smtp.pvv.ntnu.no";
$config['smtp_port'] = 465;
$config['mail_domain'] = "pvv.ntnu.no";
$config['smtp_user'] = "%u";
$config['support_url'] = "";
'';
};
services.nginx.virtualHosts."roundcubeplaceholder.example.com" = lib.mkForce { };
services.nginx.virtualHosts.${domain} = {
locations."/roundcube" = {
tryFiles = "$uri $uri/ =404";
index = "index.php";
root = pkgs.runCommandLocal "roundcube-dir" { } ''
mkdir -p $out
ln -s ${cfg.package} $out/roundcube
''; '';
extraConfig = ''
location ~ ^/roundcube/(${builtins.concatStringsSep "|" [
# https://wiki.archlinux.org/title/Roundcube
"README"
"INSTALL"
"LICENSE"
"CHANGELOG"
"UPGRADING"
"bin"
"SQL"
".+\\.md"
"\\."
"config"
"temp"
"logs"
]})/? {
deny all;
}
location ~ ^/roundcube/(.+\.php)(/?.*)$ {
fastcgi_split_path_info ^/roundcube(/.+\.php)(/.+)$;
include ${config.services.nginx.package}/conf/fastcgi_params;
include ${config.services.nginx.package}/conf/fastcgi.conf;
fastcgi_index index.php;
fastcgi_pass unix:${config.services.phpfpm.pools.roundcube.socket};
}
'';
};
}; };
} }