Commit Graph

88 Commits

Author SHA1 Message Date
Simon Ser 1ad2ee7ef5 service: drop unnecessary admin check in handleUserRun
The command is marked as admin-only already.
2023-01-18 16:05:41 +01:00
delthas b29c9ef09a service: add user run
This enables to run commands as other users, like sudo.

This is useful for eg fixing a user networks on their behalf.
2023-01-18 15:12:33 +01:00
delthas e7a06fe208 service: refactor downstreamConn to serviceContext
This will enable running service commands from other contexts.
2023-01-18 15:12:33 +01:00
delthas e71cdbf6e3 service: reject commands with unexpected arguments
This avoids issues where a user misstypes the following message:

     network update foobar enabled -false

This is obviously a typo of:

     network update foobar -enabled false

But we currently accept it without failing, and ignore the trailing
parameter "false".

This fixes this behavior by failing on unexpected arguments.
2023-01-15 16:52:37 +01:00
Simon Ser bd4aee3f31 service: fix typo in network -cerfp flag name
Reported-by: rj1 <rj1@riseup.net>
Fixes: be185fba33 ("Implement TLS fingerprint pinning")
2022-12-18 17:55:31 +01:00
rj1 be185fba33 Implement TLS fingerprint pinning
Closes: https://todo.sr.ht/~emersion/soju/56
2022-12-16 17:44:14 +01:00
Simon Ser 6ddfc943f5 service: send PART in channel delete 2022-12-08 16:04:01 +01:00
Simon Ser 0edf3a40c2 service: add channel delete command 2022-12-08 16:00:00 +01:00
Simon Ser 106d40dcd4 Upgrade to gopkg.in/irc.v4 2022-11-14 12:06:58 +01:00
zsrv 926dcb37ac Make the auto-away functionality configurable 2022-09-26 19:52:07 +02:00
Simon Ser c3ab11de4e downstream: drop downstreamConn.unmarshalEntity{,Network} 2022-09-26 16:57:05 +02:00
gildarts 0777ca0d29 Add ability for a user to delete themselves
Adds user self delete
Adds confirmation of user deletion
2022-07-12 18:14:11 +02:00
Simon Ser dc0a847240 Add per-user default nickname
The soju username is immutable. Add a separate nickname setting so
that users can change their nickname for all networks.

References: https://todo.sr.ht/~emersion/soju/110
2022-07-08 18:01:05 +02:00
gildarts 4bc9aaf659 Add detach option to channel update
Add `-detached` to `channel update` command

Co-authored-by: Simon Ser <contact@emersion.fr>
Closes: https://todo.sr.ht/~emersion/soju/140
2022-06-24 22:04:12 +02:00
Simon Ser fe40c51ff0 database: add User.{Check,Set}Password 2022-06-08 13:27:33 +02:00
Simon Ser 09f2cf8489 Don't provide name in channel casemapMap Set and ForEach
The name is already provided in the struct.
2022-06-06 10:05:31 +02:00
Simon Ser 657e25b25c Make casemapMap more type-safe
In addition to a type-safe getter, also define type-safe setters
and iterators.

References: https://lists.sr.ht/~emersion/soju-dev/patches/32777
2022-06-06 09:58:39 +02:00
Simon Ser 3a7dee8128 Introduce a database package 2022-05-09 15:08:04 +02:00
delthas 2ac9bd9c94 Require an explicit `*` network suffix for multi-upstream
Most users will connect to their server with `<username>` as their
username in order to configure their upstreams.

Multi-upstream can be unintuitive to them and should not be enabled on
that first connection that is usually used for upstream configuration.

Multi-upstream is instead a power-user feature that should be explicitly
enabled with a specific network suffix.

We reserve the network suffix `*` and use it a special case to mean that
it requests multi-upstream mode.
2022-03-21 09:56:20 +01:00
Simon Ser c7039da54b service: limit number of -connect-command flags 2022-03-14 19:37:12 +01:00
Simon Ser 3f91cfb8c3 service: make name arg optional for network commands
Makes commands less verbose.
2022-02-07 21:33:16 +01:00
Simon Ser 57715d8ce2 service: switch to -network flag for certfp and sasl commands
Instead of always requiring users to explicitly specify the network
name, guess it from the downstream connection.

