On Sun, Jan 21, 2024 at 07:21:26PM +0100, Simon Hoffmann via Postfix-users
wrote:
> The old virtual_domains file just lists all domains (one per line), and can
> directly be used in
> virtual_alias_domains.
You're going about this the wrong way, by tryign to translate low-level
artefacts from one system to somewhat related, but different low-level
artefacts in Postfix. Instead you need to implement a functional at a
higher layer.
Postfix support virtual alias rewriting (for all envelope recipient
addresses), and virtual alias domains (which make rewriting mandatory,
since there are no actual mailbox recipients in the domain, just aliases
to mailboxes in *other* domains).
You need to read and understand:
- ADDRESS_CLASS_README
- ADDRESS_REWRITING_README
- The virtual(5) manpage
- The postconf(5) descriptions of:
* virtual_alias_domains
* virtual_alias_maps
DO NOT use the deprecated "virtual_domains" parameter, it mixes
classification of domains with address mappings.
> However, in my virtual aliases table on OpenSMTPd, I have the following
> line-types
It is best to not use the same terminology for two different things.
Instead let go of the old terminology and focus on function.
> [email protected] simon
>
> The first line is obvious. Mail addressed to the email address is delivered
> to the
> UNIX user.
This is an address mapping, best practice is to also specify a domain on
the RHS, which by default gets qualified with "@$myorigin", but if you
have a specific domain in mind, specify it here.
Actually to simon@$myorigin, which may or may not go to the UNIX user,
depending on how that's handled.
> @list.simonhoffmann.net simon
>
> The second line is also obvious, as this is a catchall for a domain. In
> Postfix this
> has also the lowest priority so I don't break my current alias file.
Catchalls are best avoided. If you have a specific list of valid
addresses, best to specify each one.
> simon simon
> For the third line, the documenation under
> http://www.postfix.org/virtual.5.html
> specifies
You're looking at the wrong documentation, that line from OpenSMTPD,
what is supposed to achieve? Then figure out whether it is needed,
and how to get equivalent *functionality* (not syntax) from Postfix.
> So I am not sure if this would work and the third line would be an accepted
> line or
> if I need to replace this line with a user@domain line for every virtual
> domain.
What is the "simon" entry supposed to achieve? How does it augment the
functionality of the first line?
> [email protected] /dev/null
> The fourth line in the old alias file silently discard a mail.
Postfix virtual(5) aliases are (rfc822) address-to-address mappings.
You cannot use "/dev/null" or similar here. That's a feature of local
aliases(5). But far better:
valias:
[email protected] [email protected]
transport:
discard.invalid discard:silently
master.cf
# Should already have a "discard" transport
> OpenSMTPd allows the right hand site to be either a unix user, a
> different email address or simply a path to a file to which it will
> append the new email.
That's what local aliases do in Postfix, but best to avoid the legacy
Sendmail-compatible local delivery agent as much as possible. Use it
only for outbound delivery to mailing lists, where "owner-alias" and
":include:/member-file", ... are useful features.
For address-to-address rewriting use virtual(5).
> Thus /dev/null on the right hand site would mark the email as
> successfully received to the sending server, but then discards the
> mail internally. Is this possible with postfix as well?
See above.
> [email protected] error:550 no spam here!
>
> Lastly, the fifth line bounces the email with the given error code and
> the given message. I have used this to disable specific address on an
> otherwise catch all domain. The spam example above is only an example,
> I have used this for address that were previously used but are not any
> longer and I would like the sender to know that this address is no
> longer in use. Is something like this possible as well?
This goes in the transport(5) file, better as:
[email protected] error:5.1.1 Mailbox unavailable
and/or an access(5) table with "check_recipient_access":
main.cf:
indexed = ${default_database_type}:${config_directory}/
transport_maps = ${indexed}transport
smtpd_recipient_restrictions =
check_recipient_access ${indexed}rcpt-access,
permit_mynetworks,
reject_unauth_destination,
...
rcpt-access:
[email protected] REJECT 5.1.1 Mailbox unavailable
> And then I have read the following in the documentation:
>
> /etc/postfix/virtual:
> virtual-alias.domain anything (right-hand content does not
> matter)
That's backwards compatibilty with the legacy "virtual_domains"
parameter, which you won't use. :-)
--
Viktor.
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]