Commit Graph

119 Commits

Author SHA1 Message Date
delthas
1ccc7ce6d2 Add a database store for messages
This adds a new config option, `logs db`, which enables storing chat
logs in the soju database.

Regular store options, CHATHISTORY options, and SEARCH operations are
supported, like the fs logs backend.

Messages are stored in a new table, Message. In order to track the list
of targets we have messages for in an optimized manner, another database
is used: MessageTarget.

All new requests are backend by indexes so should be fast even with
hundreds of thousands of messages.

A contrib script is provided for migrating existing logs fs chat logs to
the database. It can be run with eg:

  go run ./contrib/migrate-logs/ logs/ sqlite3:soju.db

Co-authored-by: Simon Ser <contact@emersion.fr>
2023-02-17 14:13:43 +01:00
delthas
2713bcba34 Add administrative unix listen endpoint
This adds support for listening on a Unix socket for administrative
connections, that then use a simple protocol for communicating with
the service (BouncerServ) as an administrator with a global context.

The wire format used by the Unix socket is IRC, but without
registration or overheads.

Example session:

    >>> BOUNCERSERV
    <<< 461 * BOUNCERSERV :Not enough parameters
    >>> BOUNCERSERV :n s
    <<< :gensou FAIL BOUNCERSERV :this command must be run as a user
    >>> BOUNCERSERV :u s
    <<< :gensou PRIVMSG * :marisa: 2 networks
    <<< :gensou PRIVMSG * :alice: 1 networks
    <<< :gensou BOUNCERSERV OK
2023-02-06 15:15:09 +01:00
delthas
ab235f0099 sojuctl: rename to sojudb
sojuctl will be used to control the soju deamon directly.

sojudb is a better name because it operates on the database file only.
2023-02-06 15:15:09 +01:00
Simon Ser
24cae474db Add support for PAM authentication 2023-01-30 11:55:43 +01:00
Simon Ser
ca2d666056 Auto-create users after external auth when enable-user-on-auth is on 2023-01-30 11:53:01 +01:00
Simon Ser
22a88079c2 Add support for external OAuth 2.0 authentication 2023-01-30 11:53:01 +01:00
Simon Ser
63ca247354 Add infrastructure for external authentication 2023-01-30 11:53:01 +01:00
Simon Ser
979fb319fe service: add -disable-password
This can be used to disable password authentication for a user.
This is useful to prevent a disabled user account from being
auto-enabled when enable-user-on-auth is on.
2023-01-26 20:03:37 +01:00
Simon Ser
db49bc120f Add enable-user-on-auth config directive 2023-01-26 19:51:35 +01:00
Simon Ser
9df9880301 Add disable-inactive-user config option
This can be used to automatically disable users if they don't
actively use the bouncer for a while.
2023-01-26 19:42:29 +01:00
Simon Ser
d7d9d45b45 Add a flag to disable users
Add a new flag to disable users. This can be useful to temporarily
deactivate an account without erasing data.

The user goroutine is kept alive for simplicity's sake. Most of the
infrastructure assumes that each user always has a running goroutine.
A disabled user's goroutine is responsible for sending back an error
to downstream connections, and listening for potential events to
re-enable the account.
2023-01-26 18:33:55 +01:00
delthas
959baa964f service: add user status
This lists all the users of the instances, along with the number
of networks they have.

Limited to 50 users to avoid flooding with thousands of messages
on large instances.
2023-01-18 16:24:12 +01:00
Simon Ser
bdb470484f doc: add "user run" to man page 2023-01-18 16:04:54 +01:00
Simon Ser
6734c5f8f0 doc: document command parsing rules for the service 2023-01-09 18:31:19 +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
0edf3a40c2 service: add channel delete command 2022-12-08 16:00:00 +01:00
Sandra Snan
87b2d32682 Be more clear that -connect-command needs quotes 2022-11-28 15:10:39 +01:00
zsrv
926dcb37ac Make the auto-away functionality configurable 2022-09-26 19:52:07 +02:00
Simon Ser
dde4ee9518 config: drop multi-upstream-mode 2022-09-26 16:57:05 +02:00
Simon Ser
085f5c17a4 doc: drop multi-upstream mode bits 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
Simon Ser
5ef7e07061 contrib/znc-import: move to subdir
Go isn't happy when multiple scripts share the same directory.
2022-07-04 15:52:09 +02:00
Simon Ser
71d639699e Add support for draft/read-marker
References: https://github.com/ircv3/ircv3-specifications/pull/489
2022-07-01 13:33:28 +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
3863b8cb6b Add webpush extension
References: https://github.com/ircv3/ircv3-specifications/pull/471
Co-authored-by: delthas <delthas@dille.cc>
2022-06-14 16:16:12 +02:00
Simon Ser
22b235602b Add soju.im/account-required
References: https://github.com/ircv3/ircv3-specifications/pull/492
2022-06-04 10:52:28 +02:00
Simon Ser
e2e232fa9c config: add message-store memory
The old way to do this was `message-store fs ""`, which is
misleading.
2022-05-09 16:59:27 +02:00
Simon Ser
80ed0d2a6c Rename "log" config directive to "message-store"
This is more explicit and removes the ambiguity with error logging.
2022-05-09 16:41:41 +02:00
Brett Cornwall
9d188a7cb6 doc/getting-started: Fix simple misspelling. 2022-05-05 18:53:15 +02:00
Simon Ser
23f94a5c6e doc/ext/bouncer-networks: remove BOUNCER BIND auth restriction
We now stash the network ID until connection registration completes.
2022-05-03 09:32:21 +02:00
Simon Ser
48ec515120 doc/ext/bouncer-networks: specify how attributes are cleared in notifications
We send an "error" attribute without a value to clear it, for instance.
2022-05-01 19:37:36 +02:00
delthas
683cfe0615 Add support for the SEARCH extension 2022-04-12 17:58:16 +02:00
delthas
f7a468194d bouncer-networks: Add a read-only error attribute
This is useful for clients to display additional info abotu why a
network is disconnected.
2022-04-11 08:38:31 +02:00
Simon Ser
17374f2094 doc/getting-started: ask to install soju
This might seem obvious but… let's add a short sentence just in
case.
2022-04-06 15:58:16 +02:00
Simon Ser
3d8022d030 doc/getting-started: mention TLS and on-disk logs 2022-03-26 18:42:34 +01:00
Simon Ser
ad8192cb82 doc/getting-started: add paragraph about client names 2022-03-26 18:22:33 +01:00
Simon Ser
18bb3e6138 doc: split off multi-upstream documentation
Multi-upstream mode is confusing for new users. Let's explain how
it works in a separate file.
2022-03-24 19:16:43 +01:00
Simon Ser
43371bf347 Add the soju.im/no-implicit-names extension
References: https://github.com/ircv3/ircv3-ideas/issues/87
2022-03-22 21:03:20 +01:00
Simon Ser
86f08ec35d doc/soju.1: fix syntax error 2022-03-21 16:11:11 +01: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
5feae506d4 doc/soju.1: recommend using a FQDN for the hostname 2022-03-15 23:01:08 +01:00
Simon Ser
e5ec93179c doc/ext: add README
All authors have acknowledged the dual license.

The second license is the same as the one used by the IRCv3 working
group.
2022-03-04 10:36:41 +01:00
Simon Ser
7e20c27332 doc: move read spec to ext/ 2022-02-11 19:49:21 +01:00
delthas
cae248f672 Add support for the wip soju.im/read capability and READ command
READ lets downstream clients share information between each other about
what messages have been read by other downstreams.

Each target/entity has an optional corresponding read receipt, which is
stored as a timestamp.

- When a downstream sends:
  READ #chan timestamp=2020-01-01T01:23:45.000Z
  the read receipt for that target is set to that date
- soju sends READ to downstreams:
  - on JOIN, if the client uses the soju.im/read capability
  - when the read receipt timestamp is set by any downstream

The read receipt date is clamped by the previous receipt date and the
current time.
2022-02-11 19:41:46 +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
43c440e600 Add "sasl status" command 2021-12-01 11:03:27 +01:00
Simon Ser
e42b507377 doc/soju.1: add network create example 2021-11-30 09:26:07 +01:00
Simon Ser
98af48d254 doc/per-user-ip: new documentation article 2021-11-17 18:04:14 +01:00