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 d467005816 Bleh :) 2026-03-22 16:20:25 +01:00
Bram Matthys 69c9130da1 Bump version to 6.2.4-git 2026-03-22 13:45:28 +01:00
Bram Matthys d150da8ea5 Make "geoip_mmdb" the default GEOIP module. So it receives testing.
I still need to update ./Config. I guess we will remove that question
entirely.
2026-03-22 13:38:20 +01:00
Bram Matthys f884bfe755 Another workaround for test suite. 2026-03-22 13:25:36 +01:00
Bram Matthys d6f93e8566 Test suite: update extras/tests/tls/testssl_profiles/pqc.txt
Due to commit 7b48fdca1a
2026-03-22 13:13:30 +01:00
Bram Matthys 806c883a7f Rename geoip_maxmind to geoip_mmdb with a backwards-compatible warn.
This is a mmdb backend which supports various GeoIP providers,
and we no longer use the maxmind library, so this makes sense.
2026-03-22 12:29:00 +01:00
Bram Matthys 172ace9750 geoip_maxmind: use our own mmdb implementation
This is mainly due to licensing. The libmaxminddb library uses the
Apache license, which meant if we would compile it in by default it
would effectively transform our "GPLv2 or later" to "GPLv3 or later".
Our implementation is ISC licensed, so we can include and enable it
by default and keep things at "GPLv2 or later". This is also why we
used geoip_classic in the first place as default and compiled in,
and not the mmdb variant.

The mmdb.c is based on the specification, using the Go implementation
as a reference during development (ISC licensed), initially implemented
with the help of Claude Opus 4.6. After that substantial changes were
made to make it match UnrealIRCd's style and to make things less error
prone: C style changes, allocation and zero termination of strings in
the library, auto-NULL in variadic functions so the caller cannot
forget NULL there (similar to our unreal_log/do_unreal_log), using
enums as the return type instead of int (similar to curl), adding
doxygen docs, etc.

This also means the old mmdb library dependency has been dropped,
including from configure/autoconf.

At the moment we still use the geoip classic library by default,
including those DB files. The idea is we will switch over sometime
later after this current new MMDB stuff has received more testing.

This also makes us more flexible, since .mmdb files have become the
de-facto standard for pretty much all geoip vendors.
2026-03-22 12:10:18 +01:00
Bram Matthys 89bce01c31 Fix OOB write in geoip_csv if the .csv file is bad / malicious.
This module is rarely used but analysis showed that there was an
OOB write in the country name, and two small off-by-ones in code
and continent.

Again, this only matters if the CSV file you are importing is bad
or malicious. And we use stack protection in UnrealIRCd so this
should then "only" cause a crash.
2026-03-16 14:10:29 +01:00
Bram Matthys f944990c54 Fix some flagged stray semicolon in C code (;;) 2026-03-16 09:53:22 +01:00
Bram Matthys 198c9279e1 Fix a check in hash_get_chan_bucket(). The only caller is from list.c
which already ensures in bounds, so not an issue. But who knows in the
future there will be other functions that use it and then the check
is misleading as it doesn't cover all cases.
2026-03-16 09:14:07 +01:00
Bram Matthys e4d6b51d04 Add certificate/key check to CONFIG INIT. So we properly stop booting
or rehashing if there is an error loading them (at least try harder).
Right now they are only in CONFIG LOAD, which is too late to stop things.

Previously "./unrealircd configtest" showed an error but still said
"Configuration test passed OK". And REHASH passed similar. Now, it
is a real error.

This is not to be confused with a "file does not exist" error, which
we already handled properly. It's the less usual ones, like wrong key.

Only downside is more init_ctx() calls, which can be a bit heavy on
various platforms, slowing boot or REHASH down. Should be fine though...
2026-03-15 15:59:09 +01:00
Bram Matthys 08f90d4006 Make certificate_quality_check() work on OpenSSL 3+.
This isn't really important, as you can read below, but was a FIXME item.

This function checks for RSA keys that are less than 2048 bits, so
RSA 1024 is rejected. This was added in UnrealIRCd 5.0.0 (Dec 2019).
RSA 1024 was already looong considered insecure. And those using it
should have been flagged from there on.

