1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-27 20:36:18 +00:00
Commit Graph

3665 Commits

Author SHA1 Message Date
Alexander Barton
7ccf98edfa Update doc/Platforms.txt 2024-04-26 14:18:32 +02:00
Alexander Barton
3e3f6cbece Clarify that "CAFile" is not set by default 2024-04-19 23:49:59 +02:00
Alexander Barton
75ef4e14e0 Add am example filter file for "Fail2Ban" 2024-04-19 23:40:19 +02:00
Val Lorentz
d4fb21f354
Fix channel symbol returned by RPL_NAMREPLY for secret channels
References:

- https://modern.ircdocs.horse/#rplnamreply-353
- https://datatracker.ietf.org/doc/html/rfc2812#page-47
- (RFC 1459 is irrelevant here, as
  https://datatracker.ietf.org/doc/html/rfc1459#page-51 uses a different
  format)

Closes #313.
2024-04-19 23:00:20 +02:00
Alexander Barton
90fb3cf0a2 Don't abort startup when setgid/setuid() fails with EINVAL
Both setgid(2) as well as setuid(2) can fail with EINVAL in addition to
EPERM, their manual pages state "EINVAL: The user/group ID specified in
uid/gid is not valid in this user namespace ".

So not only treat EPERM as an "acceptable error" and continue with
logging the error, but do the same for EINVAL.

This was triggered by the Void Linux xbps-uunshare(1) tool used for
building "XBPS source packages" and reported by luca in #ngircd. Thanks!
2024-04-13 20:48:54 +02:00
Alexander Barton
b77b9432c4 Test suite: Correctly test for LOGNAME and USER 2024-04-13 16:04:29 +02:00
Alexander Barton
a33d15751b Test suite: Don't use "pgrep -u" when LOGNAME and USER are not set
Thanks for reporting this on IRC, luca!
2024-04-13 15:54:06 +02:00
Alexander Barton
b362b5a945 ngIRCd Release 27~rc1 2024-04-13 12:26:55 +02:00
Alexander Barton
e3f96d446d Test suite: Use $USER in getpid.sh when $LOGNAME is not set
The LOGNAME environment variable is not set in GitHub "actions", for
example ...
2024-04-13 12:22:35 +02:00
Alexander Barton
0d42ea7709 Update doc/Platforms.txt 2024-04-11 22:11:38 +02:00
Alexander Barton
4b1eb0e3ee ngircd.service: Redirect stdout and stderr to the journal 2024-04-11 22:09:52 +02:00
Alexander Barton
ff0a9b9c2a Prepare documentation for ngIRCd 27~rc1 2024-04-06 00:13:24 +02:00
Alexander Barton
791778d7b6 Ping the service manager and set a status message
Periodically "ping" the service manager (every 3 seconds) and set a
status message showing connection statistics.

This enables using the systemd(8) watchdog functionality for the
"ngircd.service" unit.
2024-04-06 00:13:13 +02:00
Alexander Barton
e4873b4d63 Add support for the "sd_notify" protocol
This allows the "ngircd.service" systemd(8) unit to use the "notify"
service type, which allows for better status tracking by the service
manager.
2024-04-06 00:12:58 +02:00
Alexander Barton
3e535a2955 Add ".trunk" to .gitignore file 2024-04-05 23:16:07 +02:00
Alexander Barton
a8a37b681e Test suite: wait for ERROR message on QUIT
Wait for the "ERROR :Closing connection" message sent by ngIRCd when
handling the QUIT command, do not wait for "Connection closed" which is
actually output by the telnet(1) command and is implementation
dependant! For example, on Haiku OS, this is not always(!) echoed (the
command seems to hang sometimes?) which results in unpredictable
failures in the test suite ...
2024-04-05 23:16:07 +02:00
Alexander Barton
22a8744476 Test suite: simplify and enhance getpid.sh
- Try to only search for processes of the current user.
- Prefer using pgrep (in addition to pidof) when available.
- Streamline system overrides.
- Get rid of HEAD_FLAGS: all systems so far support "-1".
- Use "ps -o pid,comm" as the default, which is POSIX.1.
- Use "sort -r" to hopefully get the newest (=highest) PID, which is the
  case on older systems not using randomized PIDs at least.
2024-04-05 23:16:07 +02:00
Alexander Barton
7e78c293a9 Test suite: clean up scripts
- Reformat code.
- Cleanup some glitches, streamline scripts ...
- Enable "set -u": Error on unset variables.
- Detect "$srcdir" in prep-server3 script, too.
2024-04-05 23:16:07 +02:00
Alexander Barton
8d6f2c2820 Revert "testsuite: Pass -nameopt to openssl s_client."
Although this is a nice looking solution, it is not that portable: for
example, the "openssl s_client" command of LibreSSL 3.8.2 on OpenBSD 7.4
does not support it.

