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

PROXYv2 downstream support #760

Merged
merged 12 commits into from
Oct 3, 2022
Merged

PROXYv2 downstream support #760

merged 12 commits into from
Oct 3, 2022

Conversation

gthess
Copy link
Member

@gthess gthess commented Sep 23, 2022

This is a rebase from https://github.com/gthess/unbound/tree/proxy_protocol_2_wip for downstream PROXYv2 support.

Progress:

  • PROXYv2 support (per port) for plain UDP/TCP
  • Configuration option (proxy-protocol-port)
  • Test client (streamtcp.c)
  • More logging than necessary
  • PROXYv2 for TLS connections
  • ACL (deny/refuse) for the proxy itself
  • Documentation
  • Refactoring for cleaner code and efficiency
  • Clean up the code

How to use:

Take a normal Unbound configuration and add

proxy-protocol-port: <port number>

for the port you want to listen for PROXYv2.
The port needs to be an already defined listening port.
You can add the option multiple times for more ports.

Unbound will expect PROXYv2 there.
The proxied client information should be used for everything except for the actual network communication.

@gthess gthess marked this pull request as ready for review September 27, 2022 08:05
Copy link
Member

@wcawijngaards wcawijngaards left a comment

Choose a reason for hiding this comment

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

The code looks good. Some fixes suggested. The choice for remote_addr or client_addr was made correctly in the long list of code edits, as far as I can see.

doc/unbound.conf.5.in Outdated Show resolved Hide resolved
services/listen_dnsport.h Outdated Show resolved Hide resolved
testdata/proxy_protocol.tdir/proxy_protocol.dsc Outdated Show resolved Hide resolved
util/netevent.c Outdated Show resolved Hide resolved
util/netevent.c Outdated Show resolved Hide resolved
util/netevent.h Outdated Show resolved Hide resolved
util/proxy_protocol.c Outdated Show resolved Hide resolved
util/proxy_protocol.c Outdated Show resolved Hide resolved
util/proxy_protocol.c Outdated Show resolved Hide resolved
gthess and others added 4 commits October 3, 2022 11:08
Co-authored-by: Wouter Wijngaards <wcawijngaards@users.noreply.github.com>
Co-authored-by: Wouter Wijngaards <wcawijngaards@users.noreply.github.com>
@gthess
Copy link
Member Author

gthess commented Oct 3, 2022

Thanks for the review @wcawijngaards!
I believe I addressed all the issues and added some more testing while at it.

@gthess gthess merged commit c4e51a4 into master Oct 3, 2022
@gthess gthess deleted the proxyv2 branch October 3, 2022 13:30
@gthess gthess changed the title PROXYv2 PROXYv2 downstream support Oct 3, 2022
gthess added a commit that referenced this pull request Oct 3, 2022
- Merge #760: PROXYv2 downstream support. (New proxy-protocol-port
  configuration option).
@gthess gthess restored the proxyv2 branch October 3, 2022 13:42
jedisct1 added a commit to jedisct1/unbound that referenced this pull request Oct 15, 2022
* nlnet/master: (25 commits)
  - In unit test, print python script name list correctly.
  Changelog note for NLnetLabs#768 - Merge NLnetLabs#768 from fobser: Arithmetic on a pointer to void is a GNU   extension.
  Arithmetic on a pointer to void is a GNU extension.
  - Tag for 1.17.0 release. The code repository continues with 1.17.1.
  - Fix PROXYv2 header read for TCP connections when no proxied addresses   are provided.
  Changelog note for tag for 1.17.0rc1 release.
  - Fix unit test to properly test the reuse_write_wait_pop function.
  - Fix to stop possible loops in the tcp reuse code (write_wait list   and tcp_wait list). Based on analysis and patch from Prad Seniappan   and Karthik Umashankar.
  - Fix proxy length debug output printout typecasts.
  - Fix to stop responses with TC flag from resulting in partial   responses. It retries to fetch the data elsewhere, or fails the   query and in depth fix removes the TC flag from the cached item.
  - Fix checkconf test for dnscrypt and proxy port.
  - Fix dnscrypt compile for proxy protocol code changes.
  - Make ede.tdir test more predictable by using static data.
  - Use DEBUG_TDIR from environment in mini_tdir.sh for debugging. - Fix string comparison in mini_tdir.sh.
  Changelog entry for NLnetLabs#764 - Merge NLnetLabs#764: Leniency for target discovery when under load (for   NRDelegation changes).
  Leniency for target discovery when under load (for NRDelegation changes) (NLnetLabs#764)
  - Fix to clean up after the acl_interface unit test.
  - Fix static analysis report to remove dead code from the   rpz_callback_from_iterator_module function.
  - Fix to close errno block in comm_point_tcp_handle_read outside of   ifdef.
  Changelog entry for NLnetLabs#760 - Merge NLnetLabs#760: PROXYv2 downstream support. (New proxy-protocol-port   configuration option).
  ...
@gthess gthess deleted the proxyv2 branch July 3, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants