1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-30 07:16:39 +02:00
Commit Graph

2853 Commits

Author SHA1 Message Date
Bram Matthys ed8a3f0336 JSON-RPC add server_ban_exception.* API calls
Docs: https://www.unrealircd.org/docs/JSON-RPC:Server_ban_exception
2023-01-08 15:35:08 +01:00
Bram Matthys d0ad776e93 Minor code cleanup (move error out of params into local vars,
as it didn't belong there..)
[skip ci]
2023-01-08 15:03:18 +01:00
Bram Matthys 0244c31742 Split of some code from cmd_eline() into server_ban_exception_parse_mask(),
similar to how *LINE commands use server_ban_parse_mask().
Now used by ELINE and for JSON-RPC later...
2023-01-08 14:56:56 +01:00
Bram Matthys c95e3f249e JSON-RPC: add name_ban.list, name_ban.get, name_ban.add, name_ban.del 2023-01-08 09:56:41 +01:00
Bram Matthys 5db86cb442 Fix crash in server_ban.* when using non-serverban types such as
qlines and exceptions (for which no interface exists yet, btw :D).
2023-01-08 09:20:12 +01:00
Bram Matthys 9d04710e3a In DEBUGMODE allow for verbose rpc logging with request/responses.
(And also fix a logging statement that had the wrong category)

log {
        source {
                rpc.debug;
        }
        destination {
                file "rpc.log" { maxsize 100M; }
        }
}
2023-01-08 09:02:01 +01:00
Bram Matthys 20d1487922 JSON-RPC: add channel.kick, update struct initalization,
and use REQUIRE_PARAM_* and OPTIONAL_PARAM_* everywhere
in the channel.* API handlers.

For docs see:
https://www.unrealircd.org/docs/JSON-RPC:Channel
2023-01-07 19:05:05 +01:00
Bram Matthys 243958f85a Add REQUIRE_PARAM_STRING(), REQUIRE_PARAM_BOOLEAN(),
OPTIONAL_PARAM_STRING, OPTIONAL_PARAM_BOOLEAN()
and use it everywhere in the user.* API calls.
Much cleaner now :)
2023-01-07 17:54:52 +01:00
Bram Matthys fb96e4581b JSON-RPC: add user.part and slightly change user.join
the option is now called 'force':true for consistency.

Docs updated:
https://www.unrealircd.org/docs/JSON-RPC:User#user.part
https://www.unrealircd.org/docs/JSON-RPC:User#user.join
2023-01-07 17:38:38 +01:00
Bram Matthys 046c8654c6 JSON-RPC: add user.join, which uses SVSJOIN (normal join) or SAJOIN (bypass
all channel restrictions).
See https://www.unrealircd.org/docs/JSON-RPC:User#user.join
2023-01-07 17:31:33 +01:00
Bram Matthys 884cc7f04d JSON-RPC: add user.quit. The difference between that and user.kill
is explained at https://www.unrealircd.org/docs/JSON-RPC:User
2023-01-07 16:57:48 +01:00
Bram Matthys 6a2a8e798b JSON-RPC: add user.kill 2023-01-07 16:48:41 +01:00
Bram Matthys 9d65b8a4ed Use better defaults in user.set_oper
Already documented at https://www.unrealircd.org/docs/JSON-RPC:User#user.set_oper
2023-01-07 16:41:52 +01:00
Bram Matthys aef8611f91 Change SVSO to use the prefix "remote:<name>" instead of "services:<name>"
because it can be used by JSON-RPC now and this fits for both :D.
2023-01-07 16:19:17 +01:00
Bram Matthys e7615210a7 JSON-RPC: add user.set_oper
[skip ci]
2023-01-07 16:18:47 +01:00
Bram Matthys 541eba0670 JSON-RPC: add user.set_mode & user.set_snomask 2023-01-07 15:59:52 +01:00
Bram Matthys 9898d332ab JSON-RPC: add user.set_vhost 2023-01-07 15:30:08 +01:00
Bram Matthys 318d183f23 JSON-RPC: add user.set_username and user.set_realname 2023-01-07 15:23:34 +01:00
Bram Matthys 4378979ad5 Add valid_username() so we can use it at multiple places.
This gets rid of duplicate code in SETIDENT, CHGIDENT, and soon
in the RPC call. It does not get rid of make_valid_username()
in src/modules/nick.c which does something slightly different.
2023-01-07 15:11:52 +01:00
Bram Matthys a9d0c6fd1a JSON-RPC: make channel.set_mode and channel.set_topic return just result:true.
I don't think it should return the whole channel struct here as if it
was a channel.get. Only thing is that, especially or only with set_mode,
it may actually be 100% success... eg if your mode line is wrong :D.

