1
0

0001-Respect-SSLConnect-option-for-incoming-connections.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 65a304dab3329625b409efa161f2c31a7221ad7c Mon Sep 17 00:00:00 2001
  2. From: Alexander Barton <alex@barton.de>
  3. Date: Mon, 1 Jan 2024 18:20:26 +0100
  4. Subject: [PATCH 01/20] Respect "SSLConnect" option for incoming connections
  5. Don't accept incoming plain-text ("non SSL") server connections for
  6. servers configured with "SSLConnect" enabled.
  7. If "SSLConnect" is not set for an incoming connection the server still
  8. accepts both plain-text and encrypted connections.
  9. This change prevents an authenticated client-server being able to force
  10. the server-server to send its password on a plain-text connection when
  11. SSL/TLS was intended.
  12. (cherry picked from commit 21c1751b045b0be49e584a4ba191a330e0c381bb)
  13. ---
  14. src/ngircd/irc-server.c | 13 +++++++++++++
  15. 1 file changed, 13 insertions(+)
  16. --- a/src/ngircd/irc-server.c
  17. +++ b/src/ngircd/irc-server.c
  18. @@ -87,6 +87,19 @@
  19. return DISCONNECTED;
  20. }
  21. +#ifdef SSL_SUPPORT
  22. + /* Does this server require an SSL connection? */
  23. + if (Conf_Server[i].SSLConnect &&
  24. + !(Conn_Options(Client_Conn(Client)) & CONN_SSL)) {
  25. + Log(LOG_ERR,
  26. + "Connection %d: Server \"%s\" requires a secure connection!",
  27. + Client_Conn(Client), Req->argv[0]);
  28. + Conn_Close(Client_Conn(Client), NULL,
  29. + "Secure connection required", true);
  30. + return DISCONNECTED;
  31. + }
  32. +#endif
  33. +
  34. /* Check server password */
  35. if (strcmp(Conn_Password(Client_Conn(Client)),
  36. Conf_Server[i].pwd_in) != 0) {