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

[FIXED] LeafNode TLSMap and websocket auth override #1470

Merged
merged 1 commit into from Jun 12, 2020

Conversation

kozlovic
Copy link
Member

We added authentication override block for websocket configuration
in PR #1463 and #1465 which somehow introduced a drop in perf as
reported by the bench tests.
This PR refactors a bit to restore the performance numbers.

This change also fixes the override behavior for websocket auth:

  • If websocket's NoAuthUser is configured, the websocket's auth
    block MUST define Users, and the user be present.
  • If there is any override (username/pwd,token,etc..) then the
    whole block config will be used when authenticating a websocket
    client, which means that if websocket NoAuthUser is empty we
    are not falling back to the regular client's NoAuthUser config.
  • TLSMap always override the regular client's config. That is,
    whatever TLSMap value specified in the websocket's tls{} block
    will be used.

The TLSMap configuration was not used for LeafNodes. The behavior
now will be:

  • If LeafNode's auth block contains users and TLSMap is true,
    the user is looked up based on the cert's info. If not found,
    authentication will fail. If found, it will be authenticated
    and bound to associated account.
  • If no user is specified in LeafNode's auth block and TLSMap
    is true, then the cert's info will be used against the global
    users map.

Signed-off-by: Ivan Kozlovic ivan@synadia.com

We added authentication override block for websocket configuration
in PR #1463 and #1465 which somehow introduced a drop in perf as
reported by the bench tests.
This PR refactors a bit to restore the performance numbers.

This change also fixes the override behavior for websocket auth:
- If websocket's NoAuthUser is configured, the websocket's auth
  block MUST define Users, and the user be present.
- If there is any override (username/pwd,token,etc..) then the
  whole block config will be used when authenticating a websocket
  client, which means that if websocket NoAuthUser is empty we
  are not falling back to the regular client's NoAuthUser config.
- TLSMap always override the regular client's config. That is,
  whatever TLSMap value specified in the websocket's tls{} block
  will be used.

The TLSMap configuration was not used for LeafNodes. The behavior
now will be:
- If LeafNode's auth block contains users and TLSMap is true,
  the user is looked up based on the cert's info. If not found,
  authentication will fail. If found, it will be authenticated
  and bound to associated account.
- If no user is specified in LeafNode's auth block and TLSMap
  is true, then the cert's info will be used against the global
  users map.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@kozlovic kozlovic merged commit 02eb98c into master Jun 12, 2020
@kozlovic kozlovic deleted the fix_websocket_auth_override_and_perf branch June 12, 2020 16:14
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