635 Commits

Author SHA1 Message Date
contact
75cc0231be db_postgres: fix constraints errors
Stop using ON CONFLICT DO UPDATE.

Closes: https://todo.sr.ht/~emersion/soju/138

git-svn-id: file:///srv/svn/repo/suika/trunk@635 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-13 08:12:14 +00:00
hubert
3a20033cc7 db_postgres: handle both constraints on network updates
Closes: https://todo.sr.ht/~emersion/soju/138

git-svn-id: file:///srv/svn/repo/suika/trunk@634 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-13 06:53:49 +00:00
contact
dcba21c7e5 contrib/clients: update IRCv3 caps for Weechat 3.3
git-svn-id: file:///srv/svn/repo/suika/trunk@633 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 19:49:06 +00:00
contact
66229dd5e8 doc.soju.1: fix typo and improve formatting for "certfp generate"
git-svn-id: file:///srv/svn/repo/suika/trunk@632 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 19:34:25 +00:00
contact
7cce9c4a31 doc/soju.1: add descriptions for all flags for "user create"
git-svn-id: file:///srv/svn/repo/suika/trunk@631 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 19:31:12 +00:00
contact
18b7972e80 doc/soju.1: use angle-brackets for URL
Helps a bit terminal emulators to recognize the link.

git-svn-id: file:///srv/svn/repo/suika/trunk@630 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 19:27:48 +00:00
contact
9d5456fb96 Stop sending RPL_CREATED
There's no point in sending this numeric if it doesn't contain any
useful info.

git-svn-id: file:///srv/svn/repo/suika/trunk@629 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 17:28:44 +00:00
contact
75c7442d34 msgstore_fs: fix ListTargets error on missing log dir
Initially, before connecting to the network, the log dir will be
empty. Return an empty list of chat history targets in this case.

git-svn-id: file:///srv/svn/repo/suika/trunk@628 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 15:36:00 +00:00
contact
627f9f74a7 Fix printf formatting in error message
git-svn-id: file:///srv/svn/repo/suika/trunk@627 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 15:36:00 +00:00
contact
bf890cb13a Upgrade dependencies
git-svn-id: file:///srv/svn/repo/suika/trunk@626 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-12 14:54:51 +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
2de938c585 ci: run PostgreSQL tests
git-svn-id: file:///srv/svn/repo/suika/trunk@624 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-11 14:06:37 +00:00
contact
c5006e45a7 Fix unused imports in tests
git-svn-id: file:///srv/svn/repo/suika/trunk@623 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-11 14:01:50 +00:00
contact
76d67ceb78 Run server test with PostgreSQL too
git-svn-id: file:///srv/svn/repo/suika/trunk@622 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-11 13:57:37 +00:00
contact
d7c72036a1 db_postgres: add migration test
git-svn-id: file:///srv/svn/repo/suika/trunk@621 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-11 13:55:07 +00:00
hubert
bbe15df672 PostgreSQL support
git-svn-id: file:///srv/svn/repo/suika/trunk@620 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-11 13:21:04 +00:00
contact
7e56d2149b db_sqlite: add migration test
git-svn-id: file:///srv/svn/repo/suika/trunk@619 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-11 10:26:51 +00:00
hubert
75c35762b2 Correctly send back PRIVMSGs and NOTICEs to self
git-svn-id: file:///srv/svn/repo/suika/trunk@618 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-10 10:05:41 +00:00
hubert
51c6ddf269 Send back TAGMSGs to self
git-svn-id: file:///srv/svn/repo/suika/trunk@617 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-10 10:05:41 +00:00
hubert
83f092720a Dismiss TAGMSGs directed to BouncerServ
git-svn-id: file:///srv/svn/repo/suika/trunk@616 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-10 10:05:40 +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
2c0f43286d build: don't clobber config file
Use `test -f` instead of `cp -n`, because the former is POSIX.

References: https://github.com/emersion/soju/pull/32

git-svn-id: file:///srv/svn/repo/suika/trunk@613 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-08 07:11:31 +00:00
contact
8dda53c683 Add max-user-networks config option
git-svn-id: file:///srv/svn/repo/suika/trunk@612 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-07 18:43:10 +00:00
contact
3547bb7749 doc/soju.1: mention that accept-proxy-ip affects PROXY proto
git-svn-id: file:///srv/svn/repo/suika/trunk@611 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-07 18:04:20 +00:00
alex
700f5d91c6 chathistory: Fix truncated backlog due to timezones
Because msgstore_fs writes logs in localtime, the CHATHISTORY timestamps
(UTC) must be converted to localtime prior to filtering ranges ensure
the right range is sent back to the client.

Prior to this patch, the iteration back from the BEFORE time failed to
load the hours between midnight UTC and midnight localtime in each day's
logged messages. This is because the final time to be considered in a
day's log file (the "start" time) reuses the previous start time's
locale:

    start = time.Date(year, month, day, 0, 0, 0, 0, start.Location()).Add(-1)

By converting the original start and end from the CHATHISTORY commands
to localtime in Load*Time and ListTargets, we ensure we read through
midnight each day.

git-svn-id: file:///srv/svn/repo/suika/trunk@610 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-07 09:57:42 +00:00
contact
c8179c1537 Add WHOIS reply for BouncerServ
git-svn-id: file:///srv/svn/repo/suika/trunk@609 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-06 09:50:12 +00:00
contact
3a0dc00117 msgstore_fs: add limit on number of opened files
git-svn-id: file:///srv/svn/repo/suika/trunk@608 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-06 09:41:39 +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
contact
40fbc3d61d test: get rid of testUpstream
No need for this complexity.