OpenSSL 3 changed the API, and this function was never updated to have
the same check with OpenSSL 3+ until now. Fortunately, OpenSSL 3.0.0
onwards reject 1024 bit RSA by default, so that doesn't really matter.
For reference, OpenSSL 3 was released in Sep 2021 and first appeared
in Ubuntu LTS 22.04 (Apr 2022) and Debian 12 (Jun 2023).
However, if you set SECLEVEL to 0 (eg in system-wide openssl.cnf),
it would allow those keys, which is pretty much expected but also not
what we want at UnrealIRCd. From now on, for those rare situations,
we reject it as well.
2026-03-15 10:54:16 +01:00
Bram Matthys 7b48fdca1a Default TLS groups: use tuple syntax with slash to prefer X25519MLKEM768,
even if it costs an extra round-trip due to HRR (Hello Retry Request).
This is IRC after all, where connections live minutes, hours, days,
so that extra round trip is worth it if it means better security.

The TL;DR is: we try harder to use X25519MLKEM768.

The longer story is as follows:

In TLSv1.3, the client will indicate which groups it supports (eg
a list of 4 items) and which ones it speculates to be used (very
often just 2 items). Some TLS clients may not include X25519MLKEM768
in this initial speculation, but only f.e. X25519 and prime256v1
even though X25519MLKEM768 is communicated via their "supported" list.
Without this patch, we would then settle with one of those 2.
With this patch, we will send a Hello Retry Request, allowing to
use X25519MLKEM768.

This is rare, though, most TLS client implementations that have
X25519MLKEM768 will bet on it to be used (the 2 they bet on is
often X25519MLKEM768 & X25519). That's many browsers like Chrome,
OpenSSL, Go, etc.

GnuTLS usually will do this as well, but under some configurations
it may bet on 2 classic crypto to be used. For that specific (type
of) situation, this patch will help to use X25519MLKEM768.
This can be tested with OpenSSL to simulate such an implementation:
openssl s_client -connect 127.0.0.1:6697 -groups X25519MLKEM768:*X25519
Before this patch, it would result in X25519 (because that is the
speculated group, with the asterisk). After this patch it will
cause X25519MLKEM768 to be used.

The tuple syntax is in 3.5.0+ and our UNREALIRCD_DEFAULT_TLS_GROUPS_PRIMARY
with X25519MLKEM768 also requires 3.5.0+ so this is an easy change.

Oh and, this commit comment is rather long for a 1 byte change :D
2026-03-15 07:06:46 +01:00
Bram Matthys 27a3fb8d97 unreal_server_compat: fix always using EXBTYPE_BAN even for +e/+I.
For the extbans that we ship, no problem, as this isn't used in
any of our extbans, but for third party it may matter, or for us
in the future.

Just something we came across while looking into the issue from
previous commit.
2026-03-14 10:20:24 +01:00
Bram Matthys 31005e18b1 Fix extbans in +I not being converted to letter bans to older servers.
This affects servers without NEXTBANS, such as anope 2.0.x series
(anope 2.1.x is not affected as it supports NEXTBANS).

Non-NEXTBANS servers only support letter extbans so we are supposed
to convert ~security-group:known-users to ~G:known-users when sending
to such a server, in unreal_server_compat. And we did this well for
the MODE command for +beI. In SJOIN we did this correctly for +b/+e
but not for +I due to a silly code mistake.

This bug is present since 6.0.0 but wasn't noticed until now.

To be a real problem you need something like:
1. Anope 2.0.x series (or other services without NEXTBANS)
2. A channel with +I extbans
3. KEEPMODES set on that channel

Then what happens is when services boot:
1. UnrealIRCd will sync with anope 2.0.x and incorrectly send
   named bans, which will confuse anope. But nothing strange
   happens yet at this point.
2. Then on next server sync (eg anope restart or unreal restart)
   anope will try to restore these but they end up with weird
   entries like +I *!*@~security-group:known-users
   (note the *!*@ prefix)

And it should be noted that this would also happen in a situation
with UnrealIRCd 5 + UnrealIRCd 6 servers, but UnrealIRCd 5 is
End Of Life anyway.

