On Wed, Dec 24, 2025 at 11:16:19AM +0000, Mea Para via Postfix-users wrote:
> A network interface is not a network address.
As noted by Wietse, the parameter name is a legacy from ~1998, and it is
rather late to change that. It is one of the most inportant Postfix
parameters, described in books, HOWTO guides, and explicitly set in
many users' main.cf files.
> Re implementation of the solution,
>
> The project "unbound", for example, includes the code that can be
> reused to solve the problem in postfix. This is a pointer to the code.
The only "problem" here is a name that at first sight one find
misleading. The parameter would with 20/20 hindsight be called
something like "inet_interface_addresses", "own_ip_addresses", ...
(In a multi-instance configuration, the host's IP addresses may
partitioned across separate Postfix instances).
Postfix already has the requisite code to compute (all, or all-loopback)
interface addresses at process start time. Support for host names and
literal addresses rather than interface names in $inet_interfaces was a
design choice, not an accident, or lack of knowledge about how to write
the requisite code.
If the interface IP addresses you want Postfix to listen on are not
stable across Postfix restarts, your start script can determine the
address and modify main.cf before executing "postfix start".
On a typical Linux machine that could be:
$ ifaddrs() {
ip -j addr list dev "$@" |
jq -r '.[].addr_info[].local | select(.)'
}
$ ifaddrs lo
127.0.0.1
::1
$ ifaddrs enp3s0 | sed 's/[0-9a-f]/X/ig'
XXX.XXX.XX.XXX
XXXX:XXXX:XXXX::X
XXXX::XXXX:XXXX:XXXX:XXXX
$ ifaddrs enp3s0 scope global | sed 's/[0-9a-f]/X/ig'
XXX.XXX.XX.XXX
XXXX:XXXX:XXXX::X
If you want just the IPv4 or IPv6 addresses, you can use the
"-4" or "-6" options of ip(8), or do the filtering with `jq`.
--
Viktor. 🇺🇦 Слава Україні!
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]