Questions about mynetworks_style parameter in main.cf

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about mynetworks_style parameter in main.cf

J Doe
Hello,

I have two questions regarding the “mynetworks_style” parameter in main.cf.

In man I see that the “subnet” option for “mynetworks_style” is listed as being supported in Postfix < 3.0.  Does this mean that post-Postfix 3.0 this option is deprecated ?

I also note that the “subnet” option is listed as working on Linux with the following caveat:

“On Linux, this works correctly only with interfaces specified with the ifconfig command”

With ifconfig being deprecated on Linux, does that mean that network settings specified with newer commands that replace ifconfig will not work ?

Thanks,

- J
Reply | Threaded
Open this post in threaded view
|

RE: Questions about mynetworks_style parameter in main.cf

Fazzina, Angelo
Hi,
For this part :

“On Linux, this works correctly only with interfaces specified with the ifconfig command”

I think they are saying you can find valid interface names using the ifconfig command.
The new way in RHEL 7  is  "ip addr" replaces  "ifconfig".

This:
does that mean that network settings specified with newer commands that replace ifconfig will not work ?

Sounds like a linux question and not a postfix one.
What "commands" are you referring to ?




-ANGELO FAZZINA

UITS Service Manager:
Spam and Virus Prevention
Mass Mailing
G Suite/Gmail

[hidden email]
University of Connecticut,  UITS, SSG, Server Systems
860-486-9075


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of J Doe
Sent: Monday, October 2, 2017 4:10 PM
To: [hidden email]
Subject: Questions about mynetworks_style parameter in main.cf

Hello,

I have two questions regarding the “mynetworks_style” parameter in main.cf.

In man I see that the “subnet” option for “mynetworks_style” is listed as being supported in Postfix < 3.0.  Does this mean that post-Postfix 3.0 this option is deprecated ?

I also note that the “subnet” option is listed as working on Linux with the following caveat:

“On Linux, this works correctly only with interfaces specified with the ifconfig command”

With ifconfig being deprecated on Linux, does that mean that network settings specified with newer commands that replace ifconfig will not work ?

Thanks,

- J
Reply | Threaded
Open this post in threaded view
|

Re: Questions about mynetworks_style parameter in main.cf

J Doe

> On Oct 2, 2017, at 4:17 PM, Fazzina, Angelo <[hidden email]> wrote:
>
> Hi,
> For this part :
>
> “On Linux, this works correctly only with interfaces specified with the ifconfig command”
>
> I think they are saying you can find valid interface names using the ifconfig command.
> The new way in RHEL 7  is  "ip addr" replaces  "ifconfig".
>
> This:
> does that mean that network settings specified with newer commands that replace ifconfig will not work ?
>
> Sounds like a linux question and not a postfix one.
> What "commands" are you referring to ?

Hi Angelo,

I took the part about “ifconfig” to mean that the “mynetworks_style” parameter with the “subnet” parameter would *ONLY* work if the network configuration of the server was done via “ifconfig”.

As you mention, “ip” replaces “ifconfig” so I was wondering if Postfix could still pull the network configuration if “ip” had been used to specify the network configuration

Because man also mentions that this applies to Postfix < 3.0, I was wondering if the point was moot as this is not used on Postfix 3.1 and higher ?  I also specify “mynetworks” manually, which man points out overrides “mynetworks_style”, but I ask the question to understand if I come across this on someone else’s Postfix configuration.

Thanks,

- J
Reply | Threaded
Open this post in threaded view
|

Re: Questions about mynetworks_style parameter in main.cf

Peter Ajamian
In reply to this post by J Doe
On 03/10/17 09:09, J Doe wrote:
> In man I see that the “subnet” option for “mynetworks_style” is
> listed as being supported in Postfix < 3.0.  Does this mean that
> post-Postfix 3.0 this option is deprecated ?

The full line in the docs you're referencing is:
(default: Postfix >= 3.0: host, Postfix < 3.0: subnet)

That means that the default for this changed in postfix 3.0.  It does
not refer to support for the subnet setting.

> I also note that the “subnet” option is listed as working on Linux
> with the following caveat:
>
> “On Linux, this works correctly only with interfaces specified with
> the ifconfig command”
>
> With ifconfig being deprecated on Linux, does that mean that network
> settings specified with newer commands that replace ifconfig will not
> work ?