So let's revert back to the "uglier" but working variant ...

This reverts commit bdb55fb4b3.
2024-04-02 22:06:38 +02:00
Alexander Barton
ddba126307 Fix quoting in code examples in doc/Container.md 2024-03-31 11:19:48 +02:00
Alexander Barton
bbcaf628f4 Change leftover GnuTLS "slot handling" messages to debug level
This completes commit f96966a6.
2024-03-31 11:19:48 +02:00
Alexander Barton
a0d491a09f Add feature info to Debian package description 2024-03-31 11:19:48 +02:00
Alexander Barton
3497925000 Try to set file descriptor limit to its maximum and show info on startup
The number of possible parallel connections is limited by the process
file descriptor limit (among other things). Therefore try to upgrade the
current "soft" limit to its "hard" maximum (but limit it to 100000), and
show an information or even warning, wenn still less than the configured
"MaxConnections" setting.

Please note that ngIRCd and its linked libraries (like PAM) need file
descriptors not only for incoming and outgoing IRC connections, but for
reading files and inter-process communication, too! Therefore the actual
connection limit is _less_ than the file descriptor limit!

This introduces the new MAX_FD_LIMIT (100000) #define.
2024-03-31 11:19:48 +02:00
Alexander Barton
24e822cff2 ngircd.8: Update for the now always available debug-mode 2024-03-31 11:19:48 +02:00
Alexander Barton
71a2fe1895 Update and fix logcheck(8) rules 2024-03-31 11:19:48 +02:00
Christoph Biedl
b2c9049af2 S2S-SSL/GnuTLS: Enable CRL verification 2024-03-31 11:19:48 +02:00
Alexander Barton
b9d6a2f49c S2S-TLS: Fix "make check" in separate build directory 2024-03-23 20:23:32 +01:00
Alexander Barton
6b27eabf5b S2S-TLS: Add notice to INSTALL.md 2024-03-23 20:23:29 +01:00
Alexander Barton
b826fad158 S2S-TLS: Convert SSL.txt to Markdown and update information given
No longer describe creating self-signed certificates or using "stunnel",
as both is not recommended.
2024-03-23 20:19:01 +01:00
Alexander Barton
8cef3ce42c S2S-TLS/GnuTLS: Fix handling of connections without peer certificates 2024-03-23 20:19:01 +01:00
Alexander Barton
180e2ec135 S2S-TLS: Verify the TLS certificates by default
This is already mentioned as the default in the manual page and the
sample configuration file, but was actually not enabled in the code!
2024-03-23 20:19:01 +01:00
Alexander Barton
663972c88d S2S-TLS/GnuTLS: Streamline logging 2024-03-23 20:19:01 +01:00
Alexander Barton
509ff60326 S2S-TLS/GnuTLS: Fix handling of certificate information for incoming connections
Show proper certificate information for incoming connections, too, and
not "peer did not present a certificate", regardless if the client sent
a certificate or not.

This change is for GnuTLS and similar to what was implemented in commit
for OpenSSL in "S2S-TLS/OpenSSL: Fix handling of certificate information
for incoming connections".
2024-03-23 20:19:01 +01:00
Alexander Barton
0e176b5570 S2S-TLS/GnuTLS: Update SSL code for GnuTLS certificate reloading
Without this, the S2S-TLS-Patch not even compiles with GnuTLS because
of the "new" GnuTLS certificate reload support implemented in commit
eead4a63 ("x509_cred_slot").
2024-03-23 20:19:01 +01:00
Alexander Barton
c8589e9890 S2S-TLS: MAX_CERT_CHAIN_LENGTH is only used by OpenSSL 2024-03-23 20:19:01 +01:00
Alexander Barton
58ee4df2ae S2S-TLS: Fix formatting and sort new SSL options in ngircd.conf manual page 2024-03-23 20:19:01 +01:00
Alexander Barton
02bb99b024 S2S-TLS/OpenSSL: Streamline logging
This includes simplifying cb_connserver_login_ssl() a bit, we do not
have to code for invalid state which was ruled out by an assert() and
therefore can get rid of the goto altogether (and don't log the same
error twice with different messages).
2024-03-23 20:19:01 +01:00
Alexander Barton
3db3b47fc7 S2S-TLS/OpenSSL: Postpone verification of TLS session right before server handshake
The verify callback in OpenSSL is called pretty early, and at that time
it is not possible yet to check which connection it belongs to, and some
connections may have relaxed requirements.

