369 Commits

Author SHA1 Message Date
contact
2ebc03a712 Change unix:// to irc+unix://
When Unix socket support will be added for listeners, unix:// will be
ambiguous. It won't be clear whether to setup an IRC server, or some
other kind of server (e.g. identd).

unix:// is still recognized to avoid breaking existing DBs.

git-svn-id: file:///srv/svn/repo/suika/trunk@369 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 13:44:19 +00:00
contact
06cc81a33e doc: add example config file in man page
git-svn-id: file:///srv/svn/repo/suika/trunk@368 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 13:43:22 +00:00
contact
5769fa7867 readme: mention the znc-import tool
git-svn-id: file:///srv/svn/repo/suika/trunk@367 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 11:36:19 +00:00
nomeji
12843259a4 readme: expand usage
git-svn-id: file:///srv/svn/repo/suika/trunk@366 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 11:06:03 +00:00
contact
8dddba2c84 doc: mention SASL EXTERNAL in the CertFP docs
git-svn-id: file:///srv/svn/repo/suika/trunk@365 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 10:51:32 +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
9e9565daf0 go fmt
git-svn-id: file:///srv/svn/repo/suika/trunk@362 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 10:16:01 +00:00
contact
3c2981df11 doc: document the network update command
git-svn-id: file:///srv/svn/repo/suika/trunk@361 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 10:04:26 +00:00
contact
803dbabd4f Implement CHATHISTORY AFTER
References: https://todo.sr.ht/~emersion/soju/12

git-svn-id: file:///srv/svn/repo/suika/trunk@360 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-15 15:47:57 +00:00
contact
b97cd39cd3 Prevent error handler from falling through in user.run
git-svn-id: file:///srv/svn/repo/suika/trunk@359 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-09 12:20:23 +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
542445e391 contrib/znc-import: new utility
Allows populating the soju database from a ZNC config file.

git-svn-id: file:///srv/svn/repo/suika/trunk@357 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-09 09:25:25 +00:00
contact
1bceed3bdb Fix deadlock in DB.Close
This method was calling itself, instead of the underlying SQLite
database's Close method.

git-svn-id: file:///srv/svn/repo/suika/trunk@356 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-09 09:23:51 +00:00
contact
dddac6e178 Broadcast unhandled messages to downstream connections
In case labelled-response isn't supported, broadcast unhandled messages
to all downstream connections. That's better than silently dropping the
messages.

git-svn-id: file:///srv/svn/repo/suika/trunk@355 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-08 16:21:52 +00:00
contact
6ba63d0774 Strip network name from nickname when auto-saving network
git-svn-id: file:///srv/svn/repo/suika/trunk@354 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 16:13:40 +00:00
contact
e55e59080e Add support for upstream Unix socket connections
References: https://todo.sr.ht/~emersion/soju/51

git-svn-id: file:///srv/svn/repo/suika/trunk@353 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 15:31:11 +00:00
contact
e4b56520f9 Parse upstream URLs with net/url
This allows us to ignore the path part of the URL. This is preliminary
work for unix URLs.

git-svn-id: file:///srv/svn/repo/suika/trunk@352 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 15:18:13 +00:00
contact
04309085c4 Check upstream address with net.SplitHostPort
Looking for a colon is incorrect, IPv6 addresses can contain colons too.

git-svn-id: file:///srv/svn/repo/suika/trunk@351 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 14:04:56 +00:00
contact
1a16d0b47a Sort and split JOIN messages
Sort channels so that channels with a key appear first. Split JOIN
messages so that we don't reach the message size limit.

git-svn-id: file:///srv/svn/repo/suika/trunk@350 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 09:06:20 +00:00
contact
0a87ae1452 Make length check clearer in sendNames
git-svn-id: file:///srv/svn/repo/suika/trunk@349 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 08:59:34 +00:00
contact
3367f4ebd8 Accept "irc" WebSocket subprotocol
git-svn-id: file:///srv/svn/repo/suika/trunk@348 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-02 09:05:49 +00:00
contact
51df0c157e Add RemoteAddr to ircConn interface
git-svn-id: file:///srv/svn/repo/suika/trunk@347 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-01 15:02:37 +00:00
hubert
3f1ece2d19 Send compact channel name lists
This commit resolves `sendNames`' TODO.

git-svn-id: file:///srv/svn/repo/suika/trunk@346 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-30 08:28:05 +00:00
contact
e9f9453cba Only read X-Forwarded-* if remote address is loopback
git-svn-id: file:///srv/svn/repo/suika/trunk@345 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-29 16:33:23 +00:00
contact
d97de5552f Extract X-Forwarded-* headers for WebSocket connections
git-svn-id: file:///srv/svn/repo/suika/trunk@344 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-29 16:27:43 +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
929f7b48c6 Handle registration failures
References: https://todo.sr.ht/~emersion/soju/30

