68 Commits

Author SHA1 Message Date
contact
31f8b05eea service: make name arg optional for network commands
Makes commands less verbose.

git-svn-id: file:///srv/svn/repo/suika/trunk@772 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-07 20:33:16 +00:00
contact
ad8763469f 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@771 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-04 15:47:34 +00:00
contact
6ee303a377 Fix capitalization of handleServiceSASLStatus
git-svn-id: file:///srv/svn/repo/suika/trunk@770 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-04 14:41:40 +00:00
contact
6cbc9f985a Drop user.forEachNetwork
It's a trivial for loop.

git-svn-id: file:///srv/svn/repo/suika/trunk@768 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-04 13:01:27 +00:00
contact
d5a071dd91 Add context to {conn,upstreamConn}.SendMessage
This avoids blocking on upstream message rate limiting for too
long.

git-svn-id: file:///srv/svn/repo/suika/trunk@757 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-08 17:03:40 +00:00
contact
fcac9d5cdd service: send summary when executing "server notice"
Sometimes this command times out. Display the number of skipped
users.

git-svn-id: file:///srv/svn/repo/suika/trunk@755 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-08 13:55:31 +00:00
contact
fd58864d3f Add "sasl status" command
git-svn-id: file:///srv/svn/repo/suika/trunk@730 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-01 10:03:27 +00:00
contact
867d701eed Add number of upstream connections to metrics
git-svn-id: file:///srv/svn/repo/suika/trunk@710 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 14:58:19 +00:00
contact
8f1a6e4432 Allow most config options to be reloaded
Closes: https://todo.sr.ht/~emersion/soju/42

git-svn-id: file:///srv/svn/repo/suika/trunk@691 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-15 23:38:04 +00:00
contact
86ddd39b77 Add context support to Server.createUser
git-svn-id: file:///srv/svn/repo/suika/trunk@680 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-08 19:29:14 +00:00
contact
a6d7a40af8 Add partial context support to handleUserUpdate
More plumbing needed to make sure we don't block too long waiting
for the reply.

git-svn-id: file:///srv/svn/repo/suika/trunk@679 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-08 18:48:32 +00:00
contact
6e0be5f3d9 Check context cancellation in handleServiceServerNotice
This prevents this function from blocking forever if it exceeds the
deadline.

git-svn-id: file:///srv/svn/repo/suika/trunk@678 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-08 18:42:36 +00:00
contact
a3ca35f09e Add context support to service
References: https://todo.sr.ht/~emersion/soju/141

git-svn-id: file:///srv/svn/repo/suika/trunk@677 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-08 18:40:48 +00:00
contact
31f86a9f9d Add context support to user and network mutations
References: https://todo.sr.ht/~emersion/soju/141

git-svn-id: file:///srv/svn/repo/suika/trunk@676 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-08 18:36:10 +00:00
contact
70a12fc286 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

git-svn-id: file:///srv/svn/repo/suika/trunk@664 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-02 22:33:17 +00:00
contact
2748715183 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@652 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-18 17:15:15 +00:00
contact
c0502705d1 service: allow updating other users
git-svn-id: file:///srv/svn/repo/suika/trunk@625 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 07:11:14 +00:00
contact
1004b91f55 Add "server notice" command
git-svn-id: file:///srv/svn/repo/suika/trunk@615 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-08 08:52:03 +00:00
contact
f2fddf331e Split CertFP logic into separate file
git-svn-id: file:///srv/svn/repo/suika/trunk@614 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-08 07:47:25 +00:00
contact
97110c193a Add DB stats
git-svn-id: file:///srv/svn/repo/suika/trunk@607 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 17:31:06 +00:00
contact
48dab8d280 Add limit for RSA bits
git-svn-id: file:///srv/svn/repo/suika/trunk@606 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 17:21:43 +00:00
contact
ae7aef71b3 Add "server status" command
Right now, it prints the number of active users and number of
downstream connections.

git-svn-id: file:///srv/svn/repo/suika/trunk@605 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 17:13:53 +00:00
delthas
f4e57fd264 service: Introduce network quote
This command enables sending a raw line to a specific network.

