about summary refs log tree commit diff
path: root/edit.c (unfollow)
Commit message (Collapse)Author
2021-07-13Revert "Remove explicit tls_handshake(3) from ircConnect"Klemens Nanni
This reverts commit 981ebc4f12b88fbf52ed0352428a0612dd2c2568. This broke `-o' to print the server certificate; without explicit handshake there will be no tls_read(3) in this short code path.
2021-07-13FreeBSD: Avoid caph_stream_rights(3)June McEnroe
caph_stream_rights(3) doesn't exist before FreeBSD 13.0 and there's no good reason to create that dependency. I still run servers on FreeBSD 12. This is a partial revert of cbc9545cb3f76733030c867f32ddb6a922cd2907.
2021-07-13Disable /exec in Kiosk mode (as documented)Klemens Nanni
2021-07-13/whois takes an optional nick argumentKlemens Nanni
2021-07-13Reword and clarify parts of the manualJune McEnroe
Mostly related to the utilities options.
2021-07-13Use CS command for paramless /op and /voiceJune McEnroe
Should match the actual /cs command.
2021-07-13Condense markup for ignore/highlight formatJune McEnroe
2021-07-13Point out precedence of multiple files and flagsJune McEnroe
2021-07-13Zero out server password after sendingJune McEnroe
Also send it directly using ircSend to avoid copying it and logging it to <debug>.
2021-07-13Make -o/printCert not load any files, pledge even earlierKlemens Nanni
No point in trying to load a self-signed server certificate which we are about to get from the server in the first place. No need to read client certificate/key files when all we want is the server certificate: in TLS the server always sends its certificate before the client replies with any key material, i.e. catgirl sending client data is useless. catgirl(1) synopsis also notes how these options are irrelevant in the -o/printCert case. As a result, ircConfig() no longer requires any filesystem I/O in this case, so hoist the purely network I/O related pledge() call to enforce this -- more secure, self-documenting code!
2021-07-13Attempt to keep "security" in README accurateJune McEnroe
It's a short summary trying to cover different systems...
2021-07-13OpenBSD: merge unveil and pledge logic a bitKlemens Nanni
This reads somewhat clearer as code is grouped by features instead of security mechanisms by simply merging identical tests/conditions. No functional change.
2021-07-13OpenBSD: unveil logs regardless of restrict modeKlemens Nanni
Simplify logic and decouple the two features such that the code gets even more self-ducumenting. Previously `catgirl -R -l' would never unveil and therefore "proc exec" could execute arbitrary paths without "rpath" as is usual unveil/pledge semantic. Now that `catgirl -l' alone triggers unveil(2), previous "proc exec" alone is not enough since the first unveil() hides everything else from filesystem; unveil all of root executable-only in order to restore non-restrict mode's visibility. This leaves yields distinct cases wrt. filesystem visibility (hoisted save file functionality excluded): 1. restrict on, log off: no access 2. restrict on, log on : logdir write/create 3. restrict off, log off: all exec-only 4. restrict off, log on : logdir write/create, all else exec-only In the first case `unveil("/", "")' could be used but with no benefit as the later lack of "rpath wpath cpath", i.e. filesystem access is revoked entirely by pledge alone already. Practically, this does not change functionality but improves correctness and readability.
2021-07-02Save invited channel for /joinJune McEnroe
2021-06-28Move security to the features listJune McEnroe
The restrict option now enables real sandboxing on the two main target systems.
2021-06-28OpenBSD: unveil the log directory specificallyJune McEnroe
The call to logOpen() will have already created the directory. Still use dataMkdir() as a convenient way to get the created path.
2021-06-28FreeBSD: Use capsicum_helpers.hJune McEnroe
2021-06-25Set MANDIR in chrootJune McEnroe
2021-06-25FreeBSD: Limit rights on log directoryJune McEnroe
2021-06-25FreeBSD: Limit rights on save fileJune McEnroe
2021-06-25FreeBSD: Limit rights on stdio and socketJune McEnroe
2021-06-25Remove explicit tls_handshake(3) from ircConnectJune McEnroe
The first call to ircFormat, which calls tls_write(3) in turn, will perform the handshake anyway. This way the handshake happens after the final pledge(2) call.
2021-06-25Move setting CLOEXEC on socket to ircConnectJune McEnroe
2021-06-25FreeBSD: Enter capabilities mode if restrictedJune McEnroe
2021-06-25Keep log directory open, use mkdirat(2) and openat(2)June McEnroe
2021-06-24Encourage packagers to patch in text macrosJune McEnroe
Maybe no one will ever do it but I think it's a fun idea.
2021-06-24Stop at previous \ when expanding macrosJune McEnroe
There was no reason to ever require whitespace before the macro name.
2021-06-21Replace SIGWINCH XXX comment with better explanationJune McEnroe
2021-06-21Register SIGWINCH handler before TLS connectKlemens Nanni
Otherwise resizing the terminal will end catgirl until a handler is registered, e.g. while in ircConnect(): catgirl: tls_handshake: (null) Hoist registration right after uiInitEarly() as earliest possible point in main() since initscr(3) sets up various signals incl. SIGWINCH, i.e. initialise `cursesWinch' afterwards to pick up curses(3)'s handler.
2021-06-21Handle EINTR from connect(2) gracefullyKlemens Nanni
Resizing the window early on may return early due to SIGWINCH. Continue asynchronously in that case instead of exiting.
2021-06-21Use NS and CS server aliasesJune McEnroe
I think I didn't use these originally because they were misconfigured on tilde.chat, but they work now, and supposedly server aliases should be more secure/reliable.
2021-06-21Open log files with CLOEXECJune McEnroe
2021-06-21Open save file with CLOEXECJune McEnroe
Otherwise a lingering process from /copy for example could hold the lock.
2021-06-20Use "secure" libtls ciphersKlemens Nanni
d3e90b6 'Use libtls "compat" ciphers' from 2018 fell back to "compat" ciphers to support irc.mozilla.org which now yields NXDOMAIN. All modern networks (should) support secure ciphers, so drop the hopefully unneeded list of less secure ciphers by avoiding tls_config_set_ciphers(3) and therefore sticking to the "secure" aka. "default" set of ciphers in libtls. A quick check shows that almost all of the big/known IRC networks support TLS1.3 already; those who do not at least comply with SSL_CTX_set_cipher_list(3)'s "HIGH" set as can be tested like this: echo \ irc.hackint.org \ irc.tilde.chat \ irc.libera.chat \ irc.efnet.nl \ irc.oftc.net | xargs -tn1 \ openssl s_client -quiet -cipher HIGH -no_ign_eof -port 6697 -host
2021-06-20OpenBSD: Only unveil used directoriesKlemens Nanni
dataMkdir() already picked the appropiate directory so make it return that such that unveilData() can go as only that one directory needs unveiling.
2021-06-20Handle "\1ACTION\1" empty actionsJune McEnroe
2021-06-20Don't match actions in noticesJune McEnroe
2021-06-20Handle TLS_WANNT_POLL{IN,OUT} from tls_handshake(3)June McEnroe
For blocking sockets it should be retried immediately.
2021-06-18Add -m mode option to set user modesJune McEnroe
2021-06-17Handle 338 as whois replyJune McEnroe
Used by Solanum for "actually using host".
2021-06-17Match window substrings case-sensitivelyJune McEnroe
Case-insensitivity was copied from regular complete(), but other commands which take substrings (/open and /copy) match case-sensitively.
2021-06-17Match windows by substring in /windowJune McEnroe
This could just iterate over idNames instead, but using complete means more recently used windows will match first.
2021-06-17Clean up if restricted && logEnable, pipe creationJune McEnroe
2021-06-17Add mailing list archive to READMEJune McEnroe
2021-06-17chat.tmux.conf: Make window selection hotkeys match window numbersKlemens Nanni
The 'pick chat network' binding on F1 lists tmux windows as follows and tmux's `choose-tree -Z' lets you jump to the window by pressing the key denoted inside parantheses. Set `base-index 1' so as to make window indices match up the hotkey number instead of being off-by-one due to the session itself being the first entry in the list. (0) - chat-5: 8 windows (group chat: chat-0,chat-1,chat-2,chat-3,chat-4,chat-5,chat-6) (attached) (1) ├─> 1: hackint: "example.com" (2) ├─> 2: efnet: "example.com" ... PS: Update existing sessions by updating chat.tmux.conf, pressing F5 then running `prefix-: move-window -r' to renumber all windows.
2021-06-15Send PINGs when server is quiet and die if no responseJune McEnroe
Every time we receive from the server, reset a timer. The first time the timer triggers, send a PING. The second time the timer triggers, die from ping timeout. I'm not sure about these two intervals: 2 minutes of idle before a PING, 30s for the server to respond to the PING.
2021-06-15OpenBSD: Simplify promise creation after seprintf() introductionKlemens Nanni
Just truncate the initial promises back to the final ones after pledging for the first time, saving code and memory. Assign `ptr' in all initial `seprintf()' calls for consistency while here.
2021-06-14OpenBSD: pledge final promises earlierKlemens Nanni
No need to wait for so long. This also brings all the pledge code on one screen and helps show how ircConnect() is the only relevant part in between initial and final promises.
2021-06-14Treat `-T's optional argument as optionalKlemens Nanni
`-T[format]' is not possible with getopt(3) but getopt_long(3) supports "T::" exactly for that, so make the command line option go in line with configuration files and documentation. While here, check `has_arg' explicitly as getopt_long(3) only documents mnemonic values not numerical ones.
2021-06-14Add \com text macroJune McEnroe