Simon Ser
c36bb342fb
Introduce soju.im/pre-away
...
The IRCv3 spec is stalled, so let's just ship a vendored extension
for now.
References: https://github.com/ircv3/ircv3-specifications/pull/514
2023-08-03 19:38:31 +02:00
delthas
0ee94759f7
Fix SEARCH queries with special characters on SQLite
...
Previously, we would pass SQLite FTS5 MATCH queries as is from the
SEARCH parameter, when searching for messages.
By default FTS5 queries follow a specific syntax, e.g. AND, OR, ...
can be used to filter searches logically.
Passing special characters in these unescaped queries, like `.`,
would be rejected by SQLite, failing the SEARCH request.
Here, in order to replicate PostgreSQL and FS behavior, we simply
want to search for the string as is, and not give it glob or logic
operators semantics.
To do that, we quote each token of the string, skipping over
separators.
2023-08-02 15:19:38 +02:00
Simon Ser
2351fc8b83
server: add metric for goroutine panics
...
This is useful to setup an alert when a panic occurs.
2023-06-02 11:03:21 +02:00
Simon Ser
64196d5b6e
Upgrade dependencies
2023-06-01 13:07:39 +02:00
Simon Ser
c8d5c90d9d
downstream: improve SASL error logging
2023-06-01 11:37:03 +02:00
Simon Ser
40a40566f4
msgstore/znclog: fix error message
...
err may be nil.
Fixes: 2b2a2fd479
("msgstore/znclog: fix panic on malformed input line")
2023-05-23 23:11:05 +02:00
Simon Ser
2b2a2fd479
msgstore/znclog: fix panic on malformed input line
...
If the line is "[01:02:03]" without a trailing space, we trip on
a "slice bounds out of range" panic.
Closes: https://todo.sr.ht/~emersion/soju/214
2023-05-23 23:08:44 +02:00
Simon Ser
fa33ce986c
downstream: fix nick in auth error message
...
We were always printing "*" here.
2023-05-23 18:28:50 +02:00
Simon Ser
9659de8ff3
Add CHATHISTORY test
2023-05-23 13:06:22 +02:00
Simon Ser
9b9fc60f62
Rename Config.Log{Driver,Path} to MsgStore
2023-05-23 11:23:38 +02:00
Simon Ser
cbdaf46592
service: reject params for commands that don't take any
...
We were already rejecting extraneous params for commands that take
one or more.
2023-04-25 09:51:37 +02:00
Simon Ser
582ac97c24
Use database.GetNick in network.isHighlight
...
The network nickname can be empty, and defaults to the global nick
setting.
2023-04-16 21:24:27 +02:00
Simon Ser
e5bce700a9
Panic if isHighlight is called with empty nick
...
Let's make sure callers never do this. We'd go into an infinite
loop previously.
2023-04-16 21:22:08 +02:00
Simon Ser
0548fdfa09
database/sqlite: fix missing argument in DeleteUser
2023-04-14 17:37:53 +02:00
Simon Ser
f6421c3498
doc/packaging: add section about binding to privileged ports
2023-04-14 17:35:51 +02:00
Simon Ser
662e3f3afe
contrib/systemd: add AmbientCapabilities=CAP_NET_BIND_SERVICE
...
soju needs to bind to port 113 for identd.
2023-04-13 12:40:12 +02:00
Simon Ser
6f01bd86c3
downstream: pass context to SendMessage
...
Just like upstream does.
2023-04-06 13:23:20 +02:00
Simon Ser
51768c256a
upstream: introduce upstreamConn.forwardMessage
2023-04-06 13:10:18 +02:00
Simon Ser
43e6febc15
downstream: error out if SASL PLAIN identity is specified
2023-04-05 21:18:57 +02:00
Simon Ser
b3be05559b
downstream: add support for ANONYMOUS SASL auth
...
This clears any saved SASL credentials.
Closes: https://todo.sr.ht/~emersion/soju/198
2023-04-05 21:15:18 +02:00
Simon Ser
92796248d2
downstream: rename downstreamRegistration.password to pass
...
This is more descriptive.
2023-04-05 20:30:34 +02:00
Simon Ser
f6043e5b98
Stop setting *user in downstreamConn.register
...
Set it in downstreamConn.welcome instead. Makes it clearer that it
must not be accessed before welcome is called (because it can only
be accessed from the user goroutine).
2023-04-05 16:54:55 +02:00
Simon Ser
c5079f7ac3
downstream: fix connection registration
...
Fixes: 1df1ccf91e
("downstream: take irc.Message in handleCap")
2023-04-05 16:53:18 +02:00
Simon Ser
0b1a4b9081
user: fix upstream connections closed after 1 minute
...
Fixes: ac16729f93
("user: fix dup upstream connections due to race")
2023-04-05 16:43:02 +02:00
Simon Ser
8637550e68
downstream: inline authenticate function
2023-04-05 15:43:51 +02:00
Simon Ser
53017a7a5c
Improve Server.Handle readability
2023-04-05 15:11:36 +02:00
Simon Ser
1df1ccf91e
downstream: take irc.Message in handleCap
2023-04-05 14:35:51 +02:00
Simon Ser
de02cb98fe
downstream: return FAIL on unknown BOUNCER command before registration
2023-04-05 13:36:36 +02:00
Simon Ser
41399ca6fd
user: unconditonally stop network in updateNetwork()
2023-04-05 13:03:24 +02:00
Simon Ser
ac16729f93
user: fix dup upstream connections due to race
...
Closes: https://todo.sr.ht/~emersion/soju/207
2023-04-05 12:57:42 +02:00
Simon Ser
6cfa908f40
gitignore: add doc/sojuctl.1
2023-04-05 10:56:36 +02:00
Simon Ser
f12f10a7bb
downstream: return channel in cached WHO reply
...
References: https://github.com/ircdocs/modern-irc/pull/211
2023-04-05 10:54:43 +02:00
Simon Ser
5358d93ab9
upstream: don't print "unhandled message" for registration errors
2023-04-03 22:35:38 +02:00
Simon Ser
b514306a06
upstream: forward ERR_NOSUCHNICK
2023-04-03 22:35:16 +02:00
Simon Ser
b0f2f9c36b
upstream: add forwardMsgByID
2023-04-03 22:32:49 +02:00
Simon Ser
be6cc27981
downstream: set CLIENTTAGDENY=* when upstream is missing message-tags
2023-03-28 18:48:47 +02:00
Simon Ser
f2b6d0864b
doc/packaging: clarify and expand
2023-03-22 16:25:15 +01:00
Simon Ser
9579998e63
downstream: fix panic due to nil user in setUser
...
Fixes: 4ca8dfa37d
("downstream: fix nil pointer deref in downstreamConn.setUser")
2023-03-21 18:02:59 +01:00
Дамјан Георгиевски
e510cef208
add an example systemd service file
...
The service file will run `/usr/bin/soju --config /etc/soju/config`.
By default it'll run as a dynamically created `soju` user and group (DynamicUser=yes),
and it will run in a constrained environment[1], only having write access to
/var/lib/soju and /run/soju
If the admin creates a static `soju` user and group, those static uid/gid will be used,
with the same service constraints. This can be useful to share the static `soju` group
with other services, so they can access the soju logs and database even
if the service is not running (or before it's running).
The procedure for the initial user and database scaffold still
works normally, when run as `root`:
```
mkdir /var/lib/soju/
sojudb -config /etc/soju/config create-user myname -admin
```
NOTE: systemd will automatically change the ownership of files in /var/lib/soju/ when the service
is started.
`sojuctl` will work for root, or with `sudo -u soju`, just normally.
References:
- [1] https://www.freedesktop.org/software/systemd/man/systemd.exec.html#DynamicUser=
2023-03-20 18:12:31 +01:00
Simon Ser
d2067f74d8
database/sqlite: delete push subscriptions and msgstore in DeleteUser
2023-03-17 10:23:37 +01:00
Simon Ser
a30ca70713
Simplify push subscription pruning logic
...
Let's just delete on too old + any failure instead. This leaves
alone old + success, which can be beneficial when a device is
offline for a while.
2023-03-17 00:20:53 +01:00
Simon Ser
a14ea80cb9
Bump update time on success in network.broadcastWebPush
...
Allows us to skip checks when the client sends WEBPUSH REGISTER
and avoid pruning subscriptions that still work fine.
2023-03-17 00:06:13 +01:00
Simon Ser
93af53c91d
Prune old Web Push subscriptions
2023-03-17 00:00:50 +01:00
Simon Ser
02ed7aa308
Set User-Agent when sending Web Push notifications
...
This allows push servers to figure out where the notifications are
coming from.
2023-03-16 23:31:39 +01:00
Simon Ser
2ce370d627
makefile: add variable with command list
2023-03-15 18:36:04 +01:00
Simon Ser
c183d938ff
doc: add man page for sojuctl
2023-03-15 18:34:50 +01:00
Simon Ser
4c8e955946
Move DefaultUnixAdminPath to config package
...
We can drop the soju package import. This shrinks down sojuctl's
size significantly (18M to 3M).
2023-03-15 17:47:47 +01:00
Simon Ser
4ca8dfa37d
downstream: fix nil pointer deref in downstreamConn.setUser
...
References: https://lists.sr.ht/~emersion/soju-dev/%3CCR6PX9SU5FSO.3UR92LHKXOXML%40hades.moritz.sh%3E
2023-03-15 17:34:18 +01:00
Simon Ser
6b82ed990c
downstream: fix nickCM out-of-sync with effective case-mapping
...
We were unconditionally using the ASCII case-mapping in updateNick(),
for instance.
Introduce downstreamConn.casemap to fix this, and use it everywhere.
2023-03-01 14:59:08 +01:00
Simon Ser
aecff32103
Introduce UserUpdateFunc
...
References: https://todo.sr.ht/~emersion/soju/206
2023-03-01 14:16:33 +01:00