0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

Merge master into staging-next

This commit is contained in:
github-actions[bot] 2024-10-20 06:04:33 +00:00 committed by GitHub
commit c38df14dc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 2953 additions and 398 deletions

View file

@ -245,6 +245,7 @@ in {
curl-impersonate = handleTest ./curl-impersonate.nix {};
custom-ca = handleTest ./custom-ca.nix {};
croc = handleTest ./croc.nix {};
cyrus-imap = runTest ./cyrus-imap.nix;
darling = handleTest ./darling.nix {};
darling-dmg = runTest ./darling-dmg.nix;
dae = handleTest ./dae.nix {};

120
nixos/tests/cyrus-imap.nix Normal file
View file

@ -0,0 +1,120 @@
{ lib, pkgs, ... }:
{
name = "cyrus-imap";
meta = {
maintainers = with lib.maintainers; [ moraxyc ];
};
nodes.machine =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
curl
sudo
];
services.saslauthd = {
enable = true;
config = ''
DESC="SASL Authentication Daemon"
NAME="saslauthd"
MECH_OPTIONS=""
THREADS=5
START=yes
OPTIONS="-c -m /run/saslauthd"
'';
};
services.cyrus-imap = {
enable = true;
cyrusSettings = {
START = {
recover = {
cmd = [
"ctl_cyrusdb"
"-r"
];
};
};
EVENTS = {
tlsprune = {
cmd = [ "tls_prune" ];
at = 400;
};
delprune = {
cmd = [
"cyr_expire"
"-E"
"3"
];
at = 400;
};
deleteprune = {
cmd = [
"cyr_expire"
"-E"
"4"
"-D"
"28"
];
at = 430;
};
expungeprune = {
cmd = [
"cyr_expire"
"-E"
"4"
"-X"
"28"
];
at = 445;
};
checkpoint = {
cmd = [
"ctl_cyrusdb"
"-c"
];
period = 30;
};
};
SERVICES = {
http = {
cmd = [ "httpd" ];
listen = "80";
prefork = 0;
};
imap = {
cmd = [ "imapd" ];
listen = "143";
prefork = 0;
};
lmtpunix = {
cmd = [ "lmtpd" ];
listen = "/run/cyrus/lmtp";
prefork = 0;
};
notify = {
cmd = [ "notifyd" ];
listen = "/run/cyrus/notify";
proto = "udp";
prefork = 0;
};
};
};
};
};
testScript = ''
machine.wait_for_unit("saslauthd.service")
machine.wait_for_unit("cyrus-imap.service")
machine.wait_for_open_port(80)
machine.wait_for_open_port(143)
machine.succeed("echo 'secret' | ${lib.getExe' pkgs.cyrus_sasl.bin "saslpasswd2"} -p -c cyrus")
machine.succeed("chown cyrus /etc/sasldb2")
machine.succeed("sudo -ucyrus curl --fail --max-time 10 imap://cyrus:secret@localhost:143")
machine.fail("curl --fail --max-time 10 imap://cyrus:wrongsecret@localhost:143")
machine.fail("curl --fail --max-time 10 -X PROPFIND -H 'Depth: 1' 'http://localhost/dav/addressbooks/user/cyrus@localhost/Default'")
'';
}