1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 15:34:47 +02:00
Commit Graph

10696 Commits

Author SHA1 Message Date
Bram Matthys a5f1aa7f34 Print a [BUG] line if register_user() is called twice. Deliberately crash
when running in DEBUGMODE.
2026-01-23 07:42:57 +01:00
Bram Matthys eea4cfa762 Modulemanager: support compile-flags and always look at modulemanager block
1) We now always look at the module { } block even for unmanaged modules
   (so .c files that you put manually in src/modules/third)
2) New module::compile-flags to allow specifying compile flags / libraries / etc.

See https://www.unrealircd.org/docs/Special_module_manager_block_in_source_file

So the new stuff is:

module {
        .....
        // Simple library dependency:
        compile-flags "-lsomelib";
        // Can even use:
        compile-flags "$(mysql_config --cflags) $(mysql_config --libs)";
        .....
}

This was requested long ago by various people.

And yes, this allows shell commands to be executed if the 3rd party indicates so.
The added risk should be small, since the module could do similarly evil stuff at
runtime, unless you compile with a totally different user compared to runtime.
The most common case where compile time vs runtime is completely different would
be for packaging (deb/rpm/whatever), which presumably ship with zero 3rd party
modules, so then there shouldn't be a concern either.

Obviously, for 3rd party modules in the unrealircd-contrib repository we screen
modules to make sure they don't do anything evil: "No malicious code or intent"
in https://www.unrealircd.org/docs/Rules_for_3rd_party_modules_in_unrealircd-contrib
2026-01-19 09:48:37 +01:00
Bram Matthys 34e3469f91 Merge branch 'unreal60_dev' of github.com:unrealircd/unrealircd into unreal60_dev 2026-01-19 09:04:51 +01:00
Bram Matthys 96f4954e2b Compile ALL 3rd party modules through modulemanager, including unmanaged.
This gets rid of src/buildmod and unifies the process a little, which
i need later.

We still compile the 3rd party modules unconditionally and twice (during
both make and make install). Which is a quirk that is in there since U6
and maybe U5 already :D. That's because we don't check if header files
have changed. There was previously a "is the .c file newer than the .so"
in there, though, that is gone now. Anyway, that's something for later.

Another quirk is that we do not halt compile if a 3rd party module fails
to compile. Which was sortof intentional at one point but.. is not ideal,
so will probably changed as well.

