-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for DefaultSentinel for fallback JWT handling #6577
base: main
Are you sure you want to change the base?
Conversation
Have not reviewed the code, but could we just say default account, or default auth account? I assume that would make the code a bit trickier.. Also how do we feel that anyone with no creds can pound on the system here? With the bearer token it at least had a bit of resistance. |
@@ -1024,6 +1025,8 @@ func (o *Options) processConfigFileLine(k string, v any, errors *[]error, warnin | |||
*errors = append(*errors, err) | |||
return | |||
} | |||
case "default_sentinel": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should add checks if this is no in operator mode and if no auth callout defined, this should error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does when it processes - same if the JWT is invalid (wouldn't be any different than the client providing the wrong JWT). Will add a validation, however this is only partial since at this point, we can know if we have an operator, but whether the user resolves or not is a different issue. The JWT can be hot-reloaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@derekcollison added a check here
https://github.com/nats-io/nats-server/pull/6577/files#diff-4f7238cd9f97e766d6c31311be7bcc154b4d313678f513bfca50317dff080dafR72-R75
and a corresponding test - also added a test showing how it can be a default user (no callout)
This is exactly what they want to by-pass. The callout will reject as expected. |
0b4c4a0
to
7c6498b
Compare
Given the freeze, is this for 2.11.1? |
Would be great if it could get in. But happy do defer. |
Please rebase on top of latest main and will queue up for merge, thanks! |
@neilalexander done. |
ea2e980
to
7d50473
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Introduce new logic to handle dynamic reloading of the `default_sentinel` configuration. Added relevant tests to validate the correct behavior of updates to this option during server reloads. Signed-off-by: Alberto Ricart <[email protected]>
Signed-off-by: Neil Twigg <[email protected]>
7d50473
to
b2bf0b6
Compare
|
Introduce a new
default_sentinel
option to provide a fallback JWT when none is specified in operator mode. This effectively allows for a default user, or a default callout user.The value here must be a JWT (Bearer). If an auth-callout sentinel JWT, the user will be authenticated as an auth callout. If not, the user will be placed in the specified account.
Signed-off-by: Alberto Ricart [email protected]