Koozali.org: home of the SME Server

How can I enable mail relay from the router/gateway

Offline alex_rhys-hurn

  • **
  • 29
  • +0/-0
How can I enable mail relay from the router/gateway
« on: January 17, 2008, 08:21:28 AM »
So, it seems that SME does not allow email relay when the source IP address matches the Gateway or router address set in SME. It even does not allow this if using secure SMTPD port 465 and SSL.

I can understand this and normally this is cool. But today I have a different need.

I am using SME server to handle mail for a small hotspot scenario, and the hotspot software is NATTING the users on the router which the SME server uses, so it appears that all emails from the networks listed as local networks come from the gateway. and so it goes and blocks them.

So I would like to enable relay from the gateway.

I have found this fragment:

/etc/e-smith/templates-custom/var/service/qpsmtpd/config/norelayclients/20norelayFromRouter

Code: [Select]
{
    return '' unless $GatewayIP;

    # we allow access from the router, but we do not allow relaying
    return $GatewayIP;
}

So it occurs to me that if I create a custom template for this I can change the behaviour. Trouble is I dont know anything about perl and cant figure how to edit this template.

Please can somebody help me to edit this template to ALLOW relay from the gateway?

Rgds

Alex

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: How can I enable mail relay from the router/gateway
« Reply #1 on: January 17, 2008, 06:05:18 PM »
I have found this fragment:

/etc/e-smith/templates-custom/var/service/qpsmtpd/config/norelayclients/20norelayFromRouter

No, actually you found:

/etc/e-smith/templates/var/service/qpsmtpd/config/norelayclients/20norelayFromRouter

Quote
Please can somebody help me to edit this template to ALLOW relay from the gateway?

An empty file will do what you want. But DO NOT DO THAT
unless you are absolutely certain that Internet connections are not also NATTED via that router. If you create an open mail relay you can be certain that it will be found, and will be exploited by spammers.

Find another solution to your problem. You can probably reconfigure the router so that it only routes and does not NAT.
« Last Edit: January 17, 2008, 06:08:41 PM by CharlieBrady »

Offline alex_rhys-hurn

  • **
  • 29
  • +0/-0
Re: How can I enable mail relay from the router/gateway
« Reply #2 on: January 17, 2008, 06:47:41 PM »
Hi there.

Thanks for the reply.

Your right, I pasted what I was PLANNING to put as a custom template...... Thanks for point out my error.

OK. So this is the single little guy that prevents open relay. Hmmm.... Your right we dont want to make an open relay...

Changing the router config is not going to be that easy.  I will have to re-think this.

Thank you.

Alex


Offline alex_rhys-hurn

  • **
  • 29
  • +0/-0
Re: How can I enable mail relay from the router/gateway
« Reply #3 on: January 17, 2008, 06:48:20 PM »
Hi again,

Is it not possible to allow ONLY authenticated SSL smtp from the gateway?

Rgds

Alex

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: How can I enable mail relay from the router/gateway
« Reply #4 on: January 17, 2008, 07:29:39 PM »
Is it not possible to allow ONLY authenticated SSL smtp from the gateway?

Allowing authenticated SSL smtp from anywhere (including the gateway) is already a standard feature.

Offline alex_rhys-hurn

  • **
  • 29
  • +0/-0
Re: How can I enable mail relay from the router/gateway
« Reply #5 on: January 17, 2008, 08:10:48 PM »
So why do I get relay denied messages when I tail the /var/log/qpsmtpd/current file when sending? The messages immediately come back with a Error 550 Relay Access Denied.

By the way, I should say that my senders may have their own email accounts elsewhere and simply want to relay through that server. This works perfectly from the primary local netowrk, but not at all from other local networks I have configered, as they appear to come from the gateway.

Rgds

Alex

Offline brianr

  • *
  • 990
  • +2/-0
Re: How can I enable mail relay from the router/gateway
« Reply #6 on: January 23, 2008, 11:34:19 AM »
This also is a problem when you try to use the router facility to email router logs (the server needs to be in server only mode for this to work as well).  Using an outside email server is not possible in my case as the outside email server needs to be authenticated (it is the UK BT system), and the router does not support authenticated email sending. 
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........