git-svn-id: file:///srv/svn/repo/suika/trunk@577 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-07-07 08:34:46 +00:00
yyp
d249ea82a1 service: show SHA-512 fingerprint
Closes: https://todo.sr.ht/~emersion/soju/130

git-svn-id: file:///srv/svn/repo/suika/trunk@575 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-07-06 14:34:15 +00:00
jake.nelson
8f9d6290c1 Sort channel status channels by name
git-svn-id: file:///srv/svn/repo/suika/trunk@573 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-29 20:19:19 +00:00
contact
b275567411 Introduce user.updateUser
Unify updatePassword and updateRealname into a single function. This
allows "user update" to be atomic.

git-svn-id: file:///srv/svn/repo/suika/trunk@572 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-28 16:05:03 +00:00
contact
7bb23b2164 Merge "change-password" into "user update"
Add a -password flag to the "user update" command.

git-svn-id: file:///srv/svn/repo/suika/trunk@570 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-28 14:55:44 +00:00
contact
cafcd21da5 Only update realname if specified in "user udpate"
This will allow adding more flags.

git-svn-id: file:///srv/svn/repo/suika/trunk@569 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-28 14:40:49 +00:00
contact
474d6e3ccd 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@568 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-25 18:33:13 +00:00
hubert
b29276873f 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>

git-svn-id: file:///srv/svn/repo/suika/trunk@566 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-24 17:33:46 +00:00
contact
62bc41f442 Send placeholder when no network/channel is returned by BouncerServ
git-svn-id: file:///srv/svn/repo/suika/trunk@546 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-26 09:27:59 +00:00
contact
30c6e9e954 Allow networks to be disabled
git-svn-id: file:///srv/svn/repo/suika/trunk@542 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-26 08:51:02 +00:00
contact
6de426954b Add channel status service command
git-svn-id: file:///srv/svn/repo/suika/trunk@539 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-25 17:22:22 +00:00
ecs
e3c909c007 handleUserDelete: delete the correct user
Prior to this, we deleted the user issuing the deletion rather than the
user which should've been deleted.

