1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-25 16:26:38 +02:00
Commit Graph

2718 Commits

Author SHA1 Message Date
Bram Matthys ae0206a92a Add oper::auto-join. This setting overrides set::oper-auto-join.
Suggested by Chris_dc in https://bugs.unrealircd.org/view.php?id=6255
2024-01-10 17:06:35 +01:00
Bram Matthys 64ea1d09d6 Move 'reserved clients' stuff to runtime, since 'ulimit -n' could be lower.
This fixes a bug where if you run ./Config with 'auto' file descriptors,
and then have an unusually low 'ulimit -n' of like 150, you would end up
with a negative amount of file descriptors available for use.

This fix moves it from compile-time setting of reserved fd's to runtime
setting.

All this is wrong, by the way, but that is for another major overhaul,
at least this bug is fixed now :D
2023-12-28 09:00:09 +01:00
Bram Matthys 5918d70943 Bump version to 6.1.5-git 2023-12-22 15:34:10 +01:00
Bram Matthys 96be13d68d ** UnrealIRCd 6.1.4 ** 2023-12-16 16:33:15 +01:00
Bram Matthys 68c2114977 Make sure we never use this variable again ;)
[skip ci]
2023-12-15 12:34:25 +01:00
Bram Matthys be1467d1a1 ** UnrealIRCd 6.1.3 ** 2023-12-09 09:02:12 +01:00
Bram Matthys 3428551e54 ** UnrealIRCd 6.1.3-rc1 ** 2023-12-01 09:03:13 +01:00
Bram Matthys 96b18946ca Include oper name on /SPAMREPORT (for central spamreport) 2023-12-01 07:58:01 +01:00
Bram Matthys c9adae83fc Doxygen updates, mostly for https://www.unrealircd.org/docs/Dev:URL_API
Or actually: https://www.unrealircd.org/api/6/structOutgoingWebRequest.html

[skip ci]
2023-11-27 18:20:57 +01:00
Bram Matthys cd1b79d3f7 Fetch Central Spamfilter rules with the API Key via alternate URL.
* The [Central Spamfilter](https://www.unrealircd.org/docs/Central_Spamfilter),
  which provides spamfilter { } blocks that are centrally managed, is
  now fetched from a different URL if you have an Central API key set.
  This way, we can later provide spamfilter { } blocks that build on
  central blocklist scoring functionality, and also don't have to reveal
  the central spamfilter blocks to 100% of the world.
2023-11-27 14:33:00 +01:00
Bram Matthys 5f767a8fe8 Proxy block: rework and add support for X-Forwarded-For, Cloudflare, etc. 2023-11-27 12:10:17 +01:00
Bram Matthys 026d5522a8 Remove WSU() items forwarded & secure, since these are in webserver nowadays. 2023-11-27 10:07:34 +01:00
Bram Matthys 02ac1fc0b3 Add an option to check websocket Origin header via
listen {
	websocket {
		allow-origin { *.example.net; }
	}
}

This allows you to limit websockets to a particular domain, IF the
user is using a normal browser.

Note that any non-browser (eg a websocket command line program) could
just spoof the Origin header, so for that case it doesn't really add
any security or real restriction.
2023-11-26 20:08:17 +01:00
Bram Matthys 4da58dde41 Update central spamreport, https://www.unrealircd.org/docs/Central_spamreport
set::central-blocklist::spamreport and ::spamreport-enabled are now GONE.
We now require a normal spamreport block, just like for other spamreport
functionality. So, if you want to enable this feature, use:
spamreport unrealircd { type central-spamreport; }

See https://www.unrealircd.org/docs/Central_spamreport for all info.

You can use CBL with central spamreport or central spamreport without CBL.
All explained at that URL.
2023-11-25 11:50:25 +01:00
Bram Matthys bdfc3c97dd Add RegisterApiCallbackResolverHost() and make blacklist module non-PERM.
Hopefully this works OK... still need to test w/REHASH to see.
2023-11-25 09:39:50 +01:00
Bram Matthys 55d1398fca Move dns.h include to unrealircd.h and remove it elsewhere.
Because I need c-ares prototypes in modules.h, for next commit.
[skip ci]
2023-11-25 09:05:55 +01:00
Bram Matthys 6ce1958e1c Add URL API and use it at one place from central-blocklist. Docs at:
https://www.unrealircd.org/docs/Dev:URL_API
2023-11-25 08:31:12 +01:00
Bram Matthys 7d024f8086 URL API: add request->connect_timeout & request->transfer_timeout
... in case you want to do fine-tuning.

Defaults to DOWNLOAD_CONNECT_TIMEOUT (15 seconds) and
DOWNLOAD_TRANSFER_TIMEOUT (20 seconds).

For example, the module manager uses a shorter timeout of 7 and 20.
(that was already the case, but now it uses the generic api so
 it needed an option to set it to those values)
2023-11-24 14:38:20 +01:00
Bram Matthys 36323f4294 Replace modulemanager HTTPS code with the generic URL code.
We now have a synchronous_http_request() which can be used for that
(NOTE: that function is NOT for use in unrealircd modules)
2023-11-24 13:22:55 +01:00
Bram Matthys 2ae33225d0 In url_curl.c we properly did remove(tmpfile) but in url_unreal.c we did not.
Also add a flag to say not to remove the tmpfile -- not working yet.
[skip ci]
2023-11-24 13:17:21 +01:00
Bram Matthys 1282d2f2be URL API: Response callback is now two structs so we can easily extend.
callback(OutgoingWebRequest *request, OutgoingWebResponse *response)
2023-11-24 12:31:49 +01:00
Bram Matthys eed9d22e3b URL API: work towards callback w/struct -- actually this is an interim step 2023-11-24 12:04:28 +01:00
Bram Matthys 3548b7e2af New URL API (not really a unrealircd module api tho) - work in progress.
No longer url_start_async(a,b,c,d,e,f,g,...) but usings structs so
simply url_start_async(tehstruct);
makes it easy to add fields later without forcing all modules to
change the prototype.

Work in progress....
2023-11-24 11:27:39 +01:00
Bram Matthys 8d34987ad1 Bump UNREAL_VERSION_TIME
[skip ci]
2023-11-24 09:26:07 +01:00
Bram Matthys be586531bc Make get_central_api_key() an efunction rather than doing things by hooks.
An efunction with a default that returns NULL, so you don't need to
load the module if you don't want the functionality.
2023-11-24 09:24:10 +01:00
Bram Matthys d73c8b30d2 Fix compile problem with central-blocklist on FreeBSD. 2023-11-24 09:13:13 +01:00
Bram Matthys d85ed7a51f For set::hide-ban-reason add a new option auto and make it the default.
This will hide the *LINE reason to other users if the *LINE contains the
IP of the user. This to protect the privacy of the user for cases such
as a KLINE due to a blacklist with a DroneBL URL.
Other possible settings are `no` (never hide, the previous default) and
`yes` to always hide the *LINE reason. In all cases the user affected by
the server ban can still see the reason and IRCOps too.

https://bugs.unrealircd.org/view.php?id=6362
2023-11-22 14:48:14 +01:00
Bram Matthys 36d12d2d82 Bump version to 6.1.3-git 2023-11-22 08:38:27 +01:00
k4be fb6711c671 Improve MONITOR/WATCH extensibility.
The `watch-check` function now has a new argument which can be used to pass data to watch_notify callbacks.
New `watch_add` and `watch_del` hooks are called whenever new entries are created or removed.
New `monitor_notification` hook is called whenever a RPL_MONONLINE or RPL_MONOFFLINE is being sent, so a module can add its own notification besides it.
2023-11-19 14:01:16 +01:00
Bram Matthys 2627d09044 Get rid of compiler check (core vs modules) and clean the modversion check too 2023-11-12 20:05:47 +01:00
Bram Matthys d2ccba80c5 Moddata fixes: LoadPersistent*()/SavePersistent*() and removing mdata.
The LoadPersistent*()/SavePersistent*() functions caused moddata to be
tagged with ->unloaded=1. Though it seems it caused no real issues this
is not good... we now properly tag them as 0 and the like. Also did a
code cleanup / overhaul on that system as well.

For other ModData we now handle the case where a module is loaded with
with a newer version and that newer version is no longer having certain
moddata, eg the name changed or it no longer needs it.
KNOWN ISSUE:
Unfortunately we cannot call the free function for the old moddata that
is no longer being handled by the newer version of the module, since the
module is already unloaded. So this will result in a memory leak, but
not in a crash.

KNOWN ISSUE:
Similarly, for SavePersistentPointer() there is a free function, again
this is called just fine if the module is permanently unloaded but NOT
if the module is reloaded with the same name and no longer is interested
in the persistent pointer object. Again, here too, that would result
in a memory leak but not in a crash.

Fortunately the "known issues" are rare. Fixing these is impossible
with the current module API because modules are unloaded after MOD_TEST
and before MOD_INIT, and only after MOD_INIT we know which moddata
is handled by the new version of the module. To change that we would
need to keep the old module around until after MOD_INIT of the new
module (so we can call free functions in the old module), but that
means delaying the MOD_UNLOAD for the old modules until after MOD_INIT
of the new modules, which changes the sequence too much that i don't
dare to do that. For example, it would mean a database save routine
in the old module would only be called after MOD_INIT finished in the
new module, which may be unexpected since right now MOD_UNLOAD is
called before MOD_INIT and maybe the db loading is done in MOD_INIT,
which would need to be moved to MOD_LOAD. That's just one example,
there may be others. I think such a change can only be done on a major
UnrealIRCd version change, so we will have to live this for now.
As said, fortunately it is a corner case.
2023-11-10 10:08:50 +01:00
Bram Matthys f2f11a4637 Reserve more file descriptors. Eg when 10.000 are available, reserve 250.
Since 10k+ fd's available is the common situation, this means we then have
250 fd's reserved for non-clients, such as HTTPS callbacks and other things.

Previously:
<1024: reserve 4 fd's
1024+: reserve 8 fd's

Now:
<1024: reserve 8 fd's
1024-2047: reserve 16 fd's
2048-10000: reserve 32 fd's
10000+: reserve 250 fd's
2023-10-25 12:08:52 +02:00
Bram Matthys 099e99504f Make autoconf check for getsockopt TCP_INFO and define HAVE_TCP_INFO
At the moment only for third/centralblocklist

Also bump #define UNREAL_VERSION_TIME    202343
2023-10-23 10:35:15 +02:00
Bram Matthys 5b7e375213 Limit operclass name to a-zA-Z0-9_- and use the same validation in ~operclass extban.
This fixes the issue where +e/+I ~operclass:name gets cut off if the
name contains any digits.

Reported by BlackBishop in https://bugs.unrealircd.org/view.php?id=6353

Also, we previously allowed any characters in the operclass, which is not
a great idea.
2023-10-23 09:51:01 +02:00
Bram Matthys 1347ffad1d ** UnrealIRCd 6.1.2.3 ** 2023-10-13 07:45:13 +02:00
Val Lorentz a906131689 url_unreal: Fix build (#262)
Broken by 9a6a06b63f
2023-10-12 05:12:56 +00:00
Bram Matthys a04295c588 Add set::dns and increase DNS timeout for DNSBL (3000ms first, then on retry 6000ms).
This is quite a bit higher than client DNS lookups (1500ms first, on retry 3000ms)
and is because some DNSBL are reported to be quite a bit slower than ordinary DNS.
(Maybe just some, but.. the higher timeout does not hurt anyone anyway)

Note that all this has no effect on client handshake times, as DNSBL checks are
done in the background. Only side-effect is that if we do get a "late hit" then
you may now see a kill a few seconds after the client is online (which was actually
already possible before too for quick clients, but.. yeah...)

These settings can be overriden via set::dns, these are the defaults:

set {
        dns {
                client {
                        timeout 1500;
                        retry 2;
                }
                dnsbl {
                        timeout 3000;
                        retry 2;
                }
        }
}

When you REHASH we will check if the values are different than the current
c-ares settings and if so, reinitialize the resolver. Reinitializing the
resolver will destroy outstanding DNS requests, eg DNS lookups for clients
currently connecting, but so be it. Not a super-huge issue since changing
this is rare.

Requested by BlackBishop in https://bugs.unrealircd.org/view.php?id=6306
2023-10-11 19:04:06 +02:00
Bram Matthys 9a6a06b63f Split resolver channel into two: client & dnsbl 2023-10-11 18:08:26 +02:00
Bram Matthys 552d72cbaa ** UnrealIRCd 6.1.2.2 ** 2023-10-06 09:37:51 +02:00
Bram Matthys 59c11d8b23 Add support for "REHASH -centralspamfilter" (alias "REHASH -cs") to force
an immediate fetch+load of central spamfilter rules, so you don't have
to wait an hour (or whatever is configured).
2023-10-06 08:49:43 +02:00
alice 1d34753f18 Fix minor compiler warning on conflicting types for Auth_Hash (PR #261)
auth.c:569:13: error: conflicting types for 'Auth_Hash' due to enum/integer mismatch; have 'const char *(AuthenticationType,  const char *)' [-Werror=enum-int-mismatch]
  569 | const char *Auth_Hash(AuthenticationType type, const char *text)
In file included from include/unrealircd.h:32, from auth.c:21:
include/h.h:547:26: note: previous declaration of 'Auth_Hash' with type 'const char *(int,  const char *)'
  547 | extern const char       *Auth_Hash(int type, const char *para);
2023-10-05 05:43:17 +00:00
Bram Matthys 931eea475c ** UnrealIRCd 6.1.2.1 ** 2023-10-04 10:22:43 +02:00
Bram Matthys 088d2595d5 Fix crash on REHASH with crule (such as spamfilter::rule).
This happens when !, || or && are used, though the exact requirements
for the crash may also require a function with arguments.

Reported by BlackBishop.
2023-10-04 10:14:09 +02:00
Bram Matthys a780968dee ** UnrealIRCd 6.1.2 ** 2023-10-04 07:11:36 +02:00
Bram Matthys 87295deb67 Remove client->local->next_nick_allowed which is unused nowadays.
It was moved to the generic anti-flood framework which is
FloodCounter flood[MAXFLOODOPTIONS];
2023-10-02 14:26:01 +02:00
Bram Matthys 31fa1340c7 Almost forgot version bump in setup.h
[skip ci]
2023-09-23 11:46:53 +02:00
Bram Matthys 64a8608a0f ** UnrealIRCd 6.1.2-rc2 ** 2023-09-23 11:40:31 +02:00
Bram Matthys b234e13358 Don't bump reputation scores anymore for users who are in no channels or
when they are only in channel(s) with very low member counts.

This because some typical bot/drone behavior is not to join any channels.
This kinda forces them to expose themselves a bit more (and if they don't,
they don't get more reputation).

The downside is for the unusual case where a legit chatter would be on
the network but not joining any channels, but that is rare. In any case,
this setting can be adjusted if that is typical or more normal behavior
on your network :D.

* The [reputation score](https://www.unrealircd.org/docs/Reputation_score)
  of connected users (actually IP's) is increased every 5 minutes. We still
  do this, but only for users who are at least in one channel that has 3
  or more members. This setting is tweakable via
  [set::reputation::score-bump-timer-minimum-channel-members](https://www.unrealircd.org/docs/Set_block#set::reputation).
  Setting this to 0 means to bump scores also for people who are in no
  channels at all, which was the behavior in previous UnrealIRCd versions.
2023-09-17 11:47:34 +02:00
Bram Matthys 97630b4717 Allow setting reputation in https://www.unrealircd.org/docs/Actions via
action { set REPUTATION--; } and similar.

Also enhancement to reputation S2S traffic, to support decreasing:
  *
+ * Since UnrealIRCd 6.0.2+ there is now also asterisk-score-asterisk:
+ * :server REPUTATION 1.2.3.4 *2*
+ * The leading asterisk means no reply will be sent back, ever, and the
+ * trailing asterisk will mean it is a "FORCED SET", which means that
+ * servers should set the reputation to that value, even if it is lower.
+ * This way reputation can be reduced and the reducation can be synced
+ * across servers, which was not possible before 6.0.2.
+ *

So if you are actually decreasing reputation, you need all servers on
6.0.2 or higher for it to work properly, otherwise the other servers
don't decrease it, and next connect the highest wins again, etc.
2023-09-17 09:39:55 +02:00
Bram Matthys 660a501617 ** UnrealIRCd 6.1.2-rc1 ** 2023-09-08 17:46:18 +02:00