Commit Graph

1142 Commits

Author SHA1 Message Date
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
Simon Ser
67335130b1 service: use database.User.SetPassword instead of bcrypt 2023-03-01 14:14:09 +01:00
Simon Ser
4bebe4a1f2 xirc: improve CaseMapping docs 2023-03-01 13:59:27 +01:00
Simon Ser
7b41b0302d xirc: drop CaseMappingNone
Servers can't actually use this, so it's not very useful.
2023-03-01 13:58:01 +01:00
Simon Ser
ebd101820b Migrate casemapMap to xirc 2023-03-01 13:52:33 +01:00
Simon Ser
2b7a83b676 Take case-mapping as param in newCasemapMap()
Avoids situations where we forget to initialize it.
2023-03-01 13:43:51 +01:00
Simon Ser
de90648eaa Rename casemapMap.setCasemapping to setCaseMapping 2023-03-01 13:35:03 +01:00
Simon Ser
3eb2679612 Migrate case-mapping to xirc 2023-03-01 13:35:03 +01:00
Simon Ser
07cd1f2f5d Use generics for casemapMap 2023-03-01 13:15:38 +01:00
Simon Ser
3da6c23ad4 Pass-through ISUPPORT CASEMAPPING 2023-03-01 12:55:49 +01:00
Simon Ser
637b989a47 Add downstreamConn.updateCasemapping()
We weren't correctly updating nickCM.
2023-03-01 12:55:10 +01:00
Simon Ser
568de1d5d2 Drop unused partialCasemap() helper 2023-03-01 12:54:43 +01:00
Simon Ser
9b31dbfb24 upstream: drop unnecessary network nil check
Remnant from multi-upstream.
2023-03-01 11:52:42 +01:00
Simon Ser
ce38d16454 downstream: reset map with correct casemapping on MONITOR C 2023-02-28 19:11:39 +01:00
Simon Ser
437f7a74f0 upstream: convert ISUPPORT tokens to upper-case 2023-02-28 18:41:10 +01:00
Simon Ser
2dfb31ac0b upstream: drop unnecessary casemapIsSet field 2023-02-28 18:40:07 +01:00
Simon Ser
36d6cb19a4 Move authError to auth package
This allows auth backends to customize the error message displayed
to the user.
2023-02-23 22:32:24 +01:00
Simon Ser
05a0775658 Silence "Web Push subscription expired" errors
These are expected to happen from time to time, nothing to worry
about.
2023-02-23 13:48:02 +01:00
Simon Ser
f7fbf2ea72 identd: use UNKNOWN for OS name
Some servers like snircd reject OTHER [1], because OTHER can be
used when the ident string is not stable (e.g. is an audit token
that changes each time the ident is queried).

[1]: 17c92003d3/ircd/s_auth.c (L559)
2023-02-23 13:27:25 +01:00
Simon Ser
21eb384bd6 identd: reference RFC 2023-02-23 13:00:01 +01:00
Simon Ser
5a1cbc425f Remove legacy Go build comments 2023-02-23 10:33:48 +01:00
Simon Ser
7e891569b8 Drop isErrClosed
We require a new enough Go version now.
2023-02-23 10:32:36 +01:00
Simon Ser
522f8a80d7 Bump minimum Go version to 1.19
Two reasons:

- Because of [1], when mattn/go-sqlite3 is used without libsqlite3,
  we need Go 1.19.
- atomic.Int64 has been introduced in Go 1.19.

[1]: https://github.com/golang/go/issues/58438
2023-02-22 23:46:14 +01:00
Simon Ser
8bbc2265be doc/packaging: new page 2023-02-22 21:25:10 +01:00
Simon Ser
8ad5a5fb3a readme: merge paragraphs about GOFLAGS 2023-02-22 21:12:22 +01:00
sentriz
5a26674614 database/postgres: fix StoreNetwork positional arguments 2023-02-18 15:42:00 +01:00
Simon Ser
8f1f67f1f0 Rate limit Web Push checks
No need to re-check that a Web Push subscription is valid every
time a downstream connects. Mobile devices may reconnect pretty
frequently.

Check at most once a day.
2023-02-18 13:27:13 +01:00
Simon Ser
b6c0841291 msgstore: move ZNC log functions to separate package 2023-02-17 14:35:25 +01:00
delthas
e510f7a461 Add support for explicit PostgreSQL schema prefixes for tests
PostgreSQL tests use pg_temp only. pg_temp is never searched for FTS
objects, so creating then altering an FTS configuration will not work
because PostgreSQL will not be able to find the FTS configuration it
just created.

Instead, we explicitly refer to the FTS objects with their full name
including their prefix, which makes PostgreSQL able to find the object.

This is only needed for tests.

See: https://stackoverflow.com/a/31095452/2347617
See: https://www.postgresql.org/message-id/15191.1208975632@sss.pgh.pa.us
2023-02-17 14:13:43 +01:00