R
R
Roman2017-09-26 15:41:58
PHP
Roman, 2017-09-26 15:41:58

How to set up an smtp proxy balancer with login spoofing?

Hello!
There are several mail servers like `mail{N}.example.com` (I don't have access to them) and users with mail clients and their accounts. It is necessary to put a proxy balancer `mb.example.com` between users and servers (replacing the server address on clients).
I used this solution on nginx + auth_http . However, the difficulty is that the backends have different login formats (IAFedorov, ia_fedorov, etc.), but I don’t see anything about login in the article - only ip/port.
In addition, when I try to send an email, I get the response "550 relay access denied - please authenticate".
What am I doing wrong?
nginx config:

mail {
    auth_http  mb.example.com:80;
    server {
        server_name     mb.example.com;
        listen          25;
        protocol        smtp;
        proxy           on;
        proxy_pass_error_message on;
        smtp_auth       login plain;
        xclient         off;
    }
}

Test auth script (with valid data from one of the servers):
<?php
header('Auth-Status: OK');
header('Auth-Server: 11.22.33.44');
header('Auth-Port: 25');
header('Auth-User: some_username');
header('Auth-Pass: some_password');

update. Also, I tried setting up an SMTP relay using postfix .
Having replaced all the settings from Mailgun with those provided by my servers, it was possible to send the letter locally. However, when sending "from outside" with my server, I got the error "454 4.7.1 Relay access denied". In the logs entry:
Sep 26 09:55:42 username postfix/smtpd[7865]: NOQUEUE: reject: RCPT from unknown[11.22.33.44]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<[127.0.0.1]>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-08-06
@TrogWarZ

If I understand the task correctly, do I need clients to get to "their" backends through smtp-proxy?
The option in postfix is ​​called transport_maps.
Here is an excerpt from the documentation
# The optional transport(5) table specifies a mapping from
# email addresses to message delivery transports and next-
# hop destinations. Message delivery transports such as
# local or smtp are defined in the master.cf file, and next-
# hop destinations are typically hosts or domain names. The
# table is searched by the trivial-rewrite(8) daemon.
#
And here is an example:
We make the config /etc/postfix/transport , the contents are:

[email protected] mail01.example.com
[email protected] mail02.example.com

etc.
Then we do:
postmap /etc/postfix/transport
And in the config /etc/posftix/main.cf we add something like:
transport_maps = hash:/etc/postfix/transport
Reload postfix, check, look at the logs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question