Commit Graph

948 Commits

Author SHA1 Message Date
Simon Ser
bdb132ad98
Implement rate limiting for upstream messages
Allow up to 10 outgoing messages in a burst, then throttle to 1 message
each 2 seconds.

Closes: https://todo.sr.ht/~emersion/soju/87
2020-08-19 19:42:33 +02:00
Simon Ser
9f26422592
Escape user/network/entity characters in log file path
ZNC replaces slashes and backslashes with a dashes.
2020-08-19 12:22:32 +02:00
Simon Ser
ee32329a14
Strip message tags in error message
The time tag was causing the registration error messages to be
continuously sent to downstream connections.
2020-08-19 11:50:19 +02:00
Simon Ser
78361f0b1e
Encode idents to hex instead of base64
base64 strings may contain characters rejected by ident clients such
as "+". Use hex encoding and shorten the string a little.
2020-08-19 11:24:25 +02:00
Simon Ser
ca40e79855
ident: remove leftover debug log 2020-08-18 17:57:12 +02:00
Dan Shick
54efb1cab4
Fix store user query values 2020-08-18 00:26:59 +02:00
Simon Ser
c654d2bac4
Format CTCP ACTION messages in logs 2020-08-17 15:01:53 +02:00
Simon Ser
3d8ed90055
Parse NOTICE messages from logs 2020-08-17 13:55:22 +02:00
Simon Ser
0831dbe6f1
Handle upstream ERROR messages 2020-08-13 15:31:07 +02:00
Simon Ser
9fd69c745e
Handle ERR_NOPERMFORHOST and ERR_YOUREBANNEDCREEP 2020-08-13 15:31:03 +02:00
Simon Ser
ba37d374ec
Add missing ident.go
Forgot to check in this file.

Fixes: 65302d3c1e ("Add an ident server")
2020-08-13 12:58:29 +02:00
Simon Ser
745b3f67a0
Extract history loading into functions
These will get re-used for sending history to clients that don't support
the chathistory extension.
2020-08-11 15:58:50 +02:00
Simon Ser
3d316fe01c
doc: add ident server to man page 2020-08-11 11:03:20 +02:00
Simon Ser
65302d3c1e
Add an ident server
Closes: https://todo.sr.ht/~emersion/soju/69
2020-08-11 10:59:06 +02:00
Simon Ser
6faa081a7c
Add conn.{Local,Remote}Addr 2020-08-11 10:35:05 +02:00
Simon Ser
20c26d113c
Add ircConn.LocalAddr 2020-08-11 10:34:38 +02:00
Simon Ser
0812c795f4
Add User.ID
For now it's just a new field that'll be useful to generate user ident
strings. It uses the SQLite implicit rowid column. In the future the DB
interface will need to be updated to use user IDs instead of usernames.
2020-08-11 10:26:42 +02:00
Simon Ser
7c31c26d86
Don't perform TLS handshake in connectToUpstream
This defers TLS handshake until the first read or write operation. This
allows the upcoming identd server to register the connection before the
TLS handshake is complete, and is necessary because some IRC servers
send an ident request before that.
2020-08-11 10:24:54 +02:00
Simon Ser
c1f8002428
cmd/sojuctl: read user from DB before updating it
This makes sure we don't overwrite other fields, such as Admin.

