This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help configuring DMZ Mail Server with Web mail

My Network configuration is as follows

The firewall (ASL 4.0) has three NIC's
The first NIC is connected to a Router which connects to the Internet
The second NIC connects to a DMZ
The third NIC connects to the Internal network

I have two public IP's of which one is used as the Mail Server IP. I have a registered sub domain that is used for checking mails. This sub domain has one MX record so that the mails are delivered to my Mail Server.

The Public IP's  are named as External_Mail_Interface and External_Interface

The DMZ consists of a postfix mail server and a machine that runs Symantec Anti Virus for Gateways (AV Server)

My requirements are :
a. The mail server which runs web mail needs to be accessed from the internet as well as from the internal network. Web mail should be accessed from the internet only through the mail IP.
b. All SMTP mails that come in should route through the AV Server. The AV server then delivers all mail to the mail Server after virus scanning. 
c. The AV server should be able to pick up live updates from the internet.
d. The internal network when sending mails should go through the AV Server. The internal network should be allowed POP3 and IMAP to the mail server.

Currently I have pulled the plug on the AV Server. 

My NAT rules are 
a. Source is Internal Network - > Any Destination - > Change Source to External_Int
b. Any Source - > destination is External mail Int - > Change Source to Ext Mail Int - > Change Destination to Mail Server
c. Source is Mail Server -> Any Destination - > Change Source to Ext Mail Int

The packet filter rules in given order are
a. Internal_Network__ - > any - > any -> Allow
b. Any -> Mail_Group -> Mail Server -> Allow
c. Mail Server -> Mail_Group -> Any -> Allow

where Mail_group is HTTP + HTTPS + DNS + SMTP + IMAP + POP3

The above configuration works fine as long as the AV server does not come into the network.

I have tried a lot of things for the last two weeks to route mails through the AV server. At one point I was able to send mails from the Internet through the AV server. But then I was told that the web mail was not working. Hence I rolled back the entire thing.

I need help on setting up the configuration so that the AV server comes up. My questions are

1. What should the NAT rules be changed to, so that the above mentioned requirements are met ? 
2. What should the packet filter rules be ?

Any help is greatfully accepted.

  


