Bram Matthys [Sun, 30 May 2021 17:32:48 +0000 (19:32 +0200)]
If no log { } block is present, we used to only log errors to ircd.log.
From now on we simply enable ALL logging to ircd.log, so also connects,
kills, and so on.
Bram Matthys [Sun, 30 May 2021 17:09:46 +0000 (19:09 +0200)]
All violatons of target-flood, nick-flood, join-flood, away-flood,
invite-flood, knock-flood, max-concurrent-conversations are now
reported to opers with the snomask 'f' (flood).
Bram Matthys [Sun, 30 May 2021 16:40:03 +0000 (18:40 +0200)]
The set:anti-flood block has been redone so you can have different limits
for "unknown-users" and "known-users".
As a reminder, by default, "known-users" are users who are identified
to services OR are on an IP that has been connected for over 2 hours
in the past X days.
See https://www.unrealircd.org/docs/FAQ#new-anti-flood-block
for more information on the layout of the new block.
NOTE: This actual feature, the relase notes and the documentation
are all work in progress.
Bram Matthys [Sun, 30 May 2021 12:50:27 +0000 (14:50 +0200)]
Make pretty_time_val() output like "2m30s" instead of "2 minutes 30 seconds".
I think people will understand both and it is currently rather long.
And a bit confusing too with all the spaces, easy to overlook something eg
in /STATS S where it is being used.
Bram Matthys [Fri, 28 May 2021 07:14:40 +0000 (09:14 +0200)]
Add support for +draft/reply and load the module by default.
See https://ircv3.net/specs/client-tags/reply for the draft.
Can be used by clients to indicate to which message they are writing
a reply. This can be especially useful for bots, to indicate that
a response belongs to a user request, eg a !trigger.
Bram Matthys [Tue, 25 May 2021 18:25:31 +0000 (20:25 +0200)]
Add the ability to SPAMFILTER message-tags.
The new target type is called 'T' and we match against "name=value"
of each message tag (or just "name" if it is without value).
Example: SPAMFILTER ADD -simple T kill 0 this_is_a_test +typing=active
(No this is not a suggestion :D)
This probably won't be used much at all, but it is good to have the
option available in case there is some massive problem,
especially since more message tags may pop up sooner or later.
Caveat: this is actually a bit slow as we may have to check multiple
message tags for a single line.
If there are zero message-tag spamfilters then we will automatically
short-circuit and save all this CPU, which will be the most common case.
Bram Matthys [Mon, 24 May 2021 07:48:57 +0000 (09:48 +0200)]
Allow setting set::history::channel::playback-on-join::lines to zero
in case you want to disable this feature.
Note that clients that are using CHATHISTORY will already no longer
receive history-on-join ("push") since they REQ a CAP that will inhibit
this and they will "pull" the history instead when they want/need to.
So... this option is really only there if you want to disable it for
non-CHATHISTORY-clients.
Bram Matthys [Mon, 24 May 2021 06:38:07 +0000 (08:38 +0200)]
Fix crashreporter to show big warning if you have 3rd party modules
loaded. The code to raise this warning was already present but it
was not being shown in many cases (when it actually should).
It now looks like this, if you run ./unrealircd start and previously
crashed AND have any 3rd party mods loaded:
The IRCd has been started now (and is running), but it did crash 1 seconds ago.
Crash report generated in: /home/ircd/unrealircd/tmp/crash.report.core.1621838267.txt
** IMPORTANT **
Your UnrealIRCd crashed and you have 3rd party modules loaded (modules created
by someone other than the UnrealIRCd team). If you installed new 3rd party
module(s) in the past few weeks we suggest to unload these modules and see if
the crash issue dissapears. If so, that module is probably to blame.
If you keep crashing without any 3rd party modules loaded then please do report
it to the UnrealIRCd team.
The reason we ask you to do this is because MORE THAN 95% OF ALL CRASH ISSUES
ARE CAUSED BY 3RD PARTY MODULES and not by an UnrealIRCd bug.
Shall I send a crash report to the UnrealIRCd developers?
NOTE: If the crash is caused by a 3rd party module then UnrealIRCd devs can't fix that.
Bram Matthys [Sun, 23 May 2021 11:55:40 +0000 (13:55 +0200)]
Make history backend non-PERM so it can be upgraded on the fly.
Tested:
* Rehashing and sending messages before after (multiple times)
* Terminating
* Unloading by commenting out
Bram Matthys [Sat, 22 May 2021 15:40:38 +0000 (17:40 +0200)]
Set new maximums for channel mode +H. If the channel is +r then the maximum
is now 5000 lines / 31 days. For unregistered it is 200 lines / 31 days.
Previous setting was 200 lines / 7 days for both.
Admins can tweak these settings, see:
https://www.unrealircd.org/docs/Set_block#set::history
More code to deal with corner issues will follow later.
UnrealIRCd module coders [!]:
This also changes the channel mode API conv_param. You can use
the UNREAL_VERSION_TIME >= 202120 condition to detect this.
Eg:
#if UNREAL_VERSION_TIME < 202120
int my_conv_param(char *para, Client *client);
#else
int my_conv_param(char *para, Client *client, Channel *channel);
#endif
Bram Matthys [Sat, 22 May 2021 12:41:57 +0000 (14:41 +0200)]
Change chanmode +H parameter to show hours and days when needed and
possible if it rounds off nicely, eg +H 100:7d. Note that the
existing syntax is still accepted, eg +H 20:1440 and +H 20:1440m
are both converted to 20:1d.
With potentially higher time values this change makes the mode
parameter a lot more readable.
Support for translating timevalues is already in UnrealIRCd 5.0.2
and higher, so should be fine for nearly everyone.
Bram Matthys [Wed, 19 May 2021 12:30:42 +0000 (14:30 +0200)]
Add initial version of CHATHISTORY command
from https://ircv3.net/specs/extensions/chathistory
Current status of the module in UnrealIRCd:
* A significant part of this is done and working
* Currently in modules.optional.conf to get test exposure,
not yet loaded by default.
* CHATHISTORY subcommands implemented: BEFORE, AFTER, LATEST, AROUND
* It does not implement the subcommand "BETWEEN" yet
* It does not announce or recognize the (draft) CAP's yet
* It does not announce the ISUPPORT token CHATHISTORY=xx yet
* Testcases need to be written to validate everything
* There will be bugs, now, and also while implementing the rest
in the days to come.
Bram Matthys [Mon, 17 May 2021 13:18:28 +0000 (15:18 +0200)]
Allow secret::password-file to only exist on-boot, so after booting
the file is allowed to no longer exist. This so you can do things
like only connecting an USB stick during UnrealIRCd boot and then
pull it out once booted.
Bram Matthys [Mon, 17 May 2021 09:47:28 +0000 (11:47 +0200)]
* Make channeldb write the db on terminate
* Fix channel history issues with writing on terminate
* Change tkldb and reputation to only write the db
on terminate and not on every REHASH anymore
..all this thanks to the new loop.ircd_terminating, so modules can
see the difference between regular rehash and terminating.
Bram Matthys [Mon, 17 May 2021 09:43:46 +0000 (11:43 +0200)]
Add ModuleSetOptions(modinfo->handle, MOD_OPT_UNLOAD_PRIORITY, priority);
so modules can indicate if they wish to be unloaded before or after others.
This is used by the channel and history modules so they can save their
databases before the chanmodes modules are unloaded.
Also, made ModuleSetOptions() a void function. I don't think anyone
used the returned value and it now no longer is strictly bitmask add/del
so returning an unsigned int would be a tad confusing.
Bram Matthys [Mon, 17 May 2021 07:02:04 +0000 (09:02 +0200)]
Give UnrealIRCd 10 seconds to terminate insteads of just 1, now that
we may have more database writing to do on terminate.
Actually 10 seconds would be really long, but 2-3 seconds may be
quite realistic if you have lots of TKLs, permanent channels,
reputation entries (users), etc.
Oh yeah, and I really hate writing PORTABLE shell code...
Bram Matthys [Sun, 16 May 2021 15:49:39 +0000 (17:49 +0200)]
Add CAP unrealircd.org/history-backend which declares the policy/
configuration on how history is stored (in memory and/or on disk).
This is similar to other disclosing policies like
unrealircd.org/link-security and unrealircd.org/plaintext-policy.
The reason for this cap (and similarly the other caps) is that
the user can make an informed decision on whether it finds the
policy/safety/privacy of an acceptable level or not.
Fixes for turning persist on/off on the fly (REHASH)
Bram Matthys [Sat, 15 May 2021 13:43:07 +0000 (15:43 +0200)]
Add support for persistent channel history, if the channel is +P and +H.
This is not enabled by default and requires additional configuration,
documentation will follow later.
Bram Matthys [Wed, 5 May 2021 16:59:09 +0000 (18:59 +0200)]
Make UnrealDB big-endian-proof. Rather rare, but you never know
on what hardware people end up running UnrealIRCd.
Also (unrelated) add a check for >64kb strings in unrealdb_write_str()
and return an API error. That too is unlikely to ever happen, but..
better be correct.
Bram Matthys [Wed, 5 May 2021 11:44:33 +0000 (13:44 +0200)]
Windows: Ignore compiler warning C6029 in unrealdb.c as it is a false positive.
src/unrealdb.c(462): error C2220: warning treated as error - no 'object' file generated
src\unrealdb.c(379) : warning C6029: Possible buffer overrun in call to 'fread': use of unchecked value 'c'.
[..fread of c->config->saltlen..]
if (c->config->saltlen > 1024)
{
unrealdb_set_error(c, UNREALDB_ERROR_HEADER, "Header is corrupt (saltlen=%d)", (int)c->config->saltlen);
goto unrealdb_open_fail; /* Something must be wrong, this makes no sense. */
}
c->config->salt = safe_alloc(c->config->saltlen);
if (fread(c->config->salt, 1, c->config->saltlen, c->fd) != c->config->saltlen)
Bram Matthys [Tue, 4 May 2021 08:47:03 +0000 (10:47 +0200)]
Document UnrealDB API and get rid of unrealdb_write_data/unrealdb_read_data.
API users must use specific size/type functions instead, otherwise it is
simply too dangerous / too easy to overlook issues.
Bram Matthys [Tue, 4 May 2021 07:07:37 +0000 (09:07 +0200)]
UnrealDB: check for write errors in all conditions (not just some)
And set the error message/code properly. Didn't set it before because of
'c' being freed, but we have unrealdb_get_error_code() and
unrealdb_get_error_string() now that can (and should) still be used
in such cases.
Fix extended server ban ~a:accname not working for shun and also
not always kicking in on *line either.
We now check for shuns/*lines in user_account_login(), so upon
SASL or NS IDENTIFY etc. This also means that the client could
now be killed in that function, so callers should take extra
care and take that into account. We check for IsDead() in our
calls now (if it's our client anyway).