Buchan,

Maybe I got the wrong end of the stick, but I thought the relevant notes in main.cf were:

# TRUST AND RELAY CONTROL

# The mynetworks parameter specifies the list of "trusted" SMTP
# clients that have more privileges than "strangers".
#
# In particular, "trusted" SMTP clients are allowed to relay mail
# through Postfix.  See the smtpd_recipient_restrictions parameter
# in file sample-smtpd.cf.
#
# You can specify the list of "trusted" network addresses by hand
# or you can let Postfix do it for you (which is the default).
#
# By default (mynetworks_style = subnet), Postfix "trusts" SMTP
# clients in the same IP subnetworks as the local machine.
# On Linux, this does works correctly only with interfaces specified
# with the "ifconfig" command.
#
# Specify "mynetworks_style = class" when Postfix should "trust" SMTP
# clients in the same IP class A/B/C networks as the local machine.
# Don't do this with a dialup site - it would cause Postfix to "trust"
# your entire provider's network.  Instead, specify an explicit
# mynetworks list by hand, as described below.

I took it that this was what was happening: postfix was adding the subnet that my ADSL IP address was on to the list of trusted hosts. Both mynetworks_style and mynetworks were commented out, as per (my) default postfix configuration. So the default values would be mynetworks_style = subnet and mynetworks = "the various subnets that the local machine is in". This appears to be confirmed by the fact that specifying "mynetworks = 192.168.1.0/24, 127.0.0.0/8, my.fixed.IP.address/32" seems to have stopped this happening.

>> my
ISP's subnet had been added as a trusted subnet, as ADSL counts as a
dialup connection, which meant that anyone on their network could relay
through my mail server.

But, who added that?

As above, I didn't change anything in main.cf. The act of configuring ADSL added the ppp0 device, and postfix looks at this information (provided by ifconfig) and deduces the local subnets. So adding the ADSL connection appears to have turned postfix into an open relay without changing anything in postfix's configuration.


drakconnect doesn't touch main.cf

Agreed. But if it doesn't, and postfix is behaving the way the notes in main.cf describe, then setting up the ADSL connection via drakconnect turns an existing default postfix configuration into an open relay ("open" is probably too strong a word, as it is not open generally, but just to anyone on the ISP's subnet, but that's still quite a lot of spammers, by the looks of things).


By default, the important postfix settings are:

$ cp /etc/postfix/main.cf.rpmnew /tmp/main.cf
$ /usr/sbin/postconf -c /tmp mynetworks inet_interfaces relay_domains
mydestination
mynetworks = 127.0.0.0/8
inet_interfaces = localhost
relay_domains = $mydestination
mydestination = $myhostname, localhost.$mydomain

Maybe my main.cf is out-of-date, then, but it definitely does not have "mynetworks = 127.0.0.0/8" as the default. To quote the notes embedded in the file again:


# You can specify the list of "trusted" network addresses by hand
# or you can let Postfix do it for you (which is the default).

And this does make more sense, to allow for the mail server to serve more than just the local machine, if you have a small local network. It just turns out to be risky if you setup ADSL.

So, by default you shouldn't even be able to get a connection to postfix
unless you have manually changed mynetworks, or used some tool which
does so. drakconnect can't take responsibility for every single possible
configuration that may depend on it's settings.

Again, agreed, if that is your default configuration for postfix. Admittedly, I did an upgrade from 9.1 to 9.2RC2, rather than a fresh install, but I just checked the main.cf.rpmnew that was created when I upgraded, and it also has the settings I describe above, rather than the ones you describe. Weird, huh?


Ideally we need a configuration tool which can find such issues, but
it's not drakconnect, and it needs to be very user friendly (and not do
things automatically). But I don't think this is your problem.

I agree that it may be too difficult for a program to deduce the appropriate settings automatically. But a warning in drakconnect at the end of the ADSL configuration process might be sensible, if there are more people than me out there with my version of the default postfix configuration file.


Maybe if you can try and find out what had changed any of the important
settings, we can take a look, but I don't see how either the default
postfix config or drakconnect are responsible.

As I say, mynetworks_style and mynetworks were commented out, which is as I have always understood their default state to be. Maybe the default has changed and I have an old default configuration, but that doesn't explain the matching rpmnew file. Could it be that some other part of the installation configuration process modifies main.cf and that this step got missed out on my machine?


I am pretty confident that the only things I changed in main.cf when I switched to ADSL (and a new ISP) were to change mydestinations to the correct list of domains I wanted to receive mail for, and, a little later, to add my ISP's relay as a relayhost (rather than sending direct), to get round the problem of some of my emails being bounced because the IP address of my mail server didn't match the mail address in DNS (I only have the one IP address, but want to be able to send from a couple of mail addresses on different domains).

I don't think either of these affects whether postfix will act as an open relay, and it was not necessary to change them to prevent the unauthorised relaying. All that was needed was setting up an appropriate mynetworks, as seems to be your default, but not mine.

Cheers,

Bruno

P.S. I just tried running the same postconf command as you on my main.cf.rpmnew. This gives mynetworks as 127.0.0.0/8, same as you, although mynetworks is commented out. The same command on my main.cf gives mynetworks of "127.0.0.0/8, 192.168.1.0/24, my.fixed.IP.address", whether or not mynetworks is commented out. The difference appears to be inet_interfaces, which is set to localhost in the rpmnew file, but is commented out (and therefore "= all") in my actual main.cf. Maybe an older configuration, I don't know. I certainly haven't changed it in a long time - I didn't even think about this setting. Would it work as a mail server sending and receiving mail for a local network if inet_interfaces were set to localhost?




Reply via email to