Commit Graph

72 Commits

Author SHA1 Message Date
delthas
21af06302a 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.
2020-06-08 22:30:09 +02:00
delthas
ed943f5451 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.
2020-06-08 22:30:09 +02:00
Simon Ser
998546cdc3
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.
2020-06-08 11:59:03 +02:00
Simon Ser
d0cf1d2882
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
2020-06-07 14:13:46 +02:00
Simon Ser
6c1634799a
Allow multiple listeners, default to ircs
Users can now specify multiple "listen" directives in their
configuration file. If -listen is specified on the CLI, it's added to
the list of listeners.

Listeners are now parsed as URLs. If the scheme is missing "ircs" is
assumed. URLs allow to enable/disable TLS on a per-listener basis and
will be used for Unix sockets too.

The default listening address is changed from irc+insecure://:6667 to
ircs://:6697. This avoids setting up an insecure listener opened to
everybody.
2020-06-04 20:16:23 +02:00
Thorben Günther
1622b772ab Allow to read password when stdin is not a tty. 2020-06-03 15:51:56 +02:00
Thorben Günther
148bbc8102
Add ability to change password 2020-04-10 10:09:02 +02:00
delthas
0607b940e2 Add support for bouncer logs
Add bouncer logs, in a network/channel/date.log format, in a similar
manner to ZNC log module. PRIVMSG, JOIN, PART, QUIT, MODE are logged.

Add a config directive for the logs file, including a way to disable
them entirely.
2020-03-28 00:07:20 +01:00
Simon Ser
f3940117d1
Rename project to soju 2020-03-13 18:13:03 +01:00
Simon Ser
a572b24702
cmd/jouncectl: new command
Allows to create users.
2020-03-11 19:01:03 +01:00
Simon Ser
84fe3ae255
Add SQLite database
Closes: https://todo.sr.ht/~emersion/jounce/9
2020-03-04 18:22:58 +01:00
Simon Ser
6e12347f2b
cmd/jounce: fix non-TLS listener address 2020-03-03 15:15:57 +01:00
Simon Ser
286fb4b18c
Add a -debug flag 2020-02-18 16:31:18 +01:00
Simon Ser
1f5a72a7cf
Add config file 2020-02-18 14:10:23 +01:00
Simon Ser
603bd6bdef
Add CLI flags for listening address and hostname 2020-02-17 16:25:09 +01:00
Simon Ser
3b2bb58c60
Per-user connections 2020-02-07 11:36:42 +01:00
Simon Ser
ae7f162883
Join channels on upstream servers 2020-02-06 19:22:04 +01:00
Simon Ser
56d793543e
Connect to upstream servers 2020-02-06 16:03:07 +01:00
Simon Ser
06cd1ce44f
Add Server.Logger 2020-02-06 15:50:46 +01:00
Simon Ser
5547eb7290
Add connection registration 2020-02-04 18:56:07 +01:00
Simon Ser
6d4581a6d0
Send "unknown command" replies 2020-02-04 11:25:53 +01:00
Simon Ser
8e31fde0ab
Add basic IRC listener 2020-02-04 10:46:22 +01:00