git-svn-id: file:///srv/svn/repo/suika/trunk@508 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-22 08:37:05 +00:00
hubert
1b73446cbb Implement casemapping
TL;DR: supports for casemapping, now logs are saved in
casemapped/canonical/tolower form
(eg. in the #channel directory instead of #Channel... or something)

== What is casemapping? ==

see <https://modern.ircdocs.horse/#casemapping-parameter>

== Casemapping and multi-upstream ==

Since each upstream does not necessarily use the same casemapping, and
since casemappings cannot coexist [0],

1. soju must also update the database accordingly to upstreams'
   casemapping, otherwise it will end up inconsistent,
2. soju must "normalize" entity names and expose only one casemapping
   that is a subset of all supported casemappings (here, ascii).

[0] On some upstreams, "emersion[m]" and "emersion{m}" refer to the same
user (upstreams that advertise rfc1459 for example), while on others
(upstreams that advertise ascii) they don't.

Once upstream's casemapping is known (default to rfc1459), entity names
in map keys are made into casemapped form, for upstreamConn,
upstreamChannel and network.

downstreamConn advertises "CASEMAPPING=ascii", and always casemap map
keys with ascii.

Some functions require the caller to casemap their argument (to avoid
needless calls to casemapping functions).

== Message forwarding and casemapping ==

downstream message handling (joins and parts basically):
When relaying entity names from downstreams to upstreams, soju uses the
upstream casemapping, in order to not get in the way of the user.  This
does not brings any issue, as long as soju replies with the ascii
casemapping in mind (solves point 1.).

marshalEntity/marshalUserPrefix:
When relaying entity names from upstreams with non-ascii casemappings,
soju *partially* casemap them: it only change the case of characters
which are not ascii letters.  ASCII case is thus kept intact, while
special symbols like []{} are the same every time soju sends them to
downstreams (solves point 2.).

== Casemapping changes ==

Casemapping changes are not fully supported by this patch and will
result in loss of history.  This is a limitation of the protocol and
should be solved by the RENAME spec.

git-svn-id: file:///srv/svn/repo/suika/trunk@478 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-24 17:15:52 +00:00
delthas
5843897b92 service: Introduce channel update
This adds the `channel update` service command, which is used to set the
auto-detach, auto-reattach, and message relaying settings of a channel.

Of note is that currently the parser parses `#` as a comment, which
means any `channel update #foo ...` will actually need to be escaped to
`channel update "#foo" ...`

git-svn-id: file:///srv/svn/repo/suika/trunk@436 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-12-14 19:54:02 +00:00
contact
28c243adec Switch DB API to user IDs
This commit changes the Network schema to use user IDs instead of
usernames. While at it, a new UNIQUE(user, name) constraint ensures
there is no conflict with custom network names.

Closes: https://todo.sr.ht/~emersion/soju/86
References: https://todo.sr.ht/~emersion/soju/29

git-svn-id: file:///srv/svn/repo/suika/trunk@421 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-10-24 13:14:23 +00:00
contact
d6696ca80c Add user delete command
References: https://todo.sr.ht/~emersion/soju/17

git-svn-id: file:///srv/svn/repo/suika/trunk@379 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-08-10 13:04:01 +00:00
hubert
6293d8dfe9 Fix help message for BouncerServ's network update
It was missing the network name as first argument.

git-svn-id: file:///srv/svn/repo/suika/trunk@374 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-08-03 09:03:39 +00:00
contact
e0210a0ced Rename certfp reset to sasl reset
And make it reset all SASL credentials.

git-svn-id: file:///srv/svn/repo/suika/trunk@364 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 10:20:52 +00:00
contact
869942603b Add a sasl set-plain command
This allows to manually set the SASL credentials for a network.

git-svn-id: file:///srv/svn/repo/suika/trunk@363 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 10:16:13 +00:00
contact
c00ddb8ec3 Add unix as supported upstream URL scheme to service
git-svn-id: file:///srv/svn/repo/suika/trunk@358 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-09 10:19:51 +00:00
contact
35c7c0df7f Reply to WHO BouncerServ
Closes: https://todo.sr.ht/~emersion/soju/75

git-svn-id: file:///srv/svn/repo/suika/trunk@343 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-29 16:09:48 +00:00
contact
b371ea1bf2 service: list commands in lexicographic order
git-svn-id: file:///srv/svn/repo/suika/trunk@339 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-24 10:08:35 +00:00
contact
3b3d7c4f5a Fix missing appendServiceCommandSetHelp argument
git-svn-id: file:///srv/svn/repo/suika/trunk@335 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-10 14:34:45 +00:00
fox.cpp
c3141986b1 Do not panic if BouncerServ command without handler is sent
git-svn-id: file:///srv/svn/repo/suika/trunk@334 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-10 14:33:13 +00:00
kl
969469c37d service: Handle zero-value in stringPtrFlag.String
FlagSet.PrintDefaults uses reflection to construct a zero value, calls
.String on it, and compares the result with the current flag value to
detect zero-value flags. For stringPtrFlag, this would result in a
panic, as String() always dereferenced the first level of its **string.

Add another check so that both pointer levels are nil-checked.

git-svn-id: file:///srv/svn/repo/suika/trunk@333 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-10 14:18:15 +00:00
delthas
6a71f953cb Add support for the user create admin service command
This adds support for user create, a new service command only accessible
to admin users. This lets users create other users on the fly and makes
soju start the user routine immediately; unlike sojuctl which currently
requires closing soju, creating the user, and starting soju again.

git-svn-id: file:///srv/svn/repo/suika/trunk@329 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +00:00
delthas
ff63d3e24e Add support for admin-restricted service commands
This is preparatory work for creating new users from a service command.

This adds support for specifying specific service commands as
admin-restricted. Only admin users can run these commands. These
commands won't show up in the help when run from a non-admin
user, unless the user is requesting help for that specific command.

git-svn-id: file:///srv/svn/repo/suika/trunk@328 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +00:00
delthas
e853516870 Rename handleServiceCreateNetwork to handleServiceNetworkCreate
This renames handleServiceCreateNetwork for consistency with other
service commands.

git-svn-id: file:///srv/svn/repo/suika/trunk@325 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +00:00