Also bump API versions on user.* and channel.*
2023-01-07 14:58:00 +01:00
Bram Matthys 5589a78255 JSON-RPC: add user.set_nick
This also makes the "forced nick change" message a bit more
generic, leaving out the "by services" or "due to Services",
since it is now possible to do it via JSON-RPC.
2023-01-07 14:53:01 +01:00
Bram Matthys 7d9dcb5e0a Allow SVS* commands to be sent by non-ulined servers by default,
this is needed by various future JSON-RPC calls.
See https://www.unrealircd.org/docs/Set_block#set::limit-svscmds
2023-01-07 14:21:31 +01:00
Bram Matthys 62d62c4e88 channel.set_mode: mode->modes, parameter->parameters 2023-01-07 10:24:26 +01:00
Bram Matthys b2a6f3cfee JSON-RPC: add channel.set_mode 2023-01-07 10:21:19 +01:00
Bram Matthys 14107d88be Add set_channel_topic() and use it from cmd_topic (TOPIC) 2023-01-07 10:16:18 +01:00
Bram Matthys 66d7fb804d JSON-RPC: add channel.set_mode 2023-01-07 09:41:01 +01:00
Bram Matthys 141c4bc64d Use consts in set_channel_mode()
[skip ci]
2023-01-07 09:39:44 +01:00
Bram Matthys 5a32333360 JSON-RPC: show +vhoaq in "channels" in user.* and in "members" in channel.*
as requested in https://bugs.unrealircd.org/view.php?id=6206
And also for channel.get, in "members", include the UID in "id".

This breaks the current format but we don't have many users yet anyway.
Something tells me that will happen more ;)

This also bumps the user and channel RPC modules from 1.0.0 to 1.0.1

In user.get (and currently user.list too) this shows as:

"channels": [
  {
    "name": "#test",
    "level": "o"
  }
]

And in channel.get (not .list) this shows as:
"members": [
  {
    "name": "abc",
    "id": "00129BP02",
    "level": "o"
  },
  {
    "name": "def",
    "id": "001LFMB05"
  }
]
2023-01-05 17:48:08 +01:00
Bram Matthys 143b7262cc JSON-RPC: add channel.get which also includes members and +beI lists.
Documented at https://www.unrealircd.org/docs/JSON-RPC:Channel
under "When using the channel.get API call, more details are available"
2023-01-05 16:39:59 +01:00
Bram Matthys ccbd320338 JSON-RPC over Websocket: don't close websocket connections after ~30s,
keep them open, but do a websocket ping/pong to check if the
connection is alive.
This is usually handled by browsers themselves, but if you are using
websockets from a non-browser then you may have to PONG back on
a PING, see https://www.rfc-editor.org/rfc/rfc6455#section-5.5.2
(note that PING-PONG is a requirement there)
2023-01-04 13:55:08 +01:00
Bram Matthys b33628b765 JSON-RPC over Websockets: Fix bug with >64Kb responses.
Eg if there are 10.000 users online and you do user.list.
The old websocket framing assumed no response was >64Kb.

This also creates a new function websocket_create_packet_ex()
2023-01-04 13:10:09 +01:00
Bram Matthys b5c86981fa JSON-RPC server_ban.add: fix "duration_string" being interpreted totally wrong.
Something like "1h" was intepreted as unixtime 3600 (=expired long ago).
For absolute times there is already "expire_at" (JSON timestamp).

Now, "1h" is properly interpreted as meaning 1 hour from now, as intended.

This bumps the version of rpc/server_ban to 1.0.1.

