Repository navigation
Conversation
| resp = start_ok.response | ||
| if i = resp.index('\u0000', 1) | ||
| {resp[1...i], resp[(i + 1)..-1]} | ||
| {resp[1...i], resp[(i + 1)..-1], false} |
There was a problem hiding this comment.
Just for local development for now...
PR Review: EXTERNAL Authentication Mechanism (x509)1. Security: Authentication bypass for EXTERNAL users
return user unless !context.is_ssl_loginThis line returns the user immediately when
Consider adding an explicit permission or flag on the user that controls whether certificate-based login is allowed, rather than unconditionally trusting any CN that matches a username. 2. Crash on EXTERNAL mechanism without valid certificate CN
{connection_info.ssl_cn.not_nil!, "", true}
A client connecting on a plaintext AMQP port and sending 3.
|
| context = Auth::Context.new( | ||
| username, | ||
| password.to_slice, | ||
| is_ssl_login: is_external_mechanism, |
There was a problem hiding this comment.
Based on RabbitMQ implementation, it looks like it uses the UsersStore (defined users) for ACL.
Meaning, you need to define users so X509 works. All examples in the documentation I've seen was using this manner.
So for LocalAuthenticator logic to work, reused in HTTP etc, there might be the need for some things to move around or simply add a flag like this.
There was a problem hiding this comment.
On a second thought: maybe renaming to allow_passwordless could be more than enough for this...
There was a problem hiding this comment.
what is it used for? Just displaying in the UI?
There was a problem hiding this comment.
@carlhoerberg is used for this LocalAuthenticator check.
X509 auth is "passwordless" but still uses the Local users
There was a problem hiding this comment.
ok, but it should be called something else, right?
| is_ssl_login: is_external_mechanism, | |
| external_authentication: is_external_mechanism, |
There was a problem hiding this comment.
There's also a change in amqp-protocol.cr needed it seems...
The START packet is not offering EXTERNAL.
Matter of fact - in RabbitMQ that's configurable - the ordering.
Does it make sense for us to also do it?
PR Review: EXTERNAL (x509) authentication mechanism1.
|
|
Why is Claude being activated on Draft's also? I am being roasted for nothing lol |
|
Blocked by #1896 |
| context = Auth::Context.new( | ||
| username, | ||
| password.to_slice, | ||
| is_ssl_login: is_external_mechanism, |
There was a problem hiding this comment.
what is it used for? Just displaying in the UI?
PR Review: EXTERNAL (x509) authentication mechanismRe-reviewed the current diff. The refactor into per-mechanism No blocking issues found. Two low-severity notes (non-blocking):
|
Config KeysRabbitMQ uses root-level config keys such as ssl_cert_login_from. Should we have an INI section only for that? I initially started with: [external_auth] X509 Extension ParsingThe X509::Extension class does not handle the type properly. X509::Extension.value is a key:value string that needs to be parsed, likely by splitting it, for the compliant keys used here: Design QuestionWhat is the usual mindset here? Should we parse it early, for example at NativeSocket::Server or a similar boundary, or should we leave it as manual handling where it is actually used? Current PreferenceI am leaning toward not storing the SAN or CN in ConnectionInfo. Instead, I would load or parse them on demand for callers, because storing them directly could clutter ConnectionInfo and make each connection more memory-expensive. |
- Moved `ssl_client` to ConnectionInfo - Might stop storing in-memory and just letting ConnectionFactory itself parse the CN and ALT_NAME on-demand since it is only used during Authentication - ConnectionFactory needs access to the global Config object so it decides which config to use - `Type` is not handled in X509::Extension in Crystal. `value` is a plain string that needs parsing. Look into either 1) make it simple 2) properly parse those
Now we have the configurations in place and how that would work. Lots of bad `Nil?` handling in place. Code is getting cluttered and needs some cleaningm, perharps moving into a separate class for the EXTERNAL Authencation logic. Next step is writing E2E Test Cases. Will take some reference from TLS tests - [] Move errors to their own classe - [] Move EXTERNAL to separate module/class - [] Evaluate wether we really need to store SSL CN/SAN in-memory for each connection. Too heavy for tons of connections - [] Review log strategy. What needs to be logged?
|
For proper specs, it needs cloudamqp/amqp-client.cr#74 |
WHAT is this pull request doing?
Adding support for
EXTERNALmechanism allowing for X509 Certificate CN or SAN authentication.HOW can this pull request be tested?
WIP. Manually for now
Work In Progress Tracking
typeis not handled properly by X509::Extension. It's a pure string. Should we have parsing in NativeSocket?Closes #1782