1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 23:03:11 +02:00
Commit Graph

2984 Commits

Author SHA1 Message Date
Bram Matthys f1e70fa06c whowasdb: work around -Waddress warning for W_SAFE_PROPERTY()
[skip ci]
2023-04-15 09:44:38 +02:00
Bram Matthys 0d2ca78ed8 JSON-RPC: whowas.get: name -> nick rename
[skip ci]
2023-04-15 09:28:09 +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 f0cd1c59c5 JSON-RPC: initial work on user.get_whowas (work in progress) 2023-04-15 07:59:13 +02:00
Bram Matthys 45201fffe7 New module 'whowasdb': persistent WHOWAS history (preserved between reboots) 2023-04-14 19:29:45 +02:00
Bram Matthys 8aa004271f Ban exempt 127.0.0.1 instead of whole 127.*
* We now only exempt `127.0.0.1` and `::1` by default (hardcoded in the source).
  Previously we exempted whole `127.*` but that gets in the way if you want
  to allow Tor with a
  [require authentication](https://www.unrealircd.org/docs/Require_authentication_block)
  block or soft-ban. Now you can just tell Tor to bind to `127.0.0.2`
  so its not affected by the default exemption.

Reported on IRC and by PeGaSuS in
https://bugs.unrealircd.org/view.php?id=6258
2023-04-14 07:34:53 +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 dec834c193 Fix for previous fix (unmasked packets) 2023-04-12 13:17:13 +02:00
Bram Matthys 68171b5582 Websocket: apparently PONG frames are sometimes unmasked, even though
RFC6455 clearly says:
      Defines whether the "Payload data" is masked.  If set to 1, a
      masking key is present in masking-key, and this is used to unmask
      the "Payload data" as per Section 5.3.  All frames sent from
      client to server have this bit set to 1.

But ok, we'll make an exception for PONG.

This caused the websocket connection to be dropped after a while from
the unrealircd-rpc-php library that uses textalk/websocket.
Probably a bug in textalk/websocket or one of its dependencies,
that should be reported...
2023-04-12 12:31:25 +02:00
Bram Matthys 57c90496e8 JSON-RPC: add rpc.add_timer and rpc.del_timer so you can run a command
every <xyz> msec (minimum: 250).
Can be useful to schedule an rpc.stats call every 1000msec for instance.
Of course timers are destroyed if the client exits.

https://www.unrealircd.org/docs/JSON-RPC:Rpc#rpc.add_timer and
https://www.unrealircd.org/docs/JSON-RPC:Rpc#rpc.del_timer
2023-04-12 10:22:33 +02:00
Bram Matthys 9f569078ed Fix bug where a REHASH would cause us to loose track of remote RPC's (RRPC).
Like REHASHing while a module.list is in progress.

This due to missing SavePersistentPointer() in MOD_UNLOAD
2023-04-12 09:08:18 +02:00
Bram Matthys cd3b3ec15d JSON-RPC: Change to previous, don't name it "top_countries" but "countries"
and sort descending so the country with the most users comes first.
(Using silly negative priority tricks, but you won't see that :D)
2023-04-12 08:25:32 +02:00
Bram Matthys 431d2b54c4 JSON-RPC: stats.get now returns "top_countries" (top geo country codes).
It also has an object_detail_level like some other calls.
The "top_countries" are included from object_detail_level 1 and above.
The default object_detail_level is actually 1, so it is included by
default. You can use object_detail_level if you don't want it.

Idea for this was from Valware.

https://www.unrealircd.org/docs/JSON-RPC:Stats#stats.get
will be updated in a minute...
2023-04-12 08:04:20 +02:00
Bram Matthys 3538b944de Fix missing client info from TLS handshake flood log message.
Reported by musk in https://bugs.unrealircd.org/view.php?id=6251
2023-04-10 18:51:19 +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 447ce57009 +F: fixes for if you change the default-profile or unset it,
so these changes are set for all channels without +F.
2023-04-07 15:20:05 +02:00
Bram Matthys 93d825abe5 +F: set default profile if asked to do so via REHASH
[skip ci]
2023-04-07 15:02:40 +02:00
Bram Matthys 854c5976d1 Chanmode +F: re-apply profiles on REHASH (in case anything changed)
TODO: ideally we would only do this if there was a change at all, but ah well.
2023-04-07 14:07:25 +02:00
Bram Matthys 4de91d49df Forgot 'git add' 2023-04-05 08:07:18 +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 e8aef70f03 Fix crash on +f modes merging (SJOIN) due to the 6.1.0 +f/+F changes.
Reported by Valware.
2023-04-05 07:21:52 +02:00
Bram Matthys c5a763de06 mask vs match in webirc 2023-04-04 19:37:07 +02:00
Bram Matthys b07c739fa7 Add new +e ~flood:<floodtype(s)>:<mask> to exempt from +f/+F checks.
For example: +e ~flood:*:~account:TrustedBot

Suggested by PeGaSuS in https://bugs.unrealircd.org/view.php?id=6204

Will refine the checking and perhaps sorting of floodtype(s) later...
2023-04-02 19:23:26 +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 a9b71b58cb Add RPC 'issuer' logging in CHGIDENT, CHGHOST, CHGNAME, SVSMODE
for user.set_username, user.set_vhost, user.set_realname,
user.set_mode. And some early work for other stuff that doesn't
work yet.
2023-04-02 16:18:34 +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 e67f5b6c39 Prepare all user.* with mtag_add_issued_by() for unrealircd.org/issued-by.
The code further up still needs to be changed, though.
2023-04-02 15:56:48 +02:00
Bram Matthys d25d2a23be Minor cleanup: use kick_user() from channel.kick call instead of
emulating an IRC command through do_cmd().
Function was added earlier in a8534a6063
2023-04-02 12:15:32 +02:00
Bram Matthys 9eac6797c6 Add unrealircd.org/issued-by for KICK from JSON-RPC 2023-04-02 12:12:16 +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 0b8f0deb05 SAPART: add unrealircd.org/issued-by, and add RPC-specific logging 2023-04-02 12:01:29 +02:00
Bram Matthys 6ee941fa4c SAJOIN: add unrealircd.org/issued-by, and add RPC-specific logging
(some code will probably be moved to a helper function later)
2023-04-02 11:52:24 +02:00
Bram Matthys f007933348 Document mtag_add_issued_by() and allow for some future case we don't use yet.
[skip ci]
2023-04-02 11:51:50 +02:00
Bram Matthys 4a5b8b3639 +F: the no-flood-limit profile is called "off" now (was: "none") 2023-04-02 11:06:14 +02:00
Bram Matthys cd3cf7e97c Chanmode +F: Lower nick change limit in profiles, now that only real
nick changes are counted and not forced ones like SVSNICK.
2023-04-02 10:59:52 +02:00
Bram Matthys fa4d86009c Move set::modef-boot-delay to set::anti-flood::channel::boot-delay
and the new set::modef-split-delay to set::anti-flood::channel::split-delay.
See https://www.unrealircd.org/docs/Channel_anti-flood_settings#config
2023-04-02 10:25:25 +02:00
Bram Matthys 22a632fb88 Fix memory leak in RPC module on server disconnect.
The "rrpc" moddata was not freed, which contained the list of RPC modules
on a remote server.
2023-04-02 08:36:10 +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 8776557b3d JSON-RPC: make server.list use a default max detailed level, the
same one as server.get. This list is likely to be small, anyway.
This is how it was with <6.0.8. Reported by Lord255.
2023-04-01 18:17:42 +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 22691a458b Don't count forced nick changes in floodtype 'n' in chanmode +f/+F.
These were already not counted for set::anti-flood::xx::nick-flood
and it makes sense.
Benefit of this is that limits for floodtype 'n' can be set tighter,
as now it is really only about manual (voluntarily) nick changes.
2023-04-01 13:26:34 +02:00
Bram Matthys a83cd474af Change RPC logging format for rpc.RPC_CALL:
From: [rpc] Client RPC:adminpanel (Syzop): RPC call channel.set_mode: channel='#test', modes='+b', parameters='some!silly@ban'
  To: [rpc] RPC call channel.set_mode by RPC:adminpanel (Syzop): channel='#test', modes='+b', parameters='some!silly@ban'

This so the most important information is shown first (generally a good principle :D)
2023-04-01 13:10:06 +02:00
Bram Matthys 1bf34ae01b Log parameters in rpc.RPC_CALL:
[rpc] Client RPC:adminpanel (Syzop): RPC call channel.set_mode: channel='#test', modes='+b', parameters='some!silly@ban'
2023-04-01 12:59:20 +02:00
Bram Matthys 2b39777815 Logging: Log the issuer in rpc.RPC_CALL, when it is available.
[rpc] Client RPC:adminpanel (Syzop): RPC call channel.set_mode

And move it into a rpc_call_log() function.
2023-04-01 12:41:01 +02:00
Bram Matthys 7d7974f800 Get rid of unneeded buffer copying, if Jansson library >= v2.1 2023-04-01 12:29:59 +02:00
Bram Matthys 275cb97cfc For JSON-RPC with UNIX Domain sockets, split on \n (newline).
This so multiple parallel requests can be handled properly.

JSON-RPC over websockets is unchanged, as every JSON-RPC
requests goes into its own websocket frame there (easy).
2023-04-01 12:25:16 +02:00
Bram Matthys a6820b4a8d Fix weird +F values when two channels merge.
This was a forgotten TODO item for cmodef_dup_struct(),
more netsync tests are still to follow.
Bug reported by Lord255.
2023-04-01 09:06:37 +02:00
Bram Matthys 4e49323e88 Fix crash on rpc-user { } block without a name. 2023-04-01 08:58:17 +02:00