1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-28 10:56:38 +02:00
Commit Graph

2597 Commits

Author SHA1 Message Date
Bram Matthys d48ccb1ec8 When rpc.modules.default.conf is loaded, remember last 1000 lines of log
entries for a maximum of 7 days, in memory.
[skip ci]
2023-05-05 12:16:54 +02:00
Bram Matthys 1dcef57970 Add safe_json_decref() which sets pointer to NULL after decref. 2023-05-05 09:51:09 +02:00
Bram Matthys 95074410a5 Set version to 6.1.1-git
[skip ci]
2023-05-05 09:50:48 +02:00
Bram Matthys 5d3319d662 Whoops.. fix windows compile issue :D. Let's not add a random x there. 2023-05-05 07:46:32 +02:00
Bram Matthys 1317784de1 ** UnrealIRCd 6.1.0 ** 2023-05-05 07:32:22 +02:00
Bram Matthys c400e9282e Remove CCM ciphers, which are likely unavailable anyway. 2023-04-27 13:16:15 +02:00
Bram Matthys 2922a8ae5a Fix crash if there is a parse error in an included file and there are
other remote included files still being downloaded.
This issue exists both with and without cURL, so in both url interfaces.

Was finally able to reproduce this on my own machine. This bug exists
since at least 6.0.0 and perhaps even before that. Just doesn't get
triggered that often due to needing an error and a certain timing
condition (well, and ASan catches it, but on some systems it may
go unnoticed).
2023-04-22 14:08:29 +02:00
Val Lorentz ebcfe6a6bc Add sendtaggednumeric/sendtaggednumericfmt (#250)
They are similar to sendnumeric/sendnumericfmt, but allow an array of message
tags are parameter.

sendnumeric/sendnumericfmt are now shorthands for sendtaggednumeric/sendtaggednumericfmt
which pass NULL as mtags.
2023-04-15 14:34:38 +00:00
Bram Matthys 2b1fad89be ** UnrealIRCd 6.1.0-rc2 ** 2023-04-15 14:08:47 +02:00
Bram Matthys 4b448f2aaa New option listen::spoof-ip, only valid when using UNIX domain sockets
(so listen::file). This way you can override the IP address that users come
online with when they use the socket (default was and still is `127.0.0.1`).

Add a new guide https://www.unrealircd.org/docs/Running_Tor_hidden_service_with_UnrealIRCd
which uses the new listen::spoof-ip and optionally requires a services account.
2023-04-15 10:37:30 +02:00
Bram Matthys 7ad160f57a JSON-RPC: WHOWAS fetching is now whowas.get, also expose not only
logon_time/logoff_time but also connected_since.

This also fixes the Makefile for the Windows build (i hope)
2023-04-15 09:24:57 +02:00
Bram Matthys 2184f38e7e Expose more WHOWAS fields in JSON-RPC and change add_history() to take a reason
for the add, like: nick-change, quit, server terminating. Add logon time.

I also think i will move from user.get_whowas to a whowas.XXX since the
returned object is not a user object and getting more different each commit :D.
2023-04-15 09:00:06 +02:00
Bram Matthys e7e2a5a275 whowasdb: write currently online users as well, as if they already
left. This so, if we die, there is still a history of them.
2023-04-15 08:17:54 +02:00
Bram Matthys 45201fffe7 New module 'whowasdb': persistent WHOWAS history (preserved between reboots) 2023-04-14 19:29:45 +02:00
Bram Matthys 66b8259234 JSON-RPC: don't do filtering on low ASCII like we do for JSON logging.
This way things like the TOPIC will keep their color codes if they have it.

Reported by armyn in https://bugs.unrealircd.org/view.php?id=6259

(And yeah i used a global to achieve this, otherwise it has too much
 of a cascading effect in XYZ functions)
2023-04-13 18:53:49 +02:00
Bram Matthys 7c22f37a9f JSON-RPC: add log.subscribe and log.unsubscribe
https://www.unrealircd.org/docs/JSON-RPC:Log
2023-04-08 17:56:59 +02:00
Bram Matthys ec7077f4a1 ** UnrealIRCd 6.1.0-rc1 ** 2023-04-07 14:54:43 +02:00
Bram Matthys 254afbb9c6 Make set::hide-ban-reason not affect opers (eg. show full gline reason).
Suggested by Chris_dc in https://bugs.unrealircd.org/view.php?id=6252

This uses unrealircd.org/real-quit-reason internally, but is only
exposed to servers, never to users. It results in using that quit
reason for IRCOps, while using the regular quit reason for normal users.
2023-04-05 07:26:12 +02:00
Bram Matthys a19b2aebf6 New cmode.flood_type_action which can be used to indicate a channel mode
can be used from +f/+F as an action. You need to specify for which
flood type your mode is, eg `cmode.flood_type_action = 'j';` for joinflood.

Currently a mode can only choose one flood type action due to +f/+F
timer fights that could otherwise occur, but that shouldn't be too
much of an issue since we can live with that in core as well.
2023-04-02 18:14:45 +02:00
Bram Matthys 1e315bb953 Add and use command_issued_by_rpc() helper function for internal logging
of commands issued by JSON-RPC.
2023-04-02 16:04:17 +02:00
Bram Matthys 50c3ed2c24 Add unrealircd.org/issued-by if using RPC call channel.set_mode
This also changes the set_channel_mode() function to have
an extra arguments MessageTag *mtags (2nd parameter).
2023-04-02 12:06:52 +02:00
Bram Matthys b914997a1c Update cmode.free_param definition to fix memleak due to yesterdays commit.
And update release notes technical note so it actually refers to the
correct channel mode function :D
2023-04-02 08:24:00 +02:00
Bram Matthys b093ba5375 Set version to 6.1.0-git. 2023-04-01 17:32:34 +02:00
Bram Matthys ce75ddd167 Bump UNREAL_VERSION_TIME (been a while)
[skip ci]
2023-04-01 17:05:33 +02:00
Bram Matthys 7b7d436bba Add support for set::anti-flood::channel::default-profile
https://www.unrealircd.org/docs/Channel_anti-flood_settings#Default_profile
2023-04-01 17:01:59 +02:00
Bram Matthys 89f75bd6e7 Fix some warnings: change an int to time_t and vice-versa 2023-04-01 09:52:19 +02:00
Bram Matthys a3c151a16a RPC: add rpc.set_issuer, eg set to logged in user on the admin panel.
This so UnrealIRCd knows who is issuing the commands.
This information is then passed on to unrealircd.org/issued-by and
is planned to be used by the logging system too.

https://www.unrealircd.org/docs/JSON-RPC:Rpc#rpc.set_issuer
2023-03-31 12:55:31 +02:00
Bram Matthys 5871bd9463 Initial work on unrealircd.org/issued-by message tag.
This will communicate the original issuer of a command.
For example an "SAMODE #test +s" results in a SAMODE coming from
:maintest.test.net MODE ....etc....
And with this feature, we will communicate the IRCOp who did it:
@unrealircd.org/issued-by=OPER:Syzop..etc....
This tag is only sent to servers and to IRCOps, not to ordinary users.

The plan is to support the following variants:
Services: unrealircd.org/issued-by=SERVICES:NickServ@services.test.net
IRCOp:    unrealircd.org/issued-by=OPER:Syzop@maintest.test.net:Operblock_name
JSON-RPC: unrealircd.org/issued-by=RPC:adminpanel@irc1.test.net:Adminpanel_Actual_User

This first commit only adds SERVICES and OPER in the handlers of the
SVSNICK and SAMODE commands. The JSON-RPC variant and all of the other
commands have not been done yet.
2023-03-31 12:17:54 +02:00
Bram Matthys 957af0909b RPC: channel.get and channel.list now have optional object_detail_level.
This is an integer which decides the amount of details in the response object.

For the channel.* calls the object_detail_level is one of:
0: only return the channel name, nothing else
1: basic channel information only
2: this adds bans, ban_exemptions, invite_exceptions
3: also show members, but only level/name/id
4: also show members, level/name/id/hostname/ip/details/geoip
5: also show members, level and full user details like user.get

When no object_detail_level is specified, the following defaults are used:
For channel.list the default is 1 (matches current 6.0.6 behavior)
For channel.get the default is 3 (matches current 6.0.6 behavior)

Using channel.list with object_detail_level=5 is forbidden because
it would cause way too much output (and processing time).
2023-03-27 09:56:03 +02:00
Bram Matthys 04ce8f8ed7 Add helper functions 2023-03-25 12:19:44 +01:00
Bram Matthys 748f381d81 Use X509_check_host() in OpenSSL 1.1.0 and later and don't use it
for OpenSSL 1.0.2 anymore, 1.0.2 will use the fallback version.
This changes the include file.

(OpenSSL 1.0.2 is out of support since Jan 1 2020 so one may wonder
 why care at all, but i'm trying not to break that during minor
 UnrealIRCd releases)
2023-03-25 12:18:44 +01:00
Bram Matthys 78ce692357 Move ban_exists() to the core (was a helper function in channeldb) 2023-03-25 10:38:05 +01:00
Bram Matthys 5f36221869 Add OpenSSL include to fix compile warning.
X509_check_host() requires openssl/x509.h -- well except on
newer OpenSSL's apparently :D
2023-03-25 10:32:12 +01:00
Bram Matthys 24622144b1 Bump version to 6.0.8-git
[skip ci]
2023-03-25 09:19:41 +01:00
Bram Matthys 83d2498ec8 Add configure check for and use X509_check_host() instead of
always using our own implementation (that is not really ours,
by the way).
2023-03-25 08:31:25 +01:00
Bram Matthys 89611887cb Previous fix for big tags was insufficient. 4K+4K+512 rule should now be OK.
This also adds the MAXLINELENGTH define which is set to 4K+4K+512,
it can be used when you are dealing with complete lines (quite rare
in the code, mostly in socket code and labeled response).
And now also #define READBUFSIZE MAXLINELENGTH
but it is used beyond read buffers, als in write buffers of course.
2023-03-25 07:30:22 +01:00
Bram Matthys da3c1c6544 ** UnrealIRCd 6.0.7 ** 2023-03-24 13:26:29 +01:00
Bram Matthys e83c610b39 Add valid_vhost() and validate oper::vhost too just like vhost::vhost.
Actually make them both use this same function, even thought he original
vhost::vhost check was a bit more informational.

This also checks the vhost in other paths that lead to oper vhost setting.

Reported by ji in https://bugs.unrealircd.org/view.php?id=5910
2023-03-22 10:26:05 +01:00
Bram Matthys 4b4562516c Another attempt at UTF8-aware spamfilter.
This was previously tried at 19-apr-2020 in bc70882bd3
in UnrealIRCd 5.0.5. Sadly it had to be reverted immediately with a quick 5.0.5.1
release, all because of a PCRE2 100% CPU usage. Since then that bug has been fixed,
plus another bug. I'm now readding it "as an option" that is marked experimental.
Hopefully people test it out and can report back if it works well and then we can
make it the default someday.

This makes it a runtime setting so makes it much easier to switch back/forth if
there are any issues without recompiling anything. Had to use a bit more code now
though to handle the recompiling of spamfilters if the setting is changed.

Original issue was https://bugs.unrealircd.org/view.php?id=5187

* [Spamfilter](https://www.unrealircd.org/docs/Spamfilter) can be made UTF8-aware.
  * This is experimental, to enable: `set { spamfilter { utf8 yes; } }``
  * Case insensitive matches will then work better. For example, with extended
    Latin, a spamfilter on `ę` then also matches `Ę`.
  * Other PCRE2 features such as [\p](https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC5)
    can then be used. For example you can then set a spamfilter with the regex
    `\p{Arabic}` to block all Arabic script.
    Please do use these new tools with care. Blocking an entire language
    or script is quite a drastic measure.
  * As a consequence of this we require PCRE2 10.36 or newer. If your system
    PCRE2 is older than this will mean the UnrealIRCd-shipped-library version
    will be compiled and `./Config` may take a little longer than usual.
2023-03-22 09:00:31 +01:00
Bram Matthys 8a48cfb664 Fix not sending CAP DEL on module unload.
Reported by westor in https://bugs.unrealircd.org/view.php?id=6104
The code was there but the order of which the checks were done was
wrong, so first it was checking which CAP's were unloaded and after
that it was unloading the CAP, instead of the other way around.

Also renamed the function to clicap_check_for_changes()
to be consistent with other runtime change detection functions
like extcmodes_check_for_changes(), umodes_check_for_changes()
and charsys_check_for_changes().
2023-03-20 10:55:22 +01:00
Bram Matthys a1e7e9f882 Move deny link { } handling to server module. 2023-03-20 09:09:03 +01:00
Bram Matthys 5c108e0ec3 Don't fetch GeoIP.dat upon blacklist-module geoip_classic;
Reported in https://bugs.unrealircd.org/view.php?id=6100

Actually this only works if you have a:
blacklist-module geoip_classic;
in your conf and that conf is read before modules.default.conf
This is true if you have that blacklist-module line in your
unrealircd.conf, so should cover most cases.
2023-03-19 11:28:23 +01:00
Bram Matthys 15c8da2be8 Send ERR_INPUTTOOLONG (417) on oversized message-tags, as per
https://ircv3.net/specs/extensions/message-tags
Reported by progval in https://bugs.unrealircd.org/view.php?id=5949
2023-03-19 10:13:58 +01:00
Bram Matthys 951b913800 Update crule.c, re-porting it from ircu, to hopefully fix some bug(s).
Reported by 9pfs in https://bugs.unrealircd.org/view.php?id=6248

This is completely untested (other than ./unrealircd start), so
feedback from people who actually use crule like in deny link { }
is very much welcomed.
2023-03-19 08:38:54 +01:00
Bram Matthys 0428819c03 Add security group "websocket-users" and add security-group options
security-group::websocket and security-group::exclude-websocket,
all similar to how security-group::webirc works but for websocket.
Suggested by PeGaSuS in https://bugs.unrealircd.org/view.php?id=5598
and Nini in https://bugs.unrealircd.org/view.php?id=6222
2023-03-17 18:57:59 +01:00
Bram Matthys cdb36e7e30 WHOWAS: Show IP address and account to IRCOps.
Thanks to Noisytoot for https://github.com/unrealircd/unrealircd/pull/227
who suggested displaying account and provided a partial patch, and
armyn in https://bugs.unrealircd.org/view.php?id=6153 suggesting IP.

I chose to use the existing RPL_WHOIS* numerics that we also use for
returning WHOIS data. We already use RPL_WHOISSERVER in WHOWAS for
ages and the use of it is mentioned in RFC1459, so seems like that
was the idea right from the beginning of times. The only change I did
was from "is" to "was" in like "was logged in" and "was connecting from"
in the text of the numerics.
2023-03-17 18:10:46 +01:00
Bram Matthys c6c8bba311 Add find_server_by_uid() which hunts a server for the SID-portion of A UID.
Not sure if this is the best name, maybe I come up with a better one later.

The purpose of this function is so we can deliver certain messages to
pre-auth users, that is: users that are not fully registered yet.
This would mostly be used (perhaps exclusively) in SASL stage.
2023-02-08 10:10:27 +01:00
Bram Matthys dd830261db Reject a link for anope or atheme if there is no ulines { } for it.
This is checked for both local and remote services linking in.

Naturally, the list can be expanded to include more services that
really need ulines { }, and not statistical services or some other
purpose non-unrealircd servers, which is the reason why cannot
blindly assume all non-unrealircd servers require ulines.

This should hopefully help users a lot with "mysterious" issues
with services that we see too often in the support channel.
Suggested in https://bugs.unrealircd.org/view.php?id=5742

Note that this does require services to communicate their software
version via EAUTH. Anope does this for years already, but atheme only
does so since 10 days ago (git only, presumably not released yet)
after Valware filed a PR.
2023-02-08 09:02:44 +01:00
Bram Matthys 01fd2da627 ** UnrealIRCd 6.0.6 ** 2023-02-03 06:56:16 +01:00
Bram Matthys b1139769e1 Do some basic filtering on the request by default.
This ensures that strings are of maximum 510 characters in length
and do not contain \n or \r.
Solves a lot of theoretical problems in many modules that .add
things or do other non-list/non-get actions.

This behavior can be turned off per-method (per handler) by setting
handler->flags = RPC_HANDLER_FLAGS_UNFILTERED;
This is currently not done in any of the modules.
2023-01-16 10:59:41 +01:00