Anyway, that's not why i am doing all this stuff right now...
2026-01-19 09:02:53 +01:00
Valerie Liu 1dd6e9b07b Fix indentation in sasl.c return statement (PR #333) 2026-01-18 19:32:11 +01:00
Bram Matthys 0cf0c0faa2 Wait for SASL to complete during handshake (success/fail/timeout).
This is to guard against clients that do like CAP LS 302, NICK, USER,
AUTHENTICATE, CAP END, without waiting for the SASL result.

Previously "CAP END" would abort SASL if the response was not in yet.

Now "CAP END" will cause us to wait for SASL success/fail/timeout
and when that happens we will end the handshake and the user will
come online (or not, if e.g. banned).

In other words, SASL is no longer canceled upon premature CAP END.

And yeah, clients should wait, as is mentioned in
https://ircv3.net/specs/extensions/sasl-3.1
"it is RECOMMENDED to only send CAP END when the SASL exchange is
 completed or needs to be aborted"
But since it is a recommendation and not a hard requirement, we'll
be nice and handle this situation server-side.

Of course, clients could still misbehave then by sending stuff
blindly after CAP END, like JOIN events, without even checking
if they got numeric 001 and so on... so in that sense it shifts
the problem a bit.. but.. at least that type of waiting is
hopefully more common :D
2026-01-18 19:06:59 +01:00
Silent 275f04c76c Fix Y2038 bug on Windows in unreal_setfilemodtime (PR #332)
Int32x32To64 macro internally truncates the arguments to int32,
while time_t is 64-bit on most/all modern platforms.
Therefore, usage of this macro creates a Year 2038 bug.
2026-01-11 07:33:49 +01:00
Bram Matthys 1c461db46d Call update_known_user_cache() right before HOOKTYPE_REMOTE_CONNECT.
Set known_users=NULL during a very limited period, just to be safe.
(Note that it can also be NULL during initial boot, which is a
 longer period, which is why we always NULL-check in the code that
 accesses it, but this aside)
2026-01-10 10:36:40 +01:00
Bram Matthys 0cf9fb1cb0 Also update_known_user_cache() from AllowClient(), just before
calling HOOKTYPE_ALLOW_CLIENT and (potentially) allowing the client in.
2026-01-10 10:32:07 +01:00
Bram Matthys 4235a183e3 Call update_known_user_cache() when reputation score reaches known-users
threshold.

* Possible transition to known-users:
* - logged in is already handled by HOOKTYPE_ACCOUNT_LOGIN so we don't care about those
* - score reached (or just over) the minimum reputation score
* Caveat: if having multiple connections from the same IP then
* the first one may theoretically not have crossed in some cases.
* Ah well, it is a cache, not some precise thingy.
2026-01-10 10:15:09 +01:00
Bram Matthys 76aa3a12a6 Add SecurityGroup *known_users, to more quickly fetch those settings.
And use this in a couple of core routines.

This is to speed things up a liiittle.
2026-01-10 10:14:47 +01:00
Bram Matthys 7374fcc83f Add client->known_user_cached as a quick way to determine if the
user is in known-users or in unknown-users. Not used anywhere yet.

Every 2 minutes we rescore all users. Or more specifically: every
5 seconds we rescore 1/24th of all users. That's the slow update path.

On certain events that cause a likely/possible transition, we update
the cache immediately. At the moment that is on IP change and account
login/logout. More will be added later.
2026-01-10 09:57:18 +01:00
Bram Matthys 34ab517d9e Fix possible problem with channel in config-file, such as security group
or elsewhere. I don't think this is an actual problem, but at least the
fix from 1abf73309a was inconsistent,
if we check for b->client further down, then we should not be reading
from it a few lines up. As said, don't think this code is reached in
practice, but hey...
2026-01-04 10:31:38 +01:00
Bram Matthys de05bb9654 Bump version to 6.2.3-git and write some early release notes 2026-01-04 10:20:46 +01:00
Bram Matthys 21d58a7ebd Do the same as previous commit for the help.*.conf translations
This transplants commits 2868c3fedb
to doc/conf/help/help.*.conf
2026-01-04 09:47:37 +01:00
Bram Matthys 2868c3fedb help.conf: try to be consistent by documenting only end-user commands,
thus removing commands that are only supposed to be used by IRC clients.
We don't intend to document things like CAP, PONG, etc here.

Remove ISON, PONG, WATCH. Also remove DALINFO which no longer exists.

Re-index the USERCMDS and OPERCMDS table. This removes no longer existing
commands and may also have added some that were not in the index.

Moved STATS from USERCMDS to OPERCMDS since by default it is Oper-only
(and very likely is so effectively in practice).

Maybe PRIVMSG is a bit inconsistent in all this, since users don't type
that but usually it is like MSG. But yeah.. okay.. i can live with that.

As an aside, I don't like services commands being documented in HELPOP,
but that is another matter. These should be 100% documented in the wiki
first before they are scratched in the HELPOP. Right now some are still
missing.
2026-01-04 09:36:01 +01:00
Bram Matthys 2ca1dd0000 Warn about something like ban user { mask { asn { 12 34; } } reason "go away"; }
Where 12 34; is wrong and should have been 12; 34;
Reported by roger.
2026-01-03 20:17:18 +01:00
Bram Matthys 4e3989f304 Add ban user { ....; soft yes; } as an easy way to add a soft-ban from
the config file, without having to resort to things like mask %~asn:XXX;
Now you can just use:
ban user {
	asn { 11111; 22222; 33333; 44444; }
	soft yes;
	reason "This ASN is not allowed. If you have an account you can still bypass";
}

Requested by nobody but sounds like a good idea :)
2026-01-03 19:59:52 +01:00
Pedro CatalĂŁo d0a553790d Fix typo in Windows installation instructions link (PR #331) 2026-01-03 10:34:44 +01:00
Bram Matthys 1abf73309a Fix crash when using Extended Server Ban with invalid syntax in config file.
Reported for 'country', but also applied to 'asn', 'certfp' and 'channel'.
2025-12-26 12:25:05 +01:00
Bram Matthys c85c16f78c JSON-RPC: server_ban and server_ban_exception: expand mask/match items
Previously these showed up as "name":"<match item>", now they show
up properly like this:
        "match": {
          "account": "Syzop"
        },

(... and have no "name" item)

Also expand spamfilter::except while we are at it.
2025-12-14 10:37:50 +01:00
Bram Matthys ded89d1935 JSON-RPC: Make connthrottle.status use config::except and change "state".
* I changed "state":"active" to "state":"monitoring" to make clear it is
  not throttling at that moment but actively monitoring the situation.
* The config::except stuff was previously shown directly under config
  and only 3 particular items (that are most popular). Now we expand to
  sub-item "except" and use json_expand_security_group() to expand all
  the mask items, in a consistent way, just like for security groups.

{
  "jsonrpc": "2.0",
  "method": "connthrottle.status",
  "id": 123,
  "result": {
    "enabled": true,
    "throttling_this_minute": false,
    "throttling_previous_minute": false,
    "state": "monitoring",
    "start_delay_remaining": 0,
    "reputation_gathering": false,
    "counters": {
      "local_count": 0,
      "global_count": 0
    },
    "stats_last_minute": {
      "rejected_clients": 0,
      "allowed_except": 0,
      "allowed_unknown_users": 0
    },
    "config": {
      "local_throttle_count": 20,
      "local_throttle_period": 60,
      "global_throttle_count": 30,
      "global_throttle_period": 60,
      "start_delay": 180,
      "except": {
        "identified": true,
        "reputation_score": 24
      }
    }
  }
}
2025-12-14 10:26:28 +01:00
Bram Matthys c990848d2f Make json_expand_security_groups() really expand all and reorder some.
* Add some missing fields, such as destination, but mostly in the
  exclude- area where a bunch were missing (some of those are a bit
  far fetched, but hey, they exist, so should be shown if in use).
* Re-order fields to more closely match the struct (still not 100%)
* Extended fields, such as "account" and "country", now show up
  directly under the security group, just like the other fields,
  such as "reputation_score". This is also how they show up in the
  config file, so hide the the fact that internally in the struct it
  is stored differently.
* Add a comment in SecurityGroup struct in include/struct.h to make
  it clear you have to add/update stuff at 7 places if you are adding
  something new.
2025-12-14 10:11:09 +01:00
Bram Matthys 426040d870 Move json_expand_security_group() from rpc/security_group to core
and don't include name/priority if it is called for a match item
(which don't have a name or priority).
2025-12-14 09:43:52 +01:00
Bram Matthys 806fa83dd7 ** UnrealIRCd 6.2.2 ** 2025-12-12 12:16:31 +01:00
Bram Matthys 65a1f657b9 Fix testssl profiles to match output of new version of testssl.sh. 2025-12-12 11:57:42 +01:00
Bram Matthys 94d4ded864 Update c-ares to 1.34.6 and update release notes. 2025-12-12 10:13:49 +01:00
Bram Matthys fd52b71081 Setting set::tls::certificate and set::tls::key did not override the default
certificate or key. It added the cert/key to the list of certs, like a
"dual cert" approach.

This was caused by commit 877d151da4,
which indeed adds support for "dual cert" (or more).

I have now deferred setting the default to happen only if no
set::tls::certificate is specified, as you would expect.

We (already) used a similar delayed-initialization / deferred setting
approach in the ::tls-options inheritance code (for blocks like
listen, sni, link, etc.)

Just as a slightly related reminder, we do normally suggest keeping the
conf/tls/server.cert.pem and conf/tls/server.key.pem for server linking
and then use a cert from a trusted CA in the listen block for 6697 etc.
See https://www.unrealircd.org/docs/Using_Let's_Encrypt_with_UnrealIRCd
for more information (and the 'why').
2025-12-10 19:00:12 +01:00
Bram Matthys bda03caf81 modules.default.conf: fix warning of comment in comment, due to rpc/*
Change comment style. Counter-intuitive, but fits the rest of the file.
2025-12-06 17:08:58 +01:00
Valerie Liu 7964345c0b Add RPC methods for security_group and connthrottle (#328)
New RPC methods:
- security_group.list: List all security groups
- security_group.get: Get details of a specific security group
- connthrottle.status: Get full connection throttle status, counters, and config
- connthrottle.set: Enable/disable connection throttling
- connthrottle.reset: Reset connection throttling counts

This also adds json_expand_mask_list(), json_expand_name_list(), and
json_expand_nvplist() to src/json.c for reuse by RPC modules.
2025-12-06 14:58:57 +01:00
Bram Matthys d2586a4b9c Add a blob of text (comment) about JSON-RPC in modules.default.conf
A link to https://www.unrealircd.org/docs/JSON-RPC and such is nice.
And also explain that not all JSON-RPC modules will be in rpc/*.
Sometimes it makes more sense to just put everything in the same
module, such as connthrottle RPC stuff in the connthrottle module.
2025-12-06 09:52:34 +01:00
Valerie Liu 65f85a1b28 JSON-RPC: Add message.* (PR #327 from Valware)
* message.send_privmsg
* message.send_notice
* message.send_numeric
* message.send_standard_reply
2025-11-28 12:24:19 +01:00
Bram Matthys a9ddc3768b Fix some lines ending with \r\r\n instead of \r\n with labeled-response.
Reported by andymandias in https://bugs.unrealircd.org/view.php?id=6406
2025-11-20 11:27:29 +01:00
Bram Matthys 8715e54059 Fix some wording in release notes
[skip ci]
2025-11-19 09:06:56 +01:00
Bram Matthys 1cdf3594ba Make a start with the (very early) release notes
[skip ci]
2025-11-19 08:53:41 +01:00
Bram Matthys 2653b5152e Fix crash if you don't load usermodes/bot or usermodes/noctcp.
It should be perfectly fine if you choose not to load these modules but,
while optimizing / speeding up the find_user_mode() function, i made
it crash in case the hunted user mode does not exist. Oops.
2025-11-19 08:21:27 +01:00
Bram Matthys 242267c280 Fix github CI 2025-11-15 18:40:59 +01:00
Bram Matthys b1210024c6 Bump scratch buffer too, or we would overflow due to previous commit 2025-11-15 18:40:04 +01:00
Bram Matthys 6c5de62c18 Add CMD_BIGLINES support to SJOIN (incoming only)
We still propagate in a non-biglines way, no plan to change that atm.
This is just future-proofing. More testing/auditing needs to be done,
especially to see if buffers are sufficient.
2025-11-15 17:05:45 +01:00
Bram Matthys 3c0046be8b Attempt to fix fight with Gottem's auditorium module.
delayjoin was setting +d if there are invisible users still,
but it should only do that if the channel was +D earlier and
not in all cases (like if some other module is dealing with
invisible users).
2025-11-12 17:51:17 +01:00
Bram Matthys 61ebd34a1e Fix compile error and add URL validation: valid UTF8, no spaces, no low ASCII 2025-11-12 10:53:43 +01:00
Bram Matthys 68f01814be Some minor updates to previous.
* We try to keep the dynconf variables the same name as in the conf
  (well, with hyphens to underscores, and there are some exceptions)
* Remove unnecessary but otherwise harmless second safe_free()
* The URL could have been too long. It is now limited to 360 characters,
  which should be plenty.
2025-11-12 10:14:27 +01:00
Valerie Liu 557595fd1c Implement IRCv3 network icon support (PR #326)
set { network-icon 'https://...........'; }
https://ircv3.net/specs/extensions/network-icon
2025-11-12 10:01:42 +01:00
Valerie Liu f7865140ad Allow '/' in ISUPPORT tokens (PR #325)
Relax requirements for ISUPPORT tokens a little bit, to include '/', which allows for vendor-prefixed isupport tokens. More info:
- https://modern.ircdocs.horse/#rplisupport-005
- https://github.com/ircdocs/modern-irc/issues/250

PR from Valware in https://github.com/unrealircd/unrealircd/pull/325
2025-11-09 09:28:26 +01:00
Valerie Liu c723292ec9 Add HOOKTYPE_MOTD so modules can add their own MOTD lines before RPL_ENDOFMOTD (PR #324) 2025-11-09 09:16:23 +01:00
Bram Matthys 6064fdb054 Small ./Config change to walk through older release directories 2025-11-09 09:04:58 +01:00
Bram Matthys d7a6868950 Bump version to 6.2.2-git 2025-11-09 09:01:34 +01:00
Bram Matthys 4e0eaecb33 Run ./configure for PCRE2 also with original CFLAGS
(and not with the ones we add during ./Config like -Wall -Wextra etc...)

Seen while debugging some other problem
2025-11-07 18:39:40 +01:00
Bram Matthys 8e6ee0ba6a JSON: Make channel.kick check if the user is in channel and
throw an error (JSON_RPC_ERROR_USERNOTINCHANNEL) if this is not the case.
Previously we returned success.

Also, if using DEBUGMODE (never on production servers), the server
would crash if the user is not in the channel.
2025-11-04 17:57:06 +01:00
Bram Matthys 09032ec868 ** UnrealIRCd 6.2.1 ** 2025-11-02 16:10:26 +01:00