git-svn-id: file:///srv/svn/repo/suika/trunk@604 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 12:26:10 +00:00
contact
fbabe10b66 test: add NOTICE broadcast
git-svn-id: file:///srv/svn/repo/suika/trunk@603 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 12:14:31 +00:00
contact
44f7e07b44 test: add upstream
git-svn-id: file:///srv/svn/repo/suika/trunk@602 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 12:03:17 +00:00
contact
f5c683daec Use isErrClosed in Server.Serve
git-svn-id: file:///srv/svn/repo/suika/trunk@601 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 12:02:59 +00:00
contact
a62892d469 Add basic server test
git-svn-id: file:///srv/svn/repo/suika/trunk@600 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 10:11:40 +00:00
contact
15036cef1e Close DB on shutdown
git-svn-id: file:///srv/svn/repo/suika/trunk@599 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 09:53:38 +00:00
contact
3131c1ef6e db_sqlite: fix realname not fetched in ListUsers
This fixes per-user realname not being used on bouncer startup.

git-svn-id: file:///srv/svn/repo/suika/trunk@598 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-05 09:10:48 +00:00
contact
caa77db7cd Add support for IRCv3 WebSocket text subprotocol
Technically we aren't spec-compliant since we don't serve
binary.ircv3.net. Any complaints will be redirected to /dev/null.

git-svn-id: file:///srv/svn/repo/suika/trunk@597 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-28 19:25:06 +00:00
contact
1dfd2238c0 db_sqlite: switch to sql.Named
This allows us to avoid mixing up arguments.

git-svn-id: file:///srv/svn/repo/suika/trunk@596 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-27 14:54:06 +00:00
hubert
37a8fe455d Fix DeliveryReceipt not being cleaned up
git-svn-id: file:///srv/svn/repo/suika/trunk@595 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-21 16:19:05 +00:00
contact
d046f6b294 Workaround lack of net.ErrClosed in WebSocket library
git-svn-id: file:///srv/svn/repo/suika/trunk@594 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-21 09:49:48 +00:00
contact
bc8adc94c0 readme: add note to use system libsqlite3
git-svn-id: file:///srv/svn/repo/suika/trunk@593 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-21 09:44:08 +00:00
chris
f42c6694ff Set a higher timeout for proxyproto listeners
go-proxyproto added support for a read timeout in 0.6.0[1] and
defaulted it to 200ms. After this time if no data is read on
the socket, it is closed.

This is _really_ low if the underlying connection is a TLS
one as no data pops out the other end until the handshake is
done. It effectively limits you to TLS connections within
a 50ms RTT of your bouncer with clients that are fast enough
at responding.

It appears that HexChat on Arch is somehow slow enough at
TLS connections thant it consistently takes longer than
200ms even over localhost, meaning it outright can't connect
to soju any longer.

To make this a lot less painful, have soju pass in a read
timeout of 5 seconds. This feels like a reasonable tradeoff
between keeping (possibly malicious) connections open and
accepting the realities of network connections.

[1]: https://github.com/pires/go-proxyproto/issues/65

git-svn-id: file:///srv/svn/repo/suika/trunk@592 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-19 15:00:40 +00:00
hubert
42aec095f7 msgstore_fs: escape "." and ".."
git-svn-id: file:///srv/svn/repo/suika/trunk@591 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-19 14:55:12 +00:00
hubert
d061961130 Allow CAP negotiation to happen with CAP REQ
See https://ircv3.net/specs/extensions/capability-negotiation

> Upon receiving either a CAP LS or CAP REQ command during connection
> registration, the server MUST not complete registration until the
> client sends a CAP END command to indicate that capability negotiation
> has ended.

This commit should prevent soju from trying to authenticate the user
prior to having received AUTHENTICATE messages, when the client eagerly
requests capabilities with CAP REQ seeing available capabilities
beforehand with CAP LS.

git-svn-id: file:///srv/svn/repo/suika/trunk@590 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-19 14:50:47 +00:00
hubert
b19b03fa6d Use NULL-tolerant comparison for DeliveryReceipts
Since NULL = NULL is always FALSE, this query needs to use IS instead.
This should fix the flood of DeliveryReceipts in the DB.

See https://www.sqlite.org/lang_expr.html

> The IS and IS NOT operators work like = and != except when one or both
> of the operands are NULL. In this case, if both operands are NULL,
> then the IS operator evaluates to 1 (true) and the IS NOT operator
> evaluates to 0 (false). If one operand is NULL and the other is not,
> then the IS operator evaluates to 0 (false) and the IS NOT operator is
> 1 (true). It is not possible for an IS or IS NOT expression to
> evaluate to NULL.

git-svn-id: file:///srv/svn/repo/suika/trunk@589 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-14 16:38:58 +00:00
hubert
e0e9f5d21a Explicitly close connection to SQLite on failed upgrade
git-svn-id: file:///srv/svn/repo/suika/trunk@588 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-13 15:14:04 +00:00
contact
fbf641890a Upgrade dependencies
git-svn-id: file:///srv/svn/repo/suika/trunk@587 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-13 12:23:33 +00:00
contact
83bfbdca16 Send empty history for service
Fixes error when fetching chat history for BouncerServ.

git-svn-id: file:///srv/svn/repo/suika/trunk@586 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-09-13 09:36:25 +00:00