Reported by BlackBishop and Sadie two days ago. Thanks!
2026-03-13 13:57:41 +01:00
Bram Matthys bcaaaa5949 Fix crash on Windows because of missing MODVAR / __declspec(dllimport)
on 'known_users', which is accessed by the reputation module.
2026-03-11 14:39:15 +01:00
Bram Matthys c3600f0f3a CI: If $USE_SHIPPED_LIBS is 1, then build with shipped libraries from extra/ 2026-03-07 18:34:55 +01:00
Bram Matthys 2d145b0f2c ** UnrealIRCd 6.2.3 ** 2026-03-06 08:23:30 +01:00
Bram Matthys 98709af7a3 modules.optional.conf: extjwt::service::method is required
(which is fine, i think)
2026-03-06 08:22:53 +01:00
Bram Matthys cc1c1c5a73 Update doc/unrealircd_wiki.zim for 6.2.3
[skip ci]
2026-03-06 08:02:19 +01:00
Bram Matthys a841911882 Mention extjwt { } in the release notes: it had API updates, build tests
and we now have documentation on the wiki.

Plus some other textual changes.

[skip ci]
2026-03-06 07:44:13 +01:00
Bram Matthys 7865675917 Fix OOB write if a trusted linked server sends malicious data.
NOTE: Linked servers are considered trusted in UnrealIRCd.

This is not exploitable beyond a crash, due to -fstack-protector-all,
a hardening compiler flag we added many years ago. Even without
that flag it would be rather difficult, and i didn't manage to,
but this should never happen anyway since this flag is only
missing in gcc/clang versions that are more than 15 years old.

This issue was introduced by the move to CMD_BIGLINES in
6c5de62c18 in 6.2.2 release.
2026-03-06 07:14:10 +01:00
Bram Matthys 87e4249a09 extjwt: don't free modes/umodes, they are taken care of by payload. 2026-03-04 17:07:06 +01:00
Bram Matthys c4c082d0b7 And restore this LDFLAGS as well
This completes the fix from e1211adb3b
2026-03-04 11:01:05 +01:00
Bram Matthys e1211adb3b Restore LDFLAGS after setting it in library compiles
But is this enough...?
2026-03-04 10:49:20 +01:00
k4be deff636c74 extjwt: Remove OpenSSL deprecation warnings 2026-03-04 09:38:05 +01:00
Bram Matthys 9289ef7c83 Mention JSON-RPC there as well
[skip ci]
2026-03-04 09:18:20 +01:00
Bram Matthys fc82176cd0 Update README with Mastodon and tell at least something about supported systems.
Mention tested systems as well (which is narrower than supported systems).
And merge documentation and support, since users will usually be after both.
2026-03-04 09:15:36 +01:00
Bram Matthys 7a46caa1da tls-tests: pin to a specific testssl.sh commit hash. 2026-03-03 17:08:35 +01:00
Bram Matthys de2d72b592 Update Build CI. Tightening it down and fail-fast to false. 2026-03-03 07:16:44 +01:00
Bram Matthys 648a10494f Add -DTESTSUITE and use it from extras/build-tests/nix/build.
In particular, this disables default +F for #__SYNC__ channels.
The test suite has a "+F off" but when on 3 servers, each 75
clones are connecting, the MODE is too late and the join limit
is already reached sometimes. Causing tests to fail.
2026-02-28 15:26:57 +01:00
Bram Matthys 426289e377 Drop really verbose logging from build tests as it makes things too slow 2026-02-28 12:18:11 +01:00
Bram Matthys b06a3a34d0 Update extras/build-tests/nix/run-tests.bbwrapper to fix FreeBSD issue. 2026-02-28 12:04:34 +01:00
Bram Matthys 55fda3456d Update TLS tests with pqc_arm.txt (on rpi 5, slightly differs from pqc.txt)
OpenSSL prefering X25519 vs secp521r1 for ECDH and vice versa,
still looks fine.
2026-02-28 10:47:38 +01:00
Bram Matthys cd317e678c Update release notes on latest two changes.
[skip ci]
2026-02-25 15:21:57 +01:00
Bram Matthys 70d6cb2589 If no 3rd party modules are installed, then skip the module upgrade step.
This means we don't do an HTTPS call at build time when unnecessary.
2026-02-25 15:04:49 +01:00
Bram Matthys 17037b0694 Fix build failing if DNS is not working. Building UnrealIRCd should never fail
because it has no internet access, like when fetching the repository
(modules.list file) of 3rd party modules.

Previously I had..
url_start_async(request);
synchronous_http_request_in_progress = 1;
.. which worked fine for the "cannot connect case", like port blocked
or timeout connecting. But if DNS fails then the step of setting
synchronous_http_request_in_progress = -1 (so failed) already happens
during the url_start_async(request); call, and then the line after it
sets 'synchronous_http_request_in_progress = 1;' so we miss that it
failed and wait in the I/O loop forever.
Simply swapping the two lines of code fixes this.

