[Fwd: Re: Hacking the DNS Resolver]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Fwd: Re: Hacking the DNS Resolver]

infaga03
> [hidden email] wrote:
>>> [hidden email] <[hidden email]>
>>> wrote:
>>>
>>>
>>>> I'm trying to modify postfix source, in order to resolve directly some
>>>> domains.
>>>>
>>> Modifying the code for this purpose is probably overkill.  What is the
>>> exact
>>> problem you are trying to solve?  From the FAQ:
>>>
>>> ---
>>>
>>> Postfix calls the C library routines gethostbyname() and
>>> gethostbyaddr()
>>> in
>>> order to find out the SMTP client hostname. These library routines use
>>> several system configuration files in order to satisfy the request.
>>> They
>>> may
>>> in fact end up calling the DNS for reasons that are not under control
>>> by
>>> Postfix.
>>>
>>> Depending on your system, these controlling files can be named
>>> /etc/nsswitch.conf, /etc/svcorder, /etc/host.conf or otherwise. Those
>>> files
>>> specify whether the C library routines will use local /etc/hosts before
>>> or
>>> after DNS.
>>>
>>> ---
>>>
>>> Maybe you can place the hostname/IP pairs in /etc/hosts and make sure
>>> that
>>> file is queried before DNS.
>>>
>>> --
>>> Sahil Tandon <[hidden email]>
>>>
>>>
>>
>>
>> The exact problem we're trying to resolve:
>> Operation flow:
>> 1.- Extract destination from the incoming SMTP message, for example: To:
>> [hidden email]
>> 2.- Return an Specific IP & Port.
>> 3.- Forward the SMTP message to the destination IP&Port.
>>
>
> if you are about envelope recipient (RCPT TO command), then use
> transport_maps
>
> example.com                       [some.ip]:port
> [hidden email]        [another.ip]:anotherport
>
>
> do not take routing decisions based on the To: header. The To: header is
> informational only. for example, this message does not contain your
> address in its To: header, but it is delivered to you.
>
>> I've tried to modify variable nexthop from:
>> smtp_connect.c:static void smtp_connect_remote(SMTP_STATE *state, const
>> char *nexthop, char *def_service);
>>
>> but when I send a mail I mostly get a 550 error.
>>
>> I've tried also to print a debug message with msg_info before all the
>> gethostbyname() calls; but it seems that postfix isn't using this
>> function.
>>
>> Thank you again.
>>
>> Antonio G. A.
>>
>>
>
>

Thank you but what I really want is to change the desired function and
modify it by using LD_PRELOAD. So, I just need to know what is the best
function to make this change.

Thank you again!

Antonio G. A.