Reported by armyn.
2023-01-03 10:03:15 +01:00
Bram Matthys 895bbd3a35 When authprompt kicks in and the session timeouts, show the original ban reason
from the *LINE (or other ban type).
Eg /GLINE %*@192.168.* 0 :Please authenticate using SASL
would now, if the user has authprompt enabled and the connection times
out, exit the client after ~30 secs with "Please authenticate using SASL",
instead of "Registration timeout" (pre 6.0.5-rc2) or
the generic "Account required to login" (6.0.5-rc2).
This to help clients and users who do not type or display anything.

This is an enhancement to https://bugs.unrealircd.org/view.php?id=6202

This also fixes a bug in 6.0.5-rc2 where "Registration timeout" was
always showing up as "Account required to connect", even if there
was no softban or authprompt intervention at all.
2022-12-26 10:21:59 +01:00
Valerie Pond 58e83bbe58 Another fix for set::authentication-prompt::enabled 'no' being ignored (#245) 2022-12-21 16:21:30 +00:00
Bram Matthys eca0035e8d Actually fix previous-previous-commit cdd0e4116d 2022-12-21 10:09:23 +01:00
Bram Matthys eab827688d Fix RPC spamfilter.* (and tkl.*?) not going through fully net-wide
due to bogus sender.
[skip ci]
2022-12-21 10:06:23 +01:00
Bram Matthys cdd0e4116d RPC spamfilter.add: convert reason to underscores internally when adding 2022-12-21 09:57:53 +01:00
Bram Matthys 9b1c24c2fa When timing out on authprompt, error with "Account required to connect".
More ideally it would show the full *LINE reason but that is something
for a later release. Inspired by https://bugs.unrealircd.org/view.php?id=6202

This also fixes a silly typo that prevents compiling btw :D
2022-12-21 09:31:47 +01:00
Valerie Pond 7dedbf1a69 Fix set::authentication-prompt::enabled 'no' being ignored (#243) 2022-12-21 08:01:47 +00:00
Valerie Pond d4dbf62781 Fix link warning about moddata creationtime (#233)
This lets servers share their own creation time. See https://bugs.unrealircd.org/view.php?id=6193
2022-12-21 07:54:55 +00:00
Bram Matthys 2ff03be8a0 Log who actually initiated a /CONNECT (both local and remote).
Reported by Noisytoot in https://github.com/unrealircd/unrealircd/pull/244
2022-12-21 08:50:17 +01:00
ZarTek @ CREOLE b53f23416d Unrealircd to UnrealIRCd 2022-12-14 15:24:19 +00:00
ZarTek @ CREOLE 67ec21f4e9 unreal to unrealircd 2022-12-14 15:24:19 +00:00
Bram Matthys 7bab7144ed Send empty batch on CHATHISTORY request for a user (non-channel),
which makes it similar behavior to channels that are not +H.
2022-12-07 08:15:41 +01:00
Valentin Lorentz 7bacf25845 Add ACCOUNTEXTBAN ISUPPORT token
To support the draft IRCv3 spec: https://github.com/ircv3/ircv3-specifications/pull/464
2022-12-07 07:00:35 +00:00
Bram Matthys 36d9e8e720 RPC spamfilter.*: fix validations not working due to changes yesterday 2022-12-06 17:20:29 +01:00
Bram Matthys fe8661da3d RPC: implement spamfilter.del and spamfilter.get 2022-12-05 15:41:09 +01:00
Bram Matthys 61e68d65da Update a comment
[skip ci]
2022-12-05 14:51:22 +01:00
Bram Matthys d9ac4cac07 Add RPC 'rpc.info': returns list of RPC methods, RPC module name and version.
This can be useful for checking if a server supports something and what
format it expects or returns things, etc.
2022-12-05 14:48:14 +01:00
Bram Matthys c756c87be2 Update blacklist::reason changing the $variables there.
This changes the work of commit 2cf60f66a3.
    $ip: IP address of the banned user
    $server: name of the IRC server
    $blacklist: name of the blacklist block (eg. xyz for blacklist xyz { })
    $dnsname: the blacklist::dns::name
    $dnsreply: DNS reply code

Previously there was a $name which was ambigious in the sense that
it could mean blacklist name or dns name, now we simply avoid using
$name altogether and use $dnsname and (new) $blacklist.
2022-11-18 12:25:30 +01:00