This thread was automatically locked due to age.
Parents
  • Sounds like you want your incoming mail messages going to the AV box, but your web mail access going to the mail server. So rather than having a single DNAT rule for all services, there should be one DNAT rule that routes SMTP to the AV, and another that routes HTTPS to the mail server...
       
  • That is perfectly right. So should I have a NAT rule that says any SMTP on the mail interface, send to the AV box. And another rule to send all other services (DNS, HTTP and HTTPS)to the DMZ network ? One thing that I am confused about is, will both the AV and Mail Server boxes need access to facilities like DNS? How to NAT the DNS or HTTP to both boxes? Also what should the packet filter rules be ? Default deny SMTP to Mail Server? And the next rule of accept SMTP to the AV Server? Will I also need packet filter rules to send packets out of the DMZ to the Internet and also from the AV server to the mail Server?  
  • Do a test from a workstation (or can you telnet from your AV server??):

    See Re: SMTP outgoing mail

    If the AV server is not delivering outbound mail and knows by IP address where the mail should get forwarded, you should not need to specify a DNS, other than for it to locate a patch server; therefore, its DNS should be set to a 'real' DNS server; but for now, try to leave it not filled in (or 127.0.0.1, if it forces you?)

    The only other reason I could think as to why your AV might need a DNS server is if it generates seperate reply messages (which are not in vogue anymore, since that tends to make a bad situation worse, what with all the spoofing and false alerts going on these days...)
  • I have checked the logs of the AV server and found the following error - Message Delivery Attempt Failed. 

    I have removed the DNS entry as well from the AV Server. I wonder if any of my packet filter rules are wrong. I tried a telnet on port 25 to the Mail server and the telnet connects to the AV Server. So I guess that part of the rule is OK. How do I now test the second part(From AV to Mail). Is a telnet from AV to Mail Server on port 25 sufficient ? I have done this and got a proper response as well.

    My allowed networks in the Mail Server are the DMZ, Internal N/w and the Ext Mail Interface.

    If I send mails using the web interface, i see that the mails are going out. So that means that the Mail Server to External world rule also works fine.  
  • OK, a telnet from AV to the mail works; now compose a test message in telnet and see what happens (if you make a typo, just start over; try to be careful...)
      
  • I did as you did. I did a telnet from the internal network to the mail server. It connected to the AV server. I entered all the SMTP commands till I got the message accepted reply. 

    But what I saw in the AV server was the same error(Message Delivery Attempt Failed  ).   
  • The test message you composed in telnet on the AV server (going to the mail server): Did it get delivered to the chosen mailbox on the mail server??
      
  • No It did not. The mail was lost without a trace.  
  • When you dialoged with the mail server, did you get the "250...OK..." messages? Unplug the mail server at off peak and try it again (i.e., check that you really are talking to the mail server you think you're talking to!).

    If all that checks, then it appears that your mail server is refusing to cooperate (because the IP address you're coming from is wrong??)
      
  • I did get the OK from the mail server. But I am not sure if the response was from the Mail Server or from the SMTP engine of the AV Server. 

    To give you some more information, in my main.cf file of the Mail Server, mynetworks= 10.10.10.0/24, 127.0.0.0/8, 172.26.200.0/24, x.y.z.122

    where
    10.10.10.0 is the DMZ
    172.26.200.0 is the internal network
    x.y.z.122 is the external static ip assigned by the ISP

    the interesting thing here is that the external ip mentioned here is not the ip through which mails are delivered. That Ip is something else altogether (x.y.z.202). I changed this entry to the mail IP and still there was no difference. 

    Is there anything else I need to check out ?  
  • So when you telnet the Mail Server from the AV Server, you are telnetting 10.10.10.whatever?
    And you tried unplugging the Mail Server before you try it one of the times, and find the telnet does not work? (and thus confirm you are dialogging with the mail server)

    If you confirm all that and it's still not delivering the message (in spite of the fact that you are getting OK acknowledgements and no error messages like "relaying not permitted..."), there is something wrong with you mail server configuration.

    You are doing the telnet to the Mail Server from the very same comupter as the AV??
  • I shall do the tests later in the evening and let you know. 

    As you suspect, If I get the message as Relaying Prohibited then what should I change in the Mail Server?  
Reply Children
  • I don't suspect it; I am just trying to come up with any possible explanation as to why the mail server is not delivering the mail. If the message does not get delivered to the box, post the SMTP dialog, using some anonomous sanitizing of the IPs and domain names...
      
  • I did the following tests
    a. telneted from the AV Server to the mail server and sent a mail to local mail box - Mail was delivered successfully
    b. Used the web interface from the internal network and sent a mail locally - Mail was delivered successfully
    c. Using the web interface sent a mail to yahoo - AV Server gave me an error "Message Delivery Failed"
    d. From Yahoo sent a mail to my office Id - AV Server gave me an error "Message Delivery Failed"
    e. Telnet from AV Server to Mail Server and sent a mail to Yahoo - Mail Server replied with queued as xxxx. But the mail was not found in the out queue of the mail server nor did it reach Yahoo.
      
  • I thought you said (a) wasn't happening; good!

    OK; so the problem is your outbound mail (SMTP);
    now we're getting somewhere!

    Does your mail server deliver directly to the Internet, or does it forward outbound mail to the AV server first?
    I asked this previously and got the impression it did not forward outbound mail to the AV server, but now I am beginning to wonder...
        
  • The mail server sends mail out to the Internet. This is how my existing configuration is. I have not changed any config in the mail server. SO I assume that it still sends mail out without looping back to the AV Server. 

    One doubt that I have is - When the mail server sends mail out it is NATted on the Ext Mail Interface. 

    The NAT is as below :

    SeE_MS Any SMTP Ext_Mail_Int (SNAT)

    Now I wonder if that is re-routing the mail back to the AV Server. Is that possible?  
  • Looks OK.

    OK, next: go to the mail server and send a test message using telnet to an external domain.
    To do so, you have to know the mail server for the domain. You can look this up by doing:

    nslookup
    set type=mx
    domain_name

    This will list out the mail server(s) for whatever domain_name is. A popular (but by no means guaranteed) conventional name is mail, so for that case you could enter

    telnet mail.domain_name 25

    If there is more than one server listed, pick the one with the lowest "preference".

    I think we have it narrowed down to:
    • The gateway on the mail server is not set to Astaro
    • The mail server's DNS is not functioning
    • Rules are blocking outbound SMTP traffic
    [/list]
  • I have checked the gateway of the Mail Server and found it to be 10.10.10.1 (This is the NIC of the DMZ on ASTARO).

    I have now come one step closer -  In the AV Server there were two input fields - 
    a. Local Routing List - Here I have given the IP of the mail server
    b. Default Routing - Here previously I had not given the Mail Server IP. Now I have. 

    Now I see that mails sent from External hosts (like say yahoo) are delivering to the Mail Server via the AV Server.

    The mails sent from the internal network are delivering to the Mail Server via the AV. But mails are not leaving the mail server. They are hanging in the queue. Now surely it has to be some rule problem.

    One more step and I guess we are done.
  • OK; do the outbound telnet mail test from the mail server and report back what happens...
      
  • I did a telnet from mail server to mx1.hotmail.com and composed a mail. I got a message as "OK queued ". No error was reported. So I  guess SMTP goes out from the mail Server to the Internet.

    Some things that I noticed :
    With the above mentioned NAT and packet filter rules (the rule set that is currently being tested), POP3 access from the internal network is very slow even for simple text messages. Many times Outlook Express gives errors like Server did not respond.

    However if I remove the NAT rule below POP3 access is fast
    Internal_Network Any SMTP AV_Server (SNAT)

    Outlook Express POP3 server is the mail Server.
      
  • Does DNS name resolution work from the mail server? (ping by fully qualified domain name or nslookup works)

    If it does, then why does the outbound telnet mail work from the mail server but the mail server's outbound processing does not? -unless the mail server is configured wrong. Is it passing outbound mail back to the AV server as opposed to directly transmitting it?

    As for the SNAT, why not do a generalized masquerade rule instead?
      
  • Name resolution works perfectly from the mail server. Because both nslookup and ping worked correctly.

    I am not sure as to why the mail is getting stuck in the mail server. I dont think it is coming back to the AV Server (else I would have got a Too Many Hops Error). I strongly believe it has something to do with the NAT rules. 

    Could you please check the NT rules and give a general set of rules so that mail from the AV Server goes to the Internet through the mail server and mail from the internet is delivered to the mail server through the AV Server. Once we have this we can work on the internal network.