The other change is that when running the ModuleManager in "make" we should
ignore the exit code. I probably broke that while refactoring and adding
non-zero exit codes in de modulemanager past few months for this release.
2026-02-25 14:58:11 +01:00
Bram Matthys bd1ccde9c3 ** UnrealIRCd 6.2.3-rc2 ** 2026-02-25 08:28:20 +01:00
Bram Matthys 2f839c85f7 Reorder some release notes items 2026-02-23 10:54:12 +01:00
Bram Matthys 93c26c2d42 Update release notes. 2026-02-23 10:04:08 +01:00
Bram Matthys 3a96bdf6ec Add set::allow-setident (default: 'no'), set::allow-setname ('yes')
Two new settings that control the use of `SETIDENT` and `SETNAME`:
* [set::allow-setident](https://www.unrealircd.org/docs/Set_block#set::allow-setident)
  now defaults to 'no'. Previously all users were allowed to change their
  ident (taking into account
  [set::allow-userhost-change](https://www.unrealircd.org/docs/Set_block#set::allow-userhost-change)
  restrictions).
* [set::allow-setname])(https://www.unrealircd.org/docs/Set_block#set::allow-setname)
  has a default of 'yes' which matches older UnrealIRCd versions (no change).
  Perhaps some admins who use controlled (web)chats may want to set this
  to 'no' if users are not supposed to change their realname/gecos.
  This is probably rare, but they have the option now.
2026-02-23 08:58:39 +01:00
Bram Matthys a6cdd4b548 Use the exact same approach for argon2 as the other libs
(fixes build)
2026-02-23 08:04:31 +01:00
Bram Matthys d19919df07 Add extras/build-tests/nix/hardening-check.sh so i can use from BuildBot. 2026-02-23 07:48:47 +01:00
Bram Matthys 3e9ce77dc6 Hardening: build the last 2 remaining libs with hardening flags too
Library argon2 uses a makefile without configure, so works a bit different
And GeoIP i forgot because it was in a different autoconf file.
2026-02-23 07:17:02 +01:00
Bram Matthys 4c01372e3b Move orig_cflags="$CFLAGS" to after AC_PROG_CC_C99
As otherwise the shipped libs don't (necessarily) get -O2 -g,
which in turn means _FORTIFY_SOURCE=3 won't work.
2026-02-22 20:15:33 +01:00
Bram Matthys ae245865ea Pass hardening flags to libraries that we build/ship ourselves (if any)
Previously we didn't and that means that if any shipped lib was used,
without hardening, this would cause non-CET libraries to silently disable
CET for the entire process, and partial RELRO on the libs means the
full RELRO in UnrealIRCd is much less useful.

Actually, system libs on Debian/Ubuntu don't even have full RELRO atm,
but hey, we try to do better, also.. some other OS/distro might
have it on and who knows Debian/Ubuntu change their mind later..
2026-02-22 19:50:46 +01:00
Bram Matthys dcd8f738fe Remove -fzero-call-used-regs=used-gpr again. This is apparently not
as useful as initially thought. I thought kernel hardening checker
was in favor of it, and they were, but they dropped it in Oct 2023.

(i added it 2-3hrs ago in 0ab1221a38)
2026-02-22 19:02:31 +01:00
Bram Matthys 5cc59192bc Hardening: add -mbranch-protection=standard for arm64 that support it.
e.g. raspberry pi 5, aws ec2 graviton2 and higher, etc.

This does the same as -fcf-protection on x64 (well, those that support it).
2026-02-22 18:29:17 +01:00
Bram Matthys 4d4a43984c Hardening: add -ftrivial-auto-var-init=zero
This zeroes out variables that COULD be accessed before being set
(so to prevent access to unitialized variables). We are generally
very careful about this in our code, but in 3rd party modules this
is less the case. And still useful in case we ourselves screw up.
2026-02-22 16:38:55 +01:00
Bram Matthys 0ab1221a38 Hardening: add -fzero-call-used-regs=used-gpr
Is defense in depth to make ROP harder. In general this is reported to
have a performance impact of 2% worst-case. Linux kernel reports 1%.
Should be closer to 0% for us, or that 1% if i am wrong.
https://lwn.net/Articles/870045/ has some background on this.
2026-02-22 16:33:38 +01:00