Skip to content

Extract TLS informations that are delivered in PROXY protocol frame #3175

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

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

prefiks
Copy link
Contributor

@prefiks prefiks commented Jul 5, 2021

Proposed Changes

This adds extractor for TLS details that are provided in PROXY protocol payload. This makes connections that do use HAProxy to handle TLS (and have PROXY protocol enabled), show that they are encrypted and have data about protocol cipher that this connection used
displayed in management ui.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

This extends already existing PROXY support with handling of TLS information that can be passed in it. This doesn't add passing information about client certificates, data that is provided that way, doesn't looks like is compatible with what rabbit is expecting, there is just not enough information in that.

This was sponsored by 84codes/CloudAMQP.

@michaelklishin
Copy link
Collaborator

@prefiks any reason why MQTT, STOMP and possibly their WebSocket counterparts are not updated in this PR?

Copy link
Contributor

@lhoguin lhoguin left a comment

Choose a reason for hiding this comment

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

I have done a preliminary review of the code and it looks fine.

I have not tried the code yet.

I think Ranch should have a function that converts from ProxyInfo to what ssl:connection_information/1 returns. I have opened a ticket there. This however in no way invalidates this PR, this is more of a good idea to add in a future release of Ranch.

@prefiks
Copy link
Contributor Author

prefiks commented Jul 5, 2021

I think it works MQTT/STAMP, i believe those end calling amqp_direct_connection:socket_adapter_info/2, which in turn do use that newly added code.

Copy link
Contributor

@lhoguin lhoguin left a comment

Choose a reason for hiding this comment

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

I have confirmed that this works for AMQP 0.9.1.

Screenshot 2021-07-08 at 13 45 08

Before the PR it was not even showing SSL.

Copy link
Contributor

@lhoguin lhoguin left a comment

Choose a reason for hiding this comment

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

Works fine with streams:

Screenshot 2021-07-08 at 16 02 45

Screenshot 2021-07-08 at 16 03 05

@michaelklishin michaelklishin merged commit 29bb9c5 into rabbitmq:master Jul 13, 2021
@michaelklishin michaelklishin added this to the 3.8.20 milestone Jul 13, 2021
@michaelklishin michaelklishin added the backport-pending Use with PRs that are yet to be backported for any reason label Jul 13, 2021
michaelklishin added a commit that referenced this pull request Sep 7, 2021
Extract TLS informations that are delivered in PROXY protocol frame

(cherry picked from commit 29bb9c5)
@michaelklishin michaelklishin modified the milestones: 3.8.20, 3.8.23 Sep 7, 2021
@michaelklishin michaelklishin removed the backport-pending Use with PRs that are yet to be backported for any reason label Sep 7, 2021
@michaelklishin
Copy link
Collaborator

michaelklishin commented Sep 7, 2021

Backported to v3.9.x for 3.9.6.

michaelklishin added a commit that referenced this pull request Sep 7, 2021
Extract TLS informations that are delivered in PROXY protocol frame

(cherry picked from commit 29bb9c5)
@michaelklishin
Copy link
Collaborator

Backported to v3.8.x (obviously without the stream protocol part) for 3.8.23. Previously this was not backported or I could not find any backported commits.

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.

4 participants