Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

fake mx in xen subdomain

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


lists07 at abbacomm

Jun 12, 2008, 1:31 PM

Post #1 of 8 (848 views)
Permalink
fake mx in xen subdomain

Greetings

Since I have been playing with Xen virtualization per JMS1's web directions
at

http://www.jms1.net/xen/

I have found it to be quite excellent and interesting.

Now, lets put it to some extra use...

If we have an example domain like with DNS mx records

example.com IN MX fake1.example.com
example.com IN MX real1.example.com
example.com IN MX backup1.example.com
example.com IN MX fake2.example.com

to start - What would be the best way to setup a fake or real port 25
mailserver that all it does is reject the smtp session with the appropriate
error

It is my understanding that an unpatched qmail will not retry other MX under
certain circumstances.

Now, what I am getting at is that I do not want any sending qmail server or
any other smtp server software to get stuck and only try that ip address
forever

Im thinking if using centos5 in Xen subdomains to have backup mail servers
and some fake smtp servers too as a spam fighting tool and for data
collection towards spam fighting

- rh


kyle-qmail at memoryhole

Jun 12, 2008, 3:50 PM

Post #2 of 8 (825 views)
Permalink
Re: fake mx in xen subdomain [In reply to]

On Thursday, June 12 at 01:31 PM, quoth Robert - elists:
> If we have an example domain like with DNS mx records
>
> example.com IN MX fake1.example.com
> example.com IN MX real1.example.com
> example.com IN MX backup1.example.com
> example.com IN MX fake2.example.com
>
> to start - What would be the best way to setup a fake or real port 25
> mailserver that all it does is reject the smtp session with the appropriate
> error

Why would you want to do that?

> It is my understanding that an unpatched qmail will not retry other
> MX under certain circumstances.

Qmail's approach can be simply phrased as this:

The ONLY reason to try less-preferable MX servers is if the
most-preferable cannot be contacted.

If there are multiple MXs with the same most-preferable rating, then
qmail will randomly try each one until one of them accepts a
connection (which is exactly what the RFC says). If there is a single
most-preferable MX that resolves to multiple IP addresses, qmail will
try the IPs in the order received until one of them accepts a
connection (which is exactly what the RFC says).

The "will not retry" complaint you have heard is from people who have
set up a single most-preferable MX that accepts connections but
refuses mail. This is supposed to be some sort of brilliant anti-spam
maneuver, but it's really just a waste of bandwidth (why accept the
connection if you're just going to send an error message?).

What it boils down to is an ambiguity in the implicit penalty
associated with attempting a lower-preference MX. Some people feel
that MX ratings are intended to allow them to intentionally create
load imbalances among their servers, so that additional servers are
only used as a failover when the more preferable servers are
overwhelmed (and some think that it's a good idea to indicate being
overwhelmed by using those scarce resources to send an error message
rather than simply refuse the connection). Other people believe that
MX preferences are not intended as a poorly-designed failover
mechanism, but are instead intended as true *backup* servers---i.e.
that there's an important *reason* why the less-preferable MX is not
as preferable as the most-preferable MX and that the only reason you'd
want to not use the most-preferable MX is if it cannot be contacted
*at all*.

Unfortunately, these camps do not get along, and the RFC does not
unambiguously favor one more than the other (both can be viewed as
RFC-compliant).

> Now, what I am getting at is that I do not want any sending qmail
> server or any other smtp server software to get stuck and only try
> that ip address forever

It's easily avoided: don't set up a single most-preferable MX that
accepts connections but cannot accept email.

Before you start to play monkey games with MX entries and such, you
should spend time reading the RFCs and make sure you understand what
mail servers are required to do when delivering.

> Im thinking if using centos5 in Xen subdomains to have backup mail servers
> and some fake smtp servers too as a spam fighting tool and for data
> collection towards spam fighting

Strictly speaking, you don't need Xen or any other virtual-machine
setup just to run different servers on different IP addresses. I mean,
have fun playing around all you like, but it's absolutely unnecessary
if all you want is to set up some fake smtp servers.

~Kyle
--
It was luxuries like air conditioning that brought down the Roman
Empire. With air conditioning their windows were shut, they couldn’t
hear the barbarians coming.
-- Garrison Keillor


jms1 at jms1

Jun 12, 2008, 9:45 PM

