You don't say /why/ you want to do this. This forwarder only does a single
request per TCP connection and also supports TLS:
https://github.com/m3047/tcp_only_forwarder/blob/master/forwarder.py
If you want to run DoT, I'm pretty sure that's on the BIND roadmap. The
BIND distro has provided instructions for setting up Nginx as an SSL
terminator in front of BIND in contrib/dnspriv/.
If you're trying to authenticate DNS queries/responses, you can also look
at using TSIG.
Post by Roee MayerowiczDo you know of a way to ask multiple DNS queries in a recursive bind
server at the same packet\request? Using DoH might work? How? Is there a
plugin which does that?
There is no way to send multiple requests in a single UDP datagram, but
you can send multiple requests in a TCP connection. There is only ever
supposed to be exactly one RR in the QUERY section.
--
Fred Morris
--
#!/usr/bin/python3
# Copyright (c) 2021 by Fred Morris Tacoma WA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Multiple requests in a single TCP stream.
There is no way to send multiple queries in a single UDP datagram.
Tweak the following to your needs:
* 10.0.0.220 => your server address
* sophia.m3047. => a query name
* flame.m3047. => another query name
Mind the trailing dot at the end of the FQDNs.
"""
import socket
import dns.message
SERVER = ('10.0.0.220', 53)
BIG_ENDIAN = { 'byteorder':'big', 'signed':False }
def main():
sock = socket.create_connection(SERVER)
req = dns.message.make_query('sophia.m3047.','A')
wire_req = req.to_wire()
sock.send(len(wire_req).to_bytes(2, **BIG_ENDIAN) + wire_req)
resp_length = sock.recv(2)
wire_resp = sock.recv(int.from_bytes(resp_length, **BIG_ENDIAN))
resp = dns.message.from_wire(wire_resp)
print(resp)
req = dns.message.make_query('flame.m3047.','A')
wire_req = req.to_wire()
sock.send(len(wire_req).to_bytes(2, **BIG_ENDIAN) + wire_req)
resp_length = sock.recv(2)
wire_resp = sock.recv(int.from_bytes(resp_length, **BIG_ENDIAN))
resp = dns.message.from_wire(wire_resp)
print(resp)
sock.close()
return
if __name__ == '__main__':
main()
_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
bind-users mailing list
bind-***@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users