Rename extraVirtualAliases to aliases and update description

The extra and virtual parts are redundant and Postfix specific and not
at all required. Compare forwards for example.
This commit is contained in:
Martin Weinelt
2026-03-23 00:03:41 +01:00
parent 23364b04e8
commit 31c7607ef4
5 changed files with 18 additions and 19 deletions
+11 -12
View File
@@ -649,7 +649,7 @@ in
''; '';
}; };
extraVirtualAliases = mkOption { aliases = mkOption {
type = type =
let let
loginAccount = mkOptionType { loginAccount = mkOptionType {
@@ -660,7 +660,6 @@ in
with types; with types;
attrsOf (either loginAccount (nonEmptyListOf loginAccount)); attrsOf (either loginAccount (nonEmptyListOf loginAccount));
example = { example = {
"info@example.com" = "user1@example.com";
"postmaster@example.com" = "user1@example.com"; "postmaster@example.com" = "user1@example.com";
"abuse@example.com" = "user1@example.com"; "abuse@example.com" = "user1@example.com";
"multi@example.com" = [ "multi@example.com" = [
@@ -669,15 +668,14 @@ in
]; ];
}; };
description = '' description = ''
Virtual Aliases. A virtual alias `"info@example.com" = "user1@example.com"` means that Aliases are additional mail addresses routed to one or more existing local accounts.
all mail to `info@example.com` is forwarded to `user1@example.com`. Note
that it is expected that `postmaster@example.com` and `abuse@example.com` is The target accounts are allowed to use the alias as the sender address.
forwarded to some valid email address. (Alternatively you can create login
accounts for `postmaster` and (or) `abuse`). Furthermore, it also allows :::{note}
the user `user1@example.com` to send emails as `info@example.com`. This feature is limited to local accounts and does not support LDAP or
It's also possible to create an alias for multiple accounts. In this other external accounts.
example all mails for `multi@example.com` will be forwarded to both :::
`user1@example.com` and `user2@example.com`.
''; '';
default = { }; default = { };
}; };
@@ -692,7 +690,7 @@ in
the value `{ "user@example.com" = "user@elsewhere.com"; }` the value `{ "user@example.com" = "user@elsewhere.com"; }`
means that mails to `user@example.com` are forwarded to means that mails to `user@example.com` are forwarded to
`user@elsewhere.com`. The difference with the `user@elsewhere.com`. The difference with the
{option}`mailserver.extraVirtualAliases` option is that `user@elsewhere.com` {option}`mailserver.aliases` option is that `user@elsewhere.com`
can't send mail as `user@example.com`. Also, this option can't send mail as `user@example.com`. Also, this option
allows to forward mails to external addresses. allows to forward mails to external addresses.
''; '';
@@ -1681,5 +1679,6 @@ in
[ "mailserver" "ldap" "postfix" "mailAttribute" ] [ "mailserver" "ldap" "postfix" "mailAttribute" ]
[ "mailserver" "ldap" "attributes" "mail" ] [ "mailserver" "ldap" "attributes" "mail" ]
) )
(mkRenamedOptionModule [ "mailserver" "extraVirtualAliases" ] [ "mailserver" "aliases" ])
]; ];
} }
+3 -3
View File
@@ -68,9 +68,9 @@ complicate the setup significantly.
- Use of ``homeDirectory``, ``uid``, ``gid`` LDAP attributes (we are - Use of ``homeDirectory``, ``uid``, ``gid`` LDAP attributes (we are
committed to a virtual setup with one vmail user/uid/gid and UUID based home committed to a virtual setup with one vmail user/uid/gid and UUID based home
directories) directories)
- Declarative aliases through :option:`mailserver.extraVirtualAliases`. These - Declarative aliases through :option:`mailserver.aliases`. These are limited
are limited to local accounts, because Postfix enforces sender ownership based to local accounts, because Postfix enforces sender ownership based on login
on login identity and does not consult virtual aliases for authorization. identity and does not consult virtual aliases for authorization.
Enabling LDAP support Enabling LDAP support
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
+1 -1
View File
@@ -94,7 +94,7 @@ let
mergeLookupTables lookupTables; mergeLookupTables lookupTables;
# extra_valiases_postfix :: Map String [String] # extra_valiases_postfix :: Map String [String]
extra_valiases_postfix = attrsToLookupTable cfg.extraVirtualAliases; extra_valiases_postfix = attrsToLookupTable cfg.aliases;
# forwards :: Map String [String] # forwards :: Map String [String]
forwards = attrsToLookupTable cfg.forwards; forwards = attrsToLookupTable cfg.forwards;
+2 -2
View File
@@ -85,7 +85,7 @@
}; };
}; };
extraVirtualAliases = { aliases = {
"single-alias@example.com" = "user1@example.com"; "single-alias@example.com" = "user1@example.com";
"multi-alias@example.com" = [ "multi-alias@example.com" = [
"user1@example.com" "user1@example.com"
@@ -494,7 +494,7 @@
# if this succeeds, it means that user1 received the mail that was intended for chuck. # if this succeeds, it means that user1 received the mail that was intended for chuck.
client.fail("fetchmail --nosslcertck -v") client.fail("fetchmail --nosslcertck -v")
with subtest("extraVirtualAliases"): with subtest("Test sending from alias address (mailserver.aliases)"):
client.execute("rm ~/mail/*") client.execute("rm ~/mail/*")
# send email from single-alias to user1 # send email from single-alias to user1
client.succeed( client.succeed(
+1 -1
View File
@@ -127,7 +127,7 @@ in
localDnsResolver = false; localDnsResolver = false;
indexDir = "/var/lib/dovecot/indices"; indexDir = "/var/lib/dovecot/indices";
extraVirtualAliases = { aliases = {
# Steal frank@example.com from LDAP user frank # Steal frank@example.com from LDAP user frank
"frank@example.com" = "mallory@example.com"; "frank@example.com" = "mallory@example.com";
}; };