I'm not entirely sure, but I would venture to say that it means that
ifconfig libraries are used to fetch the IPs and subnets on the system.
In linux ifconfig will only return the first address on a given
interface.  It used to be the case ages ago that if you wanted to assign
multiple addresses to an interface you would create aliases for that
interface (eg: eth0:0, eth0:1 being aliases for eth0).  ifconfig sees
those aliases as separate interfaces so it will see the additional IPs
just fine, but on newer linux the addresses are assigned via the newer
ip command to a single interface and if you query them with ifconfig
only the first will show.

Also I cannot say for certain how this affects IPv6 addresses, they do
seem to be returned correctly with ifconfig, but you'd have to check on
your own system(s) to be certain.

If you need this then you may very well be better off just dumping the
list of IPs to a file and loading them into the mynetworks setting instead.


Peter
Reply | Threaded
Open this post in threaded view
|

Re: Questions about mynetworks_style parameter in main.cf

Viktor Dukhovni

> On Oct 2, 2017, at 7:27 PM, Peter <[hidden email]> wrote:
>
>> With ifconfig being deprecated on Linux, does that mean that network
>> settings specified with newer commands that replace ifconfig will not
>> work ?
>
> I'm not entirely sure, but I would venture to say that it means that
> ifconfig libraries are used to fetch the IPs and subnets on the system.

There are no "ifconfig libraries".  There's the original socket API,
which provides the SIOCGLIFCONF, SIOCGIFCONF ioctls() to retrieve
the list of interfaces and one IP address per logical interface.

Various platforms support newer, cleaner APIs to the same ends.
The documentation of mynetworks_style may be a bit out of date,
Postfix may well by now be able to find secondary IP addresses
of interfaces, even when not associated with a separate logical
interface.

See:

https://github.com/vdukhovni/postfix/blob/master/postfix/src/util/inet_addr_local.c#L81
https://github.com/vdukhovni/postfix/blob/master/postfix/src/util/inet_addr_local.c#L102

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Questions about mynetworks_style parameter in main.cf

Peter Ajamian
On 03/10/17 16:31, Viktor Dukhovni wrote:
> Various platforms support newer, cleaner APIs to the same ends.
> The documentation of mynetworks_style may be a bit out of date,
> Postfix may well by now be able to find secondary IP addresses
> of interfaces, even when not associated with a separate logical
> interface.

So it would seem that the reference to ifconfig should be ignored at
this point and probably removed from the docs?


Peter
Reply | Threaded
Open this post in threaded view
|

Re: Questions about mynetworks_style parameter in main.cf

J Doe
In reply to this post by Peter Ajamian

> On Oct 2, 2017, at 7:27 PM, Peter <[hidden email]> wrote:
>
>> On 03/10/17 09:09, J Doe wrote:
>> In man I see that the “subnet” option for “mynetworks_style” is
>> listed as being supported in Postfix < 3.0.  Does this mean that
>> post-Postfix 3.0 this option is deprecated ?
>
> The full line in the docs you're referencing is:
> (default: Postfix >= 3.0: host, Postfix < 3.0: subnet)
>
> That means that the default for this changed in postfix 3.0.  It does
> not refer to support for the subnet setting.

Hi Peter,

Ah, you are right!  Somehow my eye missed the “default” at the beginning.  Thank you for pointing this out.

- J
Reply | Threaded
Open this post in threaded view
|

Re: Questions about mynetworks_style parameter in main.cf

J Doe
In reply to this post by Viktor Dukhovni

> On Oct 2, 2017, at 11:31 PM, Viktor Dukhovni <[hidden email]> wrote:
>
>
>>> On Oct 2, 2017, at 7:27 PM, Peter <[hidden email]> wrote:
>>>
>>> With ifconfig being deprecated on Linux, does that mean that network
>>> settings specified with newer commands that replace ifconfig will not
>>> work ?
>>
>> I'm not entirely sure, but I would venture to say that it means that
>> ifconfig libraries are used to fetch the IPs and subnets on the system.
>
> There are no "ifconfig libraries".  There's the original socket API,
> which provides the SIOCGLIFCONF, SIOCGIFCONF ioctls() to retrieve
> the list of interfaces and one IP address per logical interface.
>
> Various platforms support newer, cleaner APIs to the same ends.
> The documentation of mynetworks_style may be a bit out of date,
> Postfix may well by now be able to find secondary IP addresses
> of interfaces, even when not associated with a separate logical
> interface.

Hi Viktor,

Thank you for the clarification regarding ifconfig “libraries” and thanks for the link to the SCM - I will browse git later today.

- J