iauth: support for external services - #75
Merged
Merged
Conversation
# Conflicts: # .clang-format # ircd/list.c # ircd/s_bsd.c
patrick-irc
marked this pull request as ready for review
August 13, 2026 11:31
Member
Author
|
The changes described above have been tested over a long period on ircnet.tngnet.nl, hostsailor.ircnet.nl, hostsailor.ircnet.nl. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepare iauth to support modules that communicate with external services (e.g. Java, Python or cloud backends).
The main goal is to make iauth suitable for modules that keep persistent connections to external services and need information that only becomes available later during client registration, such as NICK/USER, SASL or ident results.
1. Enable persistent global connections for iauth modules
Extended the module interface with module-wide lifecycle hooks (
ginit,gtick,gwork,grelease) and added support for global file descriptors.Global file descriptors can be registered independently of individual client requests and are integrated into both the
select()andpoll()event loops. Modules can therefore maintain persistent TCP/socket connections to external services instead of opening a new connection for every client.Added:
io_register_gfd()io_update_gfd()io_unregister_gfd()gwork()gtick()ginit()This provides the foundation for asynchronous modules backed by long-running external services.
2. Allow modules to run after NICK/USER but before registration completes
Added a new
wait_for_regmodule option.Some authentication decisions require information that is not available when the TCP connection is first accepted.
wait_for_regallows such modules to run after the client has supplied its registration data, while still preventing the client from becoming fully registered.A new iauth/ircd handshake coordinates this:
P <clid> <count>when matchingwait_for_regmodules exist.DEFER_USER_REGand continues parsing the client's registration commands.Htogether with the registration data.D, ircd resumesregister_user()and completes registration.This allows external authentication modules to inspect the complete client introduction without having to authenticate users after they have already joined the network.
3. Add SASL- and ident-aware module scheduling
Added configuration options for conditionally delaying or skipping iauth modules:
wait_for_reg— run only once the client's registration information is available.skip_if_sasl— implieswait_for_regand skips the module when SASL authentication has already succeeded.wait_for_ident— wait until the ident lookup has definitively completed.skip_if_ident— wait for ident and skip the module when a valid ident response was received.Successful SASL authentication is now reported from ircd to iauth using the new
Smessage, including the authenticated SASL username.The RFC931 module now explicitly reports both successful and unsuccessful ident completion, allowing the iauth scheduler to reliably continue modules waiting for the ident result.
These options make it possible to avoid unnecessary external authentication requests when a stronger or cheaper authentication mechanism has already succeeded.
4. Expose complete registration context to iauth modules
Extended
AuthDataso modules can access the registration information needed by external authentication services:user1)user2)user3)The original USER parameters are now retained on the ircd client until registration completes and are passed to iauth with the
Hmessage.This also removes the previous dependency on
XLINEfor retaining these fields, making the registration context consistently available to iauth.5. Improve communication between iauth modules and unregistered clients
Added support for an
Rresponse from iauth.This allows a module to send an IRC protocol line back to a client while registration is still pending, e.g.