Network commands are left as-is because it's not yet clear how to
handle them.
2022-02-04 16:47:34 +01:00
Simon Ser 64ad2164de Fix capitalization of handleServiceSASLStatus 2022-02-04 15:41:40 +01:00
Simon Ser 0b5da29916 Drop user.forEachNetwork
It's a trivial for loop.
2022-02-04 14:01:27 +01:00
Simon Ser 66aea1b4a2 Add context to {conn,upstreamConn}.SendMessage
This avoids blocking on upstream message rate limiting for too
long.
2021-12-08 18:03:40 +01:00
Simon Ser 9caa6f9ca0 service: send summary when executing "server notice"
Sometimes this command times out. Display the number of skipped
users.
2021-12-08 14:55:31 +01:00
Simon Ser 43c440e600 Add "sasl status" command 2021-12-01 11:03:27 +01:00
Simon Ser efc4c62725 Add number of upstream connections to metrics 2021-11-17 15:58:19 +01:00
Simon Ser 73295e4fa7 Allow most config options to be reloaded
Closes: https://todo.sr.ht/~emersion/soju/42
2021-11-16 00:38:04 +01:00
Simon Ser d870efa666 Add context support to Server.createUser 2021-11-08 20:29:14 +01:00
Simon Ser e3b1930bf2 Add partial context support to handleUserUpdate
More plumbing needed to make sure we don't block too long waiting
for the reply.
2021-11-08 19:48:32 +01:00
Simon Ser 22f9ce1b86 Check context cancellation in handleServiceServerNotice
This prevents this function from blocking forever if it exceeds the
deadline.
2021-11-08 19:42:36 +01:00
Simon Ser 802e82c272 Add context support to service
References: https://todo.sr.ht/~emersion/soju/141
2021-11-08 19:40:48 +01:00
Simon Ser c21202160c Add context support to user and network mutations
References: https://todo.sr.ht/~emersion/soju/141
2021-11-08 19:36:10 +01:00
Simon Ser a6aa7f0008 Make Network.Nick optional
Make Network.Nick optional, default to the user's username. This
will allow adding a global setting to set the nickname in the
future, just like we have for the real name.

References: https://todo.sr.ht/~emersion/soju/110
2021-11-02 23:33:17 +01:00
Simon Ser 9ec1f1a5b0 Add context args to Database interface
This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.

Future work involves properly wiring up the contexts when it makes
sense.
2021-10-18 19:15:15 +02:00
Simon Ser 4e9ddf78ab service: allow updating other users 2021-10-12 09:11:14 +02:00
Simon Ser 5a2d6246ec Add "server notice" command 2021-10-08 10:52:03 +02:00
Simon Ser e3b4687ac7 Split CertFP logic into separate file 2021-10-08 09:47:25 +02:00
Simon Ser e177977c30 Add DB stats 2021-10-05 19:31:06 +02:00
Simon Ser 5405923aa2 Add limit for RSA bits 2021-10-05 19:21:43 +02:00
Simon Ser f93616fb41 Add "server status" command
Right now, it prints the number of active users and number of
downstream connections.
2021-10-05 19:13:53 +02:00
delthas 896caebfcf service: Introduce network quote
This command enables sending a raw line to a specific network.
2021-07-07 10:34:46 +02:00
Alexey Yerin 12545c07ef service: show SHA-512 fingerprint
Closes: https://todo.sr.ht/~emersion/soju/130
2021-07-06 16:34:15 +02:00
Jake Nelson fc841b0ba2 Sort `channel status` channels by name 2021-06-29 22:19:19 +02:00
Simon Ser acde97ca37 Introduce user.updateUser
Unify updatePassword and updateRealname into a single function. This
allows "user update" to be atomic.
2021-06-28 18:05:03 +02:00
Simon Ser 09b04792b9 Merge "change-password" into "user update"
Add a -password flag to the "user update" command.
2021-06-28 16:55:44 +02:00
Simon Ser f8e853fab1 Only update realname if specified in "user udpate"
This will allow adding more flags.
2021-06-28 16:40:49 +02:00
Simon Ser a14f646135 Add per-user realname setting
This allows users to set a default realname used if the per-network
realname isn't set.

A new "user update" command is introduced and can be extended to edit
other user properties and other users in the future.
2021-06-25 20:33:13 +02:00
Hubert Hirtz a21585ac41 Hand-made word splitter for BouncerServ
Remove the (direct) dependency on shlex (go-scfg still depends on it).

Co-authored-by: Simon Ser <contact@emersion.fr>
2021-06-24 19:33:46 +02:00