Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sock_dodtls: Initial import of a DNS over DTLS client #16861

Merged
merged 3 commits into from
Jul 27, 2022

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Sep 16, 2021

Contribution description

This introduces DNS over DTLS for RIOT, utilizing the sock API. It is still in an experimental stage, as some fallback features are not supported yet (and might never be):

  1. EDNS(0) is required for Path-MTU negotiation, but our packets usually do not get that big, so that's why I left it out for now.
  2. The RFC requires servers and clients to implement both DNS over DTLS and DNS over TLS to have a secure fallback if a satisfying Path-MTU cannot be found. Apart from my reasoning for omitting 1. also applying here, I don't think this is a realistic fallback for RIOT. Rather, if for whatever reason DNS over DTLS is not possible due to Path MTU issues, we should recommend the user to use DoC (gcoap_dns: initial import of a DNS over CoAP (DoC) client #16705) instead, once that is in a stable enough state.

Testing procedure

There is a test application, but there is no automation yet (given that scapy does not support DTLS yet, it is also not as easy as with the DNS counter-part). I tested it with my own DNS over DTLS proxy, but there are also other proxies and servers (e.g. https://github.com/folbricht/routedns) that should work with this client. For my proxy, install aiodnsprox and run it with a DTLS frontend:

pip install git+https://github.com/anr-bmbf-pivot/aiodnsprox/
echo "dtls_credentials:
  client_identity: Client_identity
  psk: secretPSK
upstream_dns:
  host: 9.9.9.9" > config.yaml
sudo ip addr add 2001:db8::1 dev tapbr0
sudo ip route add 2001:db8::/64 via fe80::e0bc:7dff:fecb:f550 dev tapbr0
sudo aiodns-prox -C config.yaml -d 2001:db8::1

Just establish a session with the server and try to resolve a name e.g. on native with

> ifconfig 5 add 2001:db8::2
ifconfig 5 add 2001:db8::2
success: added 2001:db8::2/64 to interface 5
> ifconfig
ifconfig
Iface  5  HWaddr: E2:BC:7D:CB:F5:50 
          L2-PDU:1500  MTU:1500  HL:64  Source address length: 6
          Link type: wired
          inet6 addr: fe80::e0bc:7dff:fecb:f550  scope: link  VAL
          inet6 addr: 2001:db8::2  scope: global  VAL
          inet6 group: ff02::1
          inet6 group: ff02::1:ffcb:f550
          inet6 group: ff02::1:ff00:2

> nib route add 5 default fe80::dc1a:a8ff:fe09:45b3
nib route add 5 default fe80::dc1a:a8ff:fe09:45b3
> dodtls server [2001:db8::1] 5853 Client_identity secretPSK
dodtls server [2001:db8::1] 5853 Client_identity secretPSK
DNS server: [2001:db8::1%5]:853
> dodtls request riot-os.org inet6
dodtls request riot-os.org inet6
riot-os.org resolves to 2001:67c:254:b0b0::1

Issues/PRs references

Companion to #16705 but can be merged independently.

@miri64 miri64 added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Sep 16, 2021
@github-actions github-actions bot added Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework labels Sep 16, 2021
@miri64
Copy link
Member Author

miri64 commented Sep 16, 2021

Arghs, that was supposed to be a draft PR... Oh well, I did set the WIP label :-)

@chrysn
Copy link
Member

chrysn commented Sep 16, 2021 via email

@miri64 miri64 force-pushed the sock_dodtls/feat/initial branch from a7d7d90 to 0aec304 Compare January 10, 2022 20:15
@pokgak pokgak removed their request for review May 30, 2022 04:11
@miri64 miri64 force-pushed the sock_dodtls/feat/initial branch from 0aec304 to d8b5dd5 Compare July 19, 2022 15:13
@miri64 miri64 requested a review from MrKevinWeiss as a code owner July 19, 2022 15:13
@miri64
Copy link
Member Author

miri64 commented Jul 19, 2022

Rebased and adopted for current master. No longer WIP, this was well tested for the experimental evaluation in https://arxiv.org/abs/2207.07486 and I adapted the testing procedures to provide the setup steps for aiodnsprox.

@miri64 miri64 removed the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Jul 19, 2022
@miri64 miri64 force-pushed the sock_dodtls/feat/initial branch from d8b5dd5 to ec7bfd5 Compare July 19, 2022 15:20
@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jul 19, 2022
@miri64
Copy link
Member Author

miri64 commented Jul 26, 2022

May I squash? Are all comments sufficiently addressed?

@miri64 miri64 changed the title sock_dodtls: Initial import of a DNS-over-DTLS client sock_dodtls: Initial import of a DNS over DTLS client Jul 26, 2022
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@miri64 miri64 force-pushed the sock_dodtls/feat/initial branch from b252df5 to 89d1122 Compare July 26, 2022 17:38
@miri64
Copy link
Member Author

miri64 commented Jul 26, 2022

Squashed

@miri64 miri64 enabled auto-merge July 26, 2022 17:41
@miri64 miri64 force-pushed the sock_dodtls/feat/initial branch from 89d1122 to 1b6c9a8 Compare July 26, 2022 22:46
@miri64 miri64 merged commit 8ad68db into RIOT-OS:master Jul 27, 2022
@maribu maribu added this to the Release 2022.10 milestone Oct 14, 2022
@miri64 miri64 deleted the sock_dodtls/feat/initial branch September 1, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants