Maintained by: NLnet Labs

[Unbound-users] Modifying answer with the Python API

Ondřej Surý
Sun Nov 2 17:52:10 CET 2014


Christophe,

perhaps you can use python-ldns bindings to manipulate wireformat?

Cheers, Ondrej

On Mon, Oct 27, 2014, at 02:00, Christophe Labonne wrote:
> Bill Manning << You don't understand. It's not a problem for me as a
> client, it's a problem for me as a worker at an internet provider. I
> have to implement something totally broken because of what NTT did.
>
> Daisuke Higashi << There is one little problem though: We would have
> to write all IPv6 domains by hand in the configuration file.
>
> In the end, I found that the only way to do this is to use the Python
> API. But because Unbound doesn't offer any method to actually get the
> result of the original query, I have to wait for the
> MODULE_EVENT_MODDONE to get the result of the query and to be able to
> modify it. But then, because RRData is all in wireformat, I have to
> convert all of them by hand which will take a lot of effort to
> implement...
>
> 2014-10-25 4:11 GMT+09:00 Daisuke HIGASHI <daisuke.higashi at gmail.com>:
>> Hi, Christophe -
>>
>>
In unbound.conf:
>>
>>
private-address: ::/0
>>
private-domain: iptvf.jp
>>
private-domain: flets-east.jp
>>
>>
returns no AAAA unless query name is iptvf.jp or flets-east.jp.
>>
>>
Note that it also removes AAAA from IPv6(AAAA)-only domain name.
>>
This is slighly differs from BIND9's AAAA-ftiler's behavior.
>>
>>
Regards,
>>
--
>>
Daisuke HIGASHI
>>
>>
>>
2014-10-24 12:46 GMT+09:00 Christophe Labonne <galaf77 at gmail.com>:
>>
> Hello,
>>
>
>>
> I work for a japanese internet provider and I would like to get
> some help
>>
> with the Python module I am currently working on.
>>
>
>>
> Because of the way internet works in Japan, I need to filter the DNS
>>
> requests so that it doesn't show AAAA except for a few websites
> (as such, I
>>
> can't just use the parameter in the config file).
>>
>
>>
> So I decided to build a Python module that would make it
> possible. Problem
>>
> is, it seems like I can modify the return_msg only when in event ==
>>
> MODULE_EVENT_NEW.
>>
>
>>
> I do not wish to create data from the ground up, I would just like
> to modify
>>
> the existing answer.
>>
> The only way to do that would be to create a DNSMessage during
> event ==
>>
> MODULE_EVENT_MODDONE.
>>
>
>>
> But if I do that, set_return_msg fails and returns 0.
>>
>
>>
> Is there a way to create a DNSMessage during MODULE_EVENT_MODDONE?
>>
> Or is there a way to get original data during MODULE_EVENT_NEW so
> that I can
>>
> parse it?
>>
>
>>
> I've been working on it for a day now and I just don't seem to
> find a good
>>
> way to do this.
>>
> (And yes, I know it's a weird thing to do but can't argue with the
> national
>>
> way of doing things)
>>
>
>>
> I hope you guys can give me an answer and I wish you a good day.
>>
>
>>
> Christophe
>>
>
>> > _______________________________________________
>>
> Unbound-users mailing list
>>
> Unbound-users at unbound.net
>>
> http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users
>
>
>
> --
> LABONNE Christophe
> _________________________________________________
> Unbound-users mailing list Unbound-users at unbound.net
> http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users

--
Ondřej Surý <ondrej at sury.org> Knot DNS (https://www.knot-dns.cz/) – a
high-performance DNS server


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://unbound.nlnetlabs.nl/pipermail/unbound-users/attachments/20141102/7004a91b/attachment.html>