SMTP Relay for particular ip's

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
DMRDave
Posts: 49
Joined: Fri Sep 12, 2014 10:05 pm

SMTP Relay for particular ip's

Post by DMRDave »

Hi. I'm trying to allow smtp relay for one ip address. I've edited the main.cf file in /opt/zimbra/postfix/conf. Once i add the ip to mynetworks = and restart postfix, the zimbra webmail stops functioning. if i remove the mynetworks line from main.cf, the webmail works again.
Reading the forums, i used the following post as examples.

http://www.zimbra.com/forums/showthread ... ight=relay


I">http://www.zimbra.com/forums/showthread ... mynetworks
I tried the zmprov mcf zimbraMtaMyNetworks command which also stopped the webmail from functioning. I see the edit it makes in main.cf but when i remove the edit and restart postfix, the mynetworks edit reappears in main.cf.
So my question is two fold, 1. How do i undo my zmprov mcf zimbraMtaMyNetworks command, and 2. how can i allow relay from one public ip while keeping webmail functionality? Also, is it necessary to include the netmask with the ip, or can i just specify a single ip address? Thank you for any assistance.
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

SMTP Relay for particular ip's

Post by marcmac »

[quote user="DMRDave"]Hi. I'm trying to allow smtp relay for one ip address. I've edited the main.cf file in /opt/zimbra/postfix/conf. Once i add the ip to mynetworks = and restart postfix, the zimbra webmail stops functioning. if i remove the mynetworks line from main.cf, the webmail works again.
Reading the forums, i used the following post as examples.

http://www.zimbra.com/forums/showthread ... ight=relay


I">http://www.zimbra.com/forums/showthread ... mynetworks
I tried the zmprov mcf zimbraMtaMyNetworks command which also stopped the webmail from functioning. I see the edit it makes in main.cf but when i remove the edit and restart postfix, the mynetworks edit reappears in main.cf.
So my question is two fold, 1. How do i undo my zmprov mcf zimbraMtaMyNetworks command, and 2. how can i allow relay from one public ip while keeping webmail functionality? Also, is it necessary to include the netmask with the ip, or can i just specify a single ip address? Thank you for any assistance.[/QUOTE]
1 - zmprov mcf zimbraMtaMyNetworks ''

2 - postconf mynetworks
Add new.network.ip.range to the end of the return value from the postconf command, and set zimbraMtaMyNetworks to that value
DMRDave
Posts: 49
Joined: Fri Sep 12, 2014 10:05 pm

SMTP Relay for particular ip's

Post by DMRDave »

Is that one quote (") on the end of #1?
DMRDave
Posts: 49
Joined: Fri Sep 12, 2014 10:05 pm

SMTP Relay for particular ip's

Post by DMRDave »

Doing #1 gives me this in my main.cf after a postfix reload.
mynetworks = ?
And the webmail doesn't work. I'm just trying to get back to where I started where my main.cf file had no mention of mynetworks. Thanks.
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

SMTP Relay for particular ip's

Post by marcmac »

Actually, it's two single quotes.
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

SMTP Relay for particular ip's

Post by marcmac »

Instead of clearing it, and requerying, you can get the default this way:
postconf -d mynetworks
Then append your network to that, reset the zimbraMtaMyNetworks attribute, and restart postfix.
DMRDave
Posts: 49
Joined: Fri Sep 12, 2014 10:05 pm

SMTP Relay for particular ip's

Post by DMRDave »

[quote user="marcmac"]Then append your network to that, reset the zimbraMtaMyNetworks attribute, and restart postfix.[/QUOTE]
Sorry Marc, I'm new to postfix. What do you mean by append my network to the values given by postconf -d mynetworks and reset the zimbraMtaMyNetworks attribute?
zimbra@dmrmail01:~> postconf -d mynetworks

mynetworks = 127.0.0.0/8 69.28.108.0/27
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

SMTP Relay for particular ip's

Post by marcmac »

What IP do you want to relay mail for?
If it's 1.2.3.4, set zimbraMtaMyNetworks:
zmprov mcf zimbraMtaMyNetworks "127.0.0.0/8 69.28.108.0/27 1.2.3.4/32"
DMRDave
Posts: 49
Joined: Fri Sep 12, 2014 10:05 pm

SMTP Relay for particular ip's

Post by DMRDave »

Thanks alot Marc. I got things working with your help. 'preciate it much.
akshaymau
Posts: 1
Joined: Tue Apr 17, 2018 8:45 pm

Re: SMTP Relay for particular ip's

Post by akshaymau »

I am using zimbra 8.8.6 mail server. And I have set the relay IP on zimbra Relay Host, but I am not able to remove the configured relay IP from the zimbra server???

I have used the following commands :

zmprov ms <HOSTNAME> zimbraMtaRelayHost <IP>
echo <RELAYHOST> username:password > /opt/zimbra/conf/relay_password
postmap -q mail.mahagenrelay.com /opt/zimbra/conf/relay_password
zmprov ms <HOSTNAME> zimbraMtaMyNetworks <IP>
zmmtactl restart
Post Reply