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

dns: T5113: Support custom port for name-server forwarders #1914

Merged
merged 2 commits into from
Mar 27, 2023

Conversation

indrajitr
Copy link
Contributor

@indrajitr indrajitr commented Mar 26, 2023

Change Summary

Support custom port for name-server forwarders that would allow using custom ports in name server forwarders to enable forwarding to alternative name servers (unbound, stubby, dnscrypt-proxy etc.) operating on non-default port.

This would also allow using DNS Over TLS in PowerDNS Recursor 4.6 onwards (pdns doesn't support certificate check for validity yet) by enabling dot-to-port-853. This is set by default if compiled in with DoT support.
See: https://doc.powerdns.com/recursor/settings.html#dot-to-port-853

This also partially implements T921, T2195 (DoT without certificate check).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

dns forwarding

Implementation details

  • In 'dns/forwarding' configuration, 'name-server' now allows optional port (defaults to 53).
  • Instead of modifying name-server-ipv4-ipv6.xml.i to add optional port, a new file name-server-ipv4-ipv6-port.xml.i has been used to avoid impacting other places where it is reused because not all of them honor ports (mostly VPN related).
  • The host:port entries to be used by PowerDNS recursor config are normalized eagerly at the point of loading VyOS Config instead of doing them lazily while rendering the Jinja2 template to keep the implementation less intrusive. The alternative would entail making quite a bit of change in how vyos-hostsd processes static name_servers entries or persists their runtime states. (I am open to suggestion/recommendation with the approach here.)

How to test

  • Add forwarding name-servers as so:
set service dns forwarding name-server 1.1.1.1                     # default port 53
set service dns forwarding name-server 1.0.0.1 port 853            # custom port 853
set service dns forwarding name-server 2606:4700::1111 port 853    # custom port 853
  • Look for static entries in /run/powerdns/recursor.forward-zones.conf like so:
    • 1.1.1.1
    • 1.0.0.1:853
    • [2606:4700::1111]:853

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@vyosbot vyosbot requested review from a team and dmbaturin and removed request for a team March 26, 2023 21:08
@indrajitr indrajitr force-pushed the pdns-port branch 3 times, most recently from d7d9533 to ac27c18 Compare March 27, 2023 06:19
Support custom port for name-server forwarders that would allow using
custom ports in name server forwarders to enable forwarding to
alternative name servers (unbound, stubby, dnscrypt-proxy etc.)
operating on non-default port.

This would also allow using DNS Over TLS in PowerDNS Recursor 4.6 onwards
(pdns doesn't support certificate check for validity yet) by enabling
'dot-to-port-853'. This is set by default if compiled in with DoT support.
See: https://doc.powerdns.com/recursor/settings.html#dot-to-port-853

This also partially implements T921, T2195 (DoT without certificate check).

Implementation details:
- In 'dns/forwarding' configuration, 'name-server' now allows optional
  'port' (defaults to 53).
- Instead of modifying 'name-server-ipv4-ipv6.xml.i' to add optional
  'port', a new file 'name-server-ipv4-ipv6-port.xml.i' has been used
  to avoid impacting other places where it is reused because not all of
  them honor ports (mostly VPN related).
- The `host:port` entries to be used by PowerDNS recursor config are
  normalized eagerly at the point of loading VyOS `Config` instead of
  doing them lazily while rendering the Jinja2 template to keep the
  implementation less intrusive. The alternative would entail making
  quite a bit of change in how 'vyos-hostsd' processes 'static'
  'name_servers' entries or persists their runtime states.
Smoketest update for T5113 with optional port for name-server forwarders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants