1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-27 01:56:37 +02:00
Commit Graph

6876 Commits

Author SHA1 Message Date
Bram Matthys 2beefcd2ee crule: remove CR_DEBUG, bump some limits and remove collapse() call 2023-07-16 10:40:11 +02:00
Bram Matthys 08cb0fc05d Move crule to a module, so we can hot-patch if needed in the future.
This is a mandatory module to load, and included in modules.default.conf.

This also meant that the crule_test() etc efunctions are available
before running config test routines, so we now have a flag for
early efuncs. I guess we could consider doing that for all efuncs
though, so not sure if this flag is really needed.
2023-07-16 10:33:25 +02:00
Bram Matthys 36fc839022 Support single quotes in spamfilter::rule, for like xyz('bla/bla') 2023-07-16 09:31:02 +02:00
Bram Matthys d5e8e8f324 Add some more spamfilter::rule functions 2023-07-16 09:20:54 +02:00
Bram Matthys cdc14569a9 Warn on plaintext oper::password in conf and even go as far as
generating the password hashes and suggesting using those.

This also starts the initial work on set::best-practices
https://www.unrealircd.org/docs/Set_block#set::best-practices
with hashed-passwords as the first setting there.
2023-07-15 19:02:31 +02:00
Bram Matthys 78c3766038 Showing this "Configuration test passed OK" makes no sense after
"Configuration loaded", i think it was meant for ./unrealircd configtest
only.

[skip ci]
2023-07-15 18:45:57 +02:00
Bram Matthys 202665ec87 For watch away notification, a user who is away could change their nick,
and that nick could be on someones watch list. In such a case we
should not only send RPL_LOGON but also a RPL_GONEAWAY.

Reported by Khaled and fix suggested by Khaled & Sadie.
2023-07-15 16:47:55 +02:00
Bram Matthys 934b0b1ea1 WATCH away notification: fix RPL_GONEAWAY and RPL_REAWAY not being sent
due to wrong event name being used. Noticed this bug in U6 (and
this bug does not exist in U5) after being pointed at watch away
notification again.
2023-07-15 16:41:21 +02:00
Bram Matthys 039dc566ec Lower argon2 parameters so the algorithm runs at a more reasonable speed. 2023-07-15 09:05:59 +02:00
Bram Matthys b3995f48ff Mention password hashing in the example.conf itself.
Suggested by rafaelgrether in https://bugs.unrealircd.org/view.php?id=6303
2023-07-15 09:04:07 +02:00
Bram Matthys ab71636390 Fix downloads_in_progress() always returning 0 if using cURL 2023-07-14 17:01:59 +02:00
Bram Matthys a153a2cce3 Change definition of parse_ban_action_config(), was too easy to leak memory.
Often you have default values for the config, and then a subsequent config
parsing run would overwrite the return value (= memory leak), merging/appending
would make no sense either, so it would force a free in all code before
calling us, well... let's just deal with it ourselves instead then ;)
2023-07-14 08:08:47 +02:00
Bram Matthys c2419e0f40 Implement spamreport::rate-limit 2023-07-11 20:19:00 +02:00
Bram Matthys e9716d3ce6 Fix compile problem on Windows
[skip ci]
2023-07-11 16:26:35 +02:00
Bram Matthys 9625a1221b Make Cmode_t an unsigned long long to have more chanmodes on 32 bit archs.
Reported by BlackBishop in https://bugs.unrealircd.org/view.php?id=6301
[skip ci]
2023-07-11 15:27:13 +02:00
Bram Matthys 767f5647cd Add some explicit cast to fix warning on 32 bit archs.
Yeah we could use %z here nowadays but we don't have strict C99 requirements(?),
well we have some :D

[skip ci]
2023-07-11 15:20:16 +02:00
Bram Matthys 22f8eb8729 Central spamfilter: fix memory leak (freeing ce/cfptr)
[skip ci]
2023-07-11 15:14:58 +02:00
Bram Matthys 2440714d13 Fix tkldb crash, had to do with stealing references. 2023-07-11 14:46:19 +02:00
Bram Matthys 4c3d2a6d6d Fix write bug in tkldb and add spamfilter::action stop.
The spamfilter::action stop ill prevent processing other spamfilters.
This would normally be a bit unusual, and potentially dangerous when you
do exclude things this way, but can be useful in some circumstances.

Stopping only affects the same type of spamfilters (general or central
spamfilters), so they don't interfere.

The tkldb write DB bug had to do with that it was processing
central spamfilters, which should be skipped just like config
based spamfilters were already skipped.
2023-07-11 14:32:11 +02:00
Bram Matthys 32701e6f99 Central spamfilter: don't stop processing on 1 bad spamfilter block. 2023-07-11 13:34:28 +02:00
Bram Matthys 018efd8366 Fix crash in spamfilter { } block handling due to unitialized variable 2023-07-11 12:15:01 +02:00
Bram Matthys f333aa0c09 New option set::spamfilter::show-message-content-on-hit:
you can now configure to hide the message content in spamfilter hit
messages. Generally it is very useful to see if a spamfilter hit is
correct or not, so the default is 'always', but it also has privacy
implications so there is now this option to disable it.

Suggested by alice, quite a while ago.

https://www.unrealircd.org/docs/Set_block#set::spamfilter::show-message-content-on-hit

Also as mentioned there:
UnrealIRCd has the following spying countermeasure (for many years) to help
that spamfilters are not abused for spying. When a spamfilter hit happens
that has an action like gline or blocking, it is visible to the user that an
action was taken. There is also the action 'warn', which means: take no
action and only warn IRCOps, that one would be easy to use as a spy tool, so
when this happens and message content was revealed, numeric 659
(RPL_SPAMCMDFWD) is sent to the client to indicate that the message is
allowed through but IRCOps were informed.
With this new set::spamfilter::show-message-content-on-hit feature, when
the message content was hidden due to this setting (eg due to 'never' or
'channel-only'), the warn message will not be sent as there is no need to
inform the user in such a case.
2023-07-11 12:11:26 +02:00
Bram Matthys 4df6ed7f9a Get rid of duplicate "spamfilter hit" code. 2023-07-11 11:42:06 +02:00
Bram Matthys f277880fb3 Add set::central-spamfilter::limit-ban-action and ::limit-ban-time
to limit actions to limit-ban-action as the highest, and limit
ban times to limit-ban-time the highest, see
https://www.unrealircd.org/docs/Central_Spamfilter

This also changes highest_spamfilter_action() to highest_ban_action().
2023-07-11 10:17:51 +02:00
Bram Matthys 95902979dc Central spamfilter: now every 1hr and a default set::central-spamfilter::except
policy is added. This may be tweaked later.
2023-07-10 20:18:07 +02:00
Bram Matthys 15b9255b0e Add spamfilter::except as an alternative for spamfilter::rule and upd rls notes 2023-07-10 12:12:25 +02:00
Bram Matthys c18c79e88b Add spamfilter hits and hits for exempted users.
* This means we always run spamfilters, even if users are exempts
* This way we can gather hits for exempted users on individual
  spamfilter entries, and possibly detect false positives
  (which relies on the assumption that those users are innocent)
* The hit counters are shown in in RPL_STATSSPAMF and also
  exposed via the JSON-RCP API.
* This commit also adds set::central-spamfilter::except but more
  on that later since i still want to set a default for that in
  a future commit.
* This also changes take_action() to take flags and adds the
  option TAKE_ACTION_SIMULATE_USER_ACTION which i intended to
  use but didn't in the end... not sure if i should keep it :D
2023-07-10 11:30:51 +02:00
Bram Matthys 0c622c0a73 Minor code cleanup and remove weird check for cep->name after a CheckNull()
[skip ci]
2023-07-10 09:59:49 +02:00
Bram Matthys 3fecb779a5 Fix double free in url_unreal.c if HTTPS write failed early.
Not sure if that could possibly get triggered, actually, as
it would mean the (async) SSL_connect() would have to succeed
instantly and then the SSL_write() would have to fail, but
better safe than sorry.
2023-07-10 09:48:58 +02:00
Bram Matthys 01893dbc55 Be nice to people using hybrid-like config syntax...... for now..... ;D 2023-07-09 21:18:41 +02:00
Bram Matthys 1073c6289f And some more crule reformatting/cleanups, could not resist 2023-07-09 17:00:43 +02:00
Bram Matthys c67488573a Some other reformating
[skip ci]
2023-07-09 16:52:34 +02:00
Bram Matthys 349e7a2e51 src/crule.c: re-indent this monster (whitespace changes only, except 1 line) 2023-07-09 16:50:31 +02:00
Bram Matthys d25fdeb950 Some more BanAction fixes/improvements:
* stats S one thingy (multi-actions)
* STATS spamfilter (multi-actions)
* warn w/user target ('u') if using multi-actions
* moving some code
2023-07-09 16:27:40 +02:00
Bram Matthys e26ff1e9cf Add antimixedutf8::action warn handling, and fix generic handling in git version. 2023-07-09 16:20:42 +02:00
Bram Matthys 51a97602ee Fix antirandom::action warn handling in current git.
Reported by Han`.
2023-07-09 16:12:19 +02:00
Bram Matthys 9e2232ef72 For DroneBL spam submissions use "Content-Type: text/xml".
This also bumps the request size limit a bit.
2023-07-09 14:03:35 +02:00
Bram Matthys 0618495962 No comment :D :D 2023-07-09 13:40:37 +02:00
Bram Matthys a68fa03ab5 Fix some small memory leaks on REHASH and fix compile warning w/gcc. 2023-07-09 13:39:00 +02:00
Bram Matthys 3250c7c0b4 Add some temporary safety mechanism if too many HTTP(S) requests in progress.
Will allow tweaking in config later. This is separate from rate-limit btw,
which also still needs to be done.
2023-07-09 13:21:16 +02:00
Bram Matthys dec9aa0341 Reporting spam to DroneBL now works, see https://www.unrealircd.org/docs/Spamreport_block
This uses the RPC2 API. Tested with staging.

Note that there are likely some bugs here or there, like memory leaks,
but the functionality is there.

Also still need to implement various stuff, including spamreport::rate-limit
2023-07-09 13:07:29 +02:00
Bram Matthys 2b14ee3de5 Prepare for future spamfilter::match -> spamfilter::match-string
[skip ci]
2023-07-08 20:14:25 +02:00
Bram Matthys 5d65e4a400 Rename place_host_ban() to take_action() since it is not only about banning... 2023-07-08 19:54:40 +02:00
Bram Matthys 8f4a19978a Deal properly with multi actions in spamfilter (untested) 2023-07-08 19:48:15 +02:00
Bram Matthys 64f57ae243 Add spamfilter::action report (work in progress) 2023-07-08 19:24:15 +02:00
Bram Matthys bee2853ded Add spamreport::type dronebl, actually reports to unrealircd.org atm for testing 2023-07-08 18:13:14 +02:00
Bram Matthys 84786cc005 Add flags argument to buildvarstring_nvp, and add BUILDVARSTRING_URLENCODE
[skip ci]
2023-07-08 18:12:24 +02:00
Bram Matthys 28df14ad43 Add duplicate_nvplist_append()
[skip ci]
2023-07-08 18:10:41 +02:00
Bram Matthys 5f71adeb4d Add urlencode() 2023-07-08 18:10:16 +02:00
Bram Matthys 8b158d214c Fix for change earlier today to buildvarstring/buildvarstring_nvp,
it would stop writing the string after the first variable, not good.
[skip ci]
2023-07-08 17:44:31 +02:00