So always return success in the Verify_openssl() callback, and postpone
validation of the TLS session until starting the server handshake in
cb_connserver_login_ssl(), when we know which server this connection
belongs to and which options (like "SSLVerify") are in effect.

The code doing this was already present in cb_connserver_login_ssl(),
but this patch adds a more prominent comment to the function.
2024-03-23 20:19:01 +01:00
Alexander Barton
679505aab9 S2S-TLS/OpenSSL: Fix handling of certificate information for incoming connections
Show proper certificate information for incoming connections, too, and
not "peer did not present a certificate", regardless if the client sent
a certificate or not.

And free the client certificate structure "peer_cert" on incoming
connections as well!
2024-03-23 20:19:01 +01:00
Alexander Barton
08647ab1e7 S2S-TLS/OpenSSL: Set the verification flags only once
Set the verification flags in the ConnSSL_SetVerifyProperties_openssl
function only, don't override them in ConnSSL_InitLibrary() afterwards.

No functional changes, now ConnSSL_SetVerifyProperties_openssl() sets
exactly the parameters which ConnSSL_InitLibrary() always overwrote ...
2024-03-23 20:19:01 +01:00
Alexander Barton
84b019b11f S2S-TLS/OpenSSL: Always setup host name verification
Setup host name verification even when the "SSLVerify" option is
disabled, because even then the peer can present a valid certificate and
validation would always(!) fail because of the missing host name
verification setup.
2024-03-23 20:19:01 +01:00
Alexander Barton
8f8bef9fae S2S-TLS: Remove leftover debug messages 2024-03-23 20:19:01 +01:00
Alexander Barton
5ca567a18c S2S-TLS: Add missing CAFile and CRLFile options to "configtest" output 2024-03-23 20:19:01 +01:00
Christoph Biedl
817937b218 Support for server certificate validation on server links [S2S-TLS]
This patch provides code to validate the server certificate in
server links, defeating nasty man-in-the-middle attacks on server
links.

Features:

- Check whether the certificate is signed by a trusted certificate
  authority (CA).
- Check the host name, including wildcard certificates and Subject
  Alternative Names.
- Optionally check against a certificate revocation list (CRL).
- Implementation for both OpenSSL and GnuTLS linkage.

Left for another day:

- Parameterize the TLS parameter of an outbound connection. Currently,
  it's hardcoded to disable all versions before TLSv1.1.
- Using certificate as CA-certificate. They work for GnuTLS only but
  perhaps this should rather raise an error there, too.
- Optional OCSP checking.
- Checking client certificates. Code is there but this first needs some
  consideration about the use cases. This could replace all other
  authentication methods, for both client-server and server-server
  connections.

This patch is based on a patch by Florian Westphal from 2009, which
implemented this for OpenSSL only:

  From: Florian Westphal <fw@strlen.de>
  Date: Mon, 18 May 2009 00:29:02 +0200
  Subject: SSL/TLS: Add initial certificate support to OpenSSL backend

Commit message modified by Alex Barton.

Closes #120, "Server links using TLS/SSL need certificate validation".
Supersedes PR #8, "Options for verifying and requiring SSL client
certificates", which had (incomplete?) code for OpenSSL, no GnuTLS.
2024-03-23 20:19:01 +01:00
Alexander Barton
339ad77b62 Streamline README.md & INSTALL.md files
- Tweak some paragraphs and bring others more in line with texts on the
  homepage ...
- Try to not duplicate information:
  - Configuration is explained in doc/QuickStart.md;
  - command line parameters are already better described in the
    ngircd(8) manual page.
- Move all pointers to documentation to the README.md file, which is
  directly shown in GitHub when browsing the repository, for example.
2024-03-23 20:15:16 +01:00
Alexander Barton
c8798fcec0 Bring manual page more in line with README.md and homepage 2024-03-23 19:58:23 +01:00
Alexander Barton
c1c0bca0e2 QuickStart.md: Tweak the text a bit ... 2024-03-17 22:42:19 +01:00
Alexander Barton
7efda4168f INSTALL.md: Add info for macOS systems 2024-03-17 22:42:19 +01:00
Alexander Barton
1118b0e77c METATADA: Fix unsetting "cloakhost"
Correctly re-generate the "cloaked hostname" when removing the
"cloakhost" using an empty string by passing down NULL instead of the
empty string, which results in protocol violations (for example on
WHOIS).
2024-03-17 22:42:19 +01:00
Alexander Barton
5fd195a2cd Update the "rpm" make target to use rpmbuild(8) 2024-03-17 22:42:19 +01:00