Closes: https://todo.sr.ht/~emersion/soju/85
2020-08-11 10:21:49 +02:00
Simon Ser
ccc8768435
Add user delete command
References: https://todo.sr.ht/~emersion/soju/17
2020-08-10 15:04:01 +02:00
Simon Ser
6598fcf36e
Remove user from Server map when stopped 2020-08-10 15:03:38 +02:00
Simon Ser
6baa15ba14
Make user.stop block
This allows callers to wait until the user has been stopped.
2020-08-10 15:03:38 +02:00
Simon Ser
ef01142a44
Add user.stop 2020-08-10 15:03:38 +02:00
Simon Ser
b71fcc2e00
Add DB.DeleteUser 2020-08-03 18:43:39 +02:00
Hubert Hirtz
5e2910ba9d
Fix help message for BouncerServ's network update
It was missing the network name as first argument.
2020-08-03 11:03:39 +02:00
Simon Ser
73f9a6e455
readme: update mailing list link 2020-07-24 09:49:54 +02:00
Thorben Günther
0ff4ac07fe
doc: fix typo in man page 2020-07-23 23:31:37 +02:00
Simon Ser
2793698dbb
config: make http-origin directive overwrite previous list
Let's be on the safe side and assume the user doesn't meant the union of
all directive values.
2020-07-22 18:07:55 +02:00
Simon Ser
ef2dd479bf
Add accept-proxy-ip config directive
This allows to set the list of IPs allowed to act as a proxy. This is
only used for WebSockets right now, but will be expanded to TCP as well
once the PROXY protocol is supported.
2020-07-22 17:03:01 +02:00
Simon Ser
b0bf012bbc
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.
2020-07-22 15:44:19 +02:00
Simon Ser
d3661705dc
doc: add example config file in man page 2020-07-22 15:43:22 +02:00
Simon Ser
ec7c78050a
readme: mention the znc-import tool 2020-07-22 13:36:19 +02:00
Nomeji
9d27f393dc readme: expand usage 2020-07-22 13:06:03 +02:00
Simon Ser
c616a17041
doc: mention SASL EXTERNAL in the CertFP docs 2020-07-22 12:51:32 +02:00
Simon Ser
cc01ffc19d
Rename certfp reset to sasl reset
And make it reset all SASL credentials.
2020-07-22 12:20:52 +02:00
Simon Ser
2a3ae55f52
Add a sasl set-plain command
This allows to manually set the SASL credentials for a network.
2020-07-22 12:16:13 +02:00
Simon Ser
cd3eacdbfc
go fmt 2020-07-22 12:16:01 +02:00
Simon Ser
360ce5b72d
doc: document the network update command 2020-07-22 12:04:26 +02:00
Simon Ser
dcfe206bda
Implement CHATHISTORY AFTER
References: https://todo.sr.ht/~emersion/soju/12
2020-07-15 17:47:57 +02:00
Simon Ser
25d4312e0f
Prevent error handler from falling through in user.run 2020-07-09 14:20:23 +02:00
Simon Ser
907da56311
Add unix as supported upstream URL scheme to service 2020-07-09 12:19:51 +02:00
Simon Ser
1ac895430a
contrib/znc-import: new utility
Allows populating the soju database from a ZNC config file.
2020-07-09 11:25:25 +02:00
Simon Ser
7ebe47ad4a
Fix deadlock in DB.Close
This method was calling itself, instead of the underlying SQLite
database's Close method.
2020-07-09 11:23:51 +02:00
Simon Ser
51dc9f0bf9
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.
2020-07-08 18:21:52 +02:00
Simon Ser
1685ba23b3
Strip network name from nickname when auto-saving network 2020-07-06 18:13:40 +02:00
Simon Ser
85fad93a71
Add support for upstream Unix socket connections
References: https://todo.sr.ht/~emersion/soju/51
2020-07-06 17:31:11 +02:00
Simon Ser
7af21d9d81
Parse upstream URLs with net/url
This allows us to ignore the path part of the URL. This is preliminary
work for unix URLs.
2020-07-06 17:18:13 +02:00
Simon Ser
b46a2554e1
Check upstream address with net.SplitHostPort
Looking for a colon is incorrect, IPv6 addresses can contain colons too.
2020-07-06 16:04:56 +02:00
Simon Ser
c490705fee
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.
2020-07-06 11:06:20 +02:00
Simon Ser
4c8b01fb51
Make length check clearer in sendNames 2020-07-06 10:59:34 +02:00