git-svn-id: file:///srv/svn/repo/suika/trunk@342 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-29 15:52:49 +00:00
contact
8bf8de560b Return io.EOF on websocket connection closure
git-svn-id: file:///srv/svn/repo/suika/trunk@341 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-29 08:24:41 +00:00
hubert
a23ecb0998 Don't save corrupted NickServ credentials
soju saved most NickServ messages[0] as credentials because of a missing
`default` clause in the check of the NickServ command.

[0] messages that had at least a command and two other parameters

git-svn-id: file:///srv/svn/repo/suika/trunk@340 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-24 21:02:46 +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
delthas
a97dcd348b Fix sending messages from detached channels
Currently, a downstream receives MODE, RPL_CHANNELMODEIS and
RPL_CREATIONTIME messages from soju for detached channels. It should not
be sent any of these messages.

This adds a detach check to the handling of these messages to avoid
receiving these messages.

git-svn-id: file:///srv/svn/repo/suika/trunk@338 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-12 12:43:45 +00:00
contact
cd18b98c2a readme: extend copyright notice to all contributors
soju now has multiple contributors. Even if they weren't explicitly
listed as copyright holders, they still retain copyright ownership for
their contributions. Make this clear. See [1].

[1]: https://www.linuxfoundation.org/blog/2020/01/copyright-notices-in-open-source-software-projects/

git-svn-id: file:///srv/svn/repo/suika/trunk@337 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-12 12:37:43 +00:00
contact
6b4ba2d4ad readme: add link to website
git-svn-id: file:///srv/svn/repo/suika/trunk@336 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-10 21:00:50 +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
contact
c9a86bef5f ci: check scdoc is happy
git-svn-id: file:///srv/svn/repo/suika/trunk@332 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-10 14:15:20 +00:00
kl
8851fa97a9 docs: Fix manpage syntax
git-svn-id: file:///srv/svn/repo/suika/trunk@331 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-10 14:10:17 +00:00
delthas
535e85051f sojuctl: Add support for creating admin users
This adds a new flag, `-admin` for creating admin users, which can
access admin service commands, among which create-user to create other
users on-the-fly.

Since the person running the commands in the README will be the local
soju administrator, the user they create should be admin as well, hence
the README update.

git-svn-id: file:///srv/svn/repo/suika/trunk@330 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +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
d6d3e9ed7a Add an admin flag to users
This is preparatory work for letting some users access admin-exclusive
service commands, such as creating new users.

This adds a boolean admin flag to the User schema. Old users will stay
non-admin after the DB migration.

git-svn-id: file:///srv/svn/repo/suika/trunk@327 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +00:00
delthas
7f49fa7971 Fix: Check the stdin scanner for errors when reading the password
Reading from stdin with Scanner.Scan() can either fail because of a read
error, or return no bytes because the EOF was reached.

This adds support for checking these cases before actually reading the
password.

git-svn-id: file:///srv/svn/repo/suika/trunk@326 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
contact
7c4131cbdb Introduce User.Created
For Network and Channel, the database only needed to define one Store
operation to create/update a record. However since User is missing an ID
we couldn't have a single StoreUser function like other types. We had
CreateUser and UpdatePassword. As new User fields get added (e.g. the
upcoming Admin flag) this isn't sustainable.

We could have CreateUser and UpdateUser, but this wouldn't be consistent
with other types. Instead, introduce User.Created which indicates
whether the record is already stored in the DB. This can be used in a
new StoreUser function to decide whether we need to UPDATE or INSERT
without relying on SQL constraints and INSERT OR UPDATE.

The ListUsers and GetUser functions set User.Created to true.

git-svn-id: file:///srv/svn/repo/suika/trunk@324 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 09:59:03 +00:00
contact
f38af41317 Add support for WebSocket connections
WebSocket connections allow web-based clients to connect to IRC. This
commit implements the WebSocket sub-protocol as specified by the pending
IRCv3 proposal [1].

WebSocket listeners can now be set up via a "wss" protocol in the
`listen` directive. The new `http-origin` directive allows the CORS
allowed origins to be configured.

[1]: https://github.com/ircv3/ircv3-specifications/pull/342

git-svn-id: file:///srv/svn/repo/suika/trunk@323 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-07 12:13:46 +00:00
contact
b70a72598e Fail auth on empty password in DB
git-svn-id: file:///srv/svn/repo/suika/trunk@322 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-06 10:52:22 +00:00
contact
73e3e9a645 doc: update URL to sr.ht hub in man page
git-svn-id: file:///srv/svn/repo/suika/trunk@321 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-05 22:23:25 +00:00
contact
d0e4ccf213 doc: add missing change-password service command
git-svn-id: file:///srv/svn/repo/suika/trunk@320 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-05 22:21:37 +00:00