Post #3 of 8 (808 views)
Permalink
Re: fake mx in xen subdomain [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2008-06-12, at 1631, Robert - elists wrote:
>
> Since I have been playing with Xen virtualization per JMS1's web
> directions
> at
>
> http://www.jms1.net/xen/
>
> I have found it to be quite excellent and interesting.

virtualization doesn't really have any bearing on your question, but
thanks for the plug just the same.


> If we have an example domain like with DNS mx records
>
> example.com IN MX fake1.example.com
> example.com IN MX real1.example.com
> example.com IN MX backup1.example.com
> example.com IN MX fake2.example.com

these "records" are all missing priority numbers. are they all equal
priority, or ordered in some manner?


> to start - What would be the best way to setup a fake or real port 25
> mailserver that all it does is reject the smtp session with the
> appropriate
> error

don't. it's a waste of your resources. it won't make any difference to
a spammer, he dumps a million messages into his queue and goes out for
drinks with the neighbors.


> It is my understanding that an unpatched qmail will not retry other
> MX under
> certain circumstances.

as kyle explained already, if you have non-equal priorities, qmail
will start with the lowest priority and stick with that, unless all of
the hosts with that priority value fail to answer- in that case it
will "step up" and try a hostname which has a higher priority number.

if any hosts with the lower numbered priority do answer but fail to
accept the message, it will not "step up" to the higher priority
records.


> Now, what I am getting at is that I do not want any sending qmail
> server or
> any other smtp server software to get stuck and only try that ip
> address
> forever

then make sure that whatever SMTP service they end up talking to,
accepts the messages.


> Im thinking if using centos5 in Xen subdomains to have backup mail
> servers
> and some fake smtp servers too as a spam fighting tool and for data
> collection towards spam fighting

i don't see how a "fake SMTP server" is supposed to be a spam fighting
tool, unless you want to set up a honeypot and try to gather data on
what spammers are doing- and if you're going to do that, you need to
be willing to dedicate some bandwidth to it, have enough know-how to
analyze the data properly, and take the time to do it. otherwise,
what's the point?

===

the only possible thing i can think of might be this: create a
service, not connected to qmail, but listening on tcp port 25 of an IP
address which is NOT listed as an MX target for any domain name... the
idea being that if not A or MX records point to it, then the only
people who would ever try to connect to it are people conducting port
scans... which means those IPs are some of the ones from which you
don't want to accept email.

it might look like this:

#!/bin/sh
PATH="/usr/bin:/bin:/usr/local/bin"
exec tcpserver -vR -x /etc/tcp/deny.cdb \
x.x.x.x 25 /bin/true 2>&1

where /etc/tcp/deny.cdb is built from the one line ":deny". then watch
the log file for that service, gather the IPs which try to connect,
and add them to a private blacklist. (come to think of it, that's not
a bad idea... maybe i'll do that on my own server.)

as you can see, the only software requirements are daemontools and
ucspi-tcp. it doesn't need qmail, and it certainly doesn't need xen.
you can do this on any normal machine by adding a second IP address to
the existing interface- you don't need a separate box (or a separate
xen session, same thing.)


- --------------------------------------------------------
| John M. Simpson -- KG4ZOW -- Programmer At Large |
| http://www.jms1.net/ <jms1[at]jms1.net> |
- --------------------------------------------------------
| Hope for America -- http://www.ronpaul2008.com/ |
- --------------------------------------------------------





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkhR+1oACgkQEB9RczMG/Pt39ACg/gxjBQLIALn0xAukBorPQTRz
Q68AoN+lIgPYniHVlwvzcLLOSNl0dfCl
=FiJa
-----END PGP SIGNATURE-----


lists07 at abbacomm

Jun 13, 2008, 10:05 AM

Post #4 of 8 (811 views)
Permalink
RE: fake mx in xen subdomain [In reply to]

>
> i don't see how a "fake SMTP server" is supposed to be a spam fighting
> tool, unless you want to set up a honeypot and try to gather data on
> what spammers are doing- and if you're going to do that, you need to
> be willing to dedicate some bandwidth to it, have enough know-how to
> analyze the data properly, and take the time to do it. otherwise,
> what's the point?
>
> ===
>
> the only possible thing i can think of might be this: create a
> service, not connected to qmail, but listening on tcp port 25 of an IP
> address which is NOT listed as an MX target for any domain name... the
> idea being that if not A or MX records point to it, then the only
> people who would ever try to connect to it are people conducting port
> scans... which means those IPs are some of the ones from which you
> don't want to accept email.
>
> it might look like this:
>
> #!/bin/sh
> PATH="/usr/bin:/bin:/usr/local/bin"
> exec tcpserver -vR -x /etc/tcp/deny.cdb \
> x.x.x.x 25 /bin/true 2>&1
>
> where /etc/tcp/deny.cdb is built from the one line ":deny". then watch
> the log file for that service, gather the IPs which try to connect,
> and add them to a private blacklist. (come to think of it, that's not
> a bad idea... maybe i'll do that on my own server.)
>
> as you can see, the only software requirements are daemontools and
> ucspi-tcp. it doesn't need qmail, and it certainly doesn't need xen.
> you can do this on any normal machine by adding a second IP address to
> the existing interface- you don't need a separate box (or a separate
> xen session, same thing.)
>
>
> - --------------------------------------------------------
> | John M. Simpson -- KG4ZOW -- Programmer At Large |

John, Kyle, etc...

Thank you for the replies and thoughtful info.

I am reading and digesting the info you put forth.

Ummmm sorry, I knew I forgot to put in the priority numbers

For this scenario they should not be equal and should be increasing like

example.com IN MX 1 fake1.example.com
example.com IN MX 10 real1.example.com
example.com IN MX 100 backup1.example.com
example.com IN MX 1000 fake2.example.com

my fault.

Now, the primary reason to do this is to gather some data for research and
possible implementation plus send idiot SMTP sessions that go straight for
the lowest priority MX to the floor.

One otjer reason for the question is that I know unpatched qmail has an
issue I don't fully understand (yet will soon thanks to all your replies)
that I want to make sure I address in the high priority fake MX programming.

Plus, there are other broken mail server software and I want to learn more
about their behavior as well if possible.

Being able to have data about who knocks from where. How often. Is the
location currently in RBL or other spammy / virus / spambot / whatever
category among several other things.

I figured doing it with some virtualized machines would be more money
efficient than with the hot and cold rackmount server spares we have laying
around

One person is already doing this yet I don't have admin access to his stuff.
Very early on in his deployment, when we started using his lists and
advertising him on our website, some dns and other list stuff changed and we
had to drop using him for now.

He is a bright thinker and has developed some different color lists based
upon domain and IP address and other behaviors.

Again, I don't have admin access to check all the data he gathers in a human
digestable form for research and thinking.

I know this has been somewhat beat to death in some lists and dropped to the
floor, yet unless I generate and see the data myself, I cannot let it go
quite yet.

Our spam rate to mailbox is very low.

I want it lower if at all possible. There are too many machines out there
knocking on the door that shouldn't be allowed on the property

;-)

- rh


qmail at honorablemenschen

Jun 13, 2008, 12:00 PM

Post #5 of 8 (812 views)
Permalink
RE: fake mx in xen subdomain [In reply to]

> Now, the primary reason to do this is to gather some data for research and
> possible implementation plus send idiot SMTP sessions that go straight for
> the lowest priority MX to the floor.
>
I don't understand this sentance (and I'm well versed with the SMTP
specs). Why is a mail server trying to deliver directly to the lowest
priority MX an "idiot SMTP session"? The whole purpose of sending email
is to have it delivered to the the final destination. The purpose of the
different MX priorities is to list how far from the final destination any
give mail host for the domain is located. Since it "costs" more to send a
message to a server that's "farther" from the final destination (because
it requires more server and network resources and takes longer), unless
there are other network reasons for not doing so you should _always_ try
to deliver it to the lowest MX priority (unless you've already determined
that you can't). Anything else is causing more work to be done to deliver
the message.

Now, you can argue that qmail should try other MX records if the lowest
one doesn't accept the message, but that's been done here before (many
times), and the answer is still the same: The RFC is ambiguous, and while
qmail's implementation may not be the only valid interpretation of the
spec, it IS valid, and therefore MUST be worked around if you want to
receive email from it. You may choose to configure your MX records in a
way that causes qmail to fail when delivering to it, but that's _not_
qmail's fault - it's yours. As long as qmail properly handles whatever
response you give it, it's within spec.

That being said, I totally agree with the idea that intentionally setting
up resources to waste on answering connections just to say "go away" is a
total waste. There are better ways to reduce the spam inflow (greetdelay,
gerylisting, blacklists, others - take your pick (and let's not debate
them her and now)), and none of them break qmail's ability to deliver.
Think of it this way: would you set up a separate phone line and list it
as your phone # in the phone book just to have the telemarketers and crank
calls go to it? Sounds pretty sily when you think of it that way, doesn't
it...

Josh

Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
- Layman's translation of the Laws of Thermodynamics
josh[at]honorablemenschen.com


netbeans at gatworks

Jun 13, 2008, 1:19 PM

Post #6 of 8 (811 views)
Permalink
Re: fake mx in xen subdomain [In reply to]

The purpose of the
> different MX priorities is to list how far from the final destination any
> give mail host for the domain is located. Since it "costs" more to send a
> message to a server that's "farther" from the final destination (because
> it requires more server and network resources and takes longer),

I think you should think this over. MTA's aren't too concerned with
propagation costs. Having 3 mx's, one in NYC, one on Las Vegas, and
another in Japan, does not alter MX selection. If the first MX is Las
Vegas, and you are in NYC, then your MTA will be shipping the e-mail to
Las Vegas - Even though the MX in NYC is ( 2700 miles ) closer.

It might be nice to have MX's publish their geo-spatial location so an
MTA can make a judicious ( shortest distance ) determination, but I dont
see that happening any time soon.


kyle-qmail at memoryhole

Jun 13, 2008, 1:56 PM

Post #7 of 8 (806 views)
Permalink
Re: fake mx in xen subdomain [In reply to]

On Friday, June 13 at 04:19 PM, quoth U. George:
> It might be nice to have MX's publish their geo-spatial location so
> an MTA can make a judicious ( shortest distance ) determination, but
> I dont see that happening any time soon.

The geo-spatial location is often quite irrelevant, if not downright
counter-productive. For example, for a while contacting my server in
Kansas from my office in Albuquerque meant routing packets through
Chicago, despite Chicago being farther away---if I had an alternative
server in Chicago, it might well be faster to talk to than the
geographically closer server. Network topologies are both hard to
predict and variable over time (as new links are installed, new
hardware installed, old hardware decommissioned, company relationships
change, load-balancing software and hardware adapts to load, etc.).

Estimating "cost" on networks is tricky, especially in the generic
sense.

But let's put it this way: if a given domain has multiple MX records
and some are listed as less-preferable than others, there's most
likely a *reason* for it. As senders, we cannot judge how important
that reason is or what that reason might be, all we can assume is that
there *is* a reason. The question then becomes: what should the
correct behavior be, given that you don't know how important that
reason is? I think the most logical (and safe) behavior is to assume
that the reason is very important.

~Kyle
--
It is only possible to live happily ever after on a day-to-day basis.
-- Margaret Bonnano


qmail at honorablemenschen

Jun 13, 2008, 2:32 PM

Post #8 of 8 (804 views)
Permalink
Re: fake mx in xen subdomain [In reply to]

> The purpose of the
>> different MX priorities is to list how far from the final destination
>> any
>> give mail host for the domain is located. Since it "costs" more to send
>> a
>> message to a server that's "farther" from the final destination (because
>> it requires more server and network resources and takes longer),
>
> I think you should think this over. MTA's aren't too concerned with
> propagation costs. Having 3 mx's, one in NYC, one on Las Vegas, and
> another in Japan, does not alter MX selection. If the first MX is Las
> Vegas, and you are in NYC, then your MTA will be shipping the e-mail to
> Las Vegas - Even though the MX in NYC is ( 2700 miles ) closer.
>
You misunderstood me - MXs don't care about the distance from the sender's
system, they care about the distance from the recipient's system. So an
MX with a higher priority is more hops from the final destination than one
with a lower priority. Since each hop adds to the delivery "cost",
delivering it to the system that requires the fewest hops to get the
message into the mailbox is always preferable. Using your example above,
if the LV MX is the primary, and NYC and Japan are higher priorities,
chances are that even if the mesage was delivered by your server to NYC,
it would still have to go to Vegas for final delivery. I know that in
practice this isn't always how things work (both on the sender and
recipient server's parts), but it's how the spec was originally designed.

> It might be nice to have MX's publish their geo-spatial location so an
> MTA can make a judicious ( shortest distance ) determination, but I dont
> see that happening any time soon.
>
That really only matters if you get charged for the bandwidth costs alone
each of the links that you have to travel when connecting to the target
MX. While it might make sense for someone like Google to do that sort of
thing with DNS/HTTP redirects based on where you're querying from, I don't
think that MTA-to-MTA connections really need to be as short as possible
distance-wise, unless you're on an unreliable link to begin with...

Josh

Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
- Layman's translation of the Laws of Thermodynamics
qmail[at]honorablemenschen.com

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.