[dnsdist] dnsdist 1.7 : allow only A request
david.neau at orange.com
david.neau at orange.com
Mon Mar 13 13:38:37 UTC 2023
Hello Jacob,
I did this :
addAction(
NotRule (
OrRule {QTypeRule(DNSQType.A), QTypeRule(DNSQType.AAAA)}
),
AllowAction()
)
And it works as expected :
> showRules()
# Name Matches Rule Action
0 0 !((qtype==A) || (qtype==AAAA)) allow
Thanks for your help
Regards
/d
Orange Restricted
-----Message d'origine-----
De : dnsdist <dnsdist-bounces at mailman.powerdns.com> De la part de Jacob Bunk Nielsen via dnsdist
Envoyé : lundi 13 mars 2023 06:41
À : dnsdist at mailman.powerdns.com
Objet : Re: [dnsdist] dnsdist 1.7 : allow only A request
On 10/03/2023 09.21, david n via dnsdist wrote:
> I tried to explicitly deny the most current DNS requests like for ex :
>
> -- refused query type :
> addAction(QTypeRule(dnsdist.ANY), DropAction())
> addAction(QTypeRule(dnsdist.SOA), DropAction())
With dnsdist 1.4 (as far as I remember) those names for the various query types changed, so dnsdist.ANY became DNSQType.ANY.
For your particular case of only wanting to serve A and AAAA records I would probably just do (untested):
addAction(
NotRule(OrRule({QTypeRule(DNSQType.A),QTypeRule(DNSQType.AAAA)})),
RCodeAction(DNSRCode.REFUSED))
With all the warnings that Stephane already gave you about why this is a bad idea.
You can replace RCodeAction(DNSRCode.REFUSED) with DropAction() if you don't even want to reply with a REFUSED response.
Best regards,
Jacob
_______________________________________________
dnsdist mailing list
dnsdist at mailman.powerdns.com
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.powerdns.com%2Fmailman%2Flistinfo%2Fdnsdist&data=05%7C01%7Cdavid.neau%40orange.com%7Ce4a90856091648c6468208db23858078%7C90c7a20af34b40bfbc48b9253b6f5d20%7C0%7C0%7C638142828512924657%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QGkG%2FLEwnxf1MKw31d0jQCj1f0dXx5qg5pO4hJ6VwP0%3D&reserved=0
_________________________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.
This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
More information about the dnsdist
mailing list