Skip to content
Snippets Groups Projects
  1. Dec 15, 2023
    • Rob Swindell's avatar
      Log notice-level message for > 1 consecutive unique login attempts · 7eeaeb0b
      Rob Swindell authored
      The log format and details might need some adjustment, but this is a start.
      
      Also, don't delay 3 seconds before disconnecting socket when mail server has
      reached maximum number of clients - we should immediately release resources
      (the socket) and be able to accept another connection ASAP instead.
      
      Deal with new CID 470557 and 470554 in mail server: resource (file*)
      leaks in error paths (corner case).
      
      Set minimum severity of TLS messages in web sever to INFO. Debug-level would
      hide some common TLS session errors.
      7eeaeb0b
  2. Dec 14, 2023
    • Rob Swindell's avatar
      SMTP mail server wasn't RFC 4954 compliant for "AUTH PLAIN" logins · f45cfd52
      Rob Swindell authored
      The base64-encoded credentials can either be supplied with the AUTH PLAIN
      command or in response to a 334 server-challenge. We only supported the
      former form and logged a warning ("Missing AUTH PLAIN argument") when we
      received the latter. No warning is logged now and the appropriate
      server-challege is sent and the response accepted and base64-decoded and
      parsed as before.
      f45cfd52
    • Rob Swindell's avatar
      Fix extra decrement of active_clients (added in previous commit) · 7a8b8d4e
      Rob Swindell authored
      And fix some use of CRYPT_UNUSED instead of cryptlib session ID.
      7a8b8d4e
    • Rob Swindell's avatar
      Better resource (e.g. client thread) management · 733c39b7
      Rob Swindell authored
      My mail server was suddenly and inexplicably creating thousands of SMTPS
      client threads, each with a unique remote IP address, and each eventually
      failing with the rather obscure log message (from cryptlib):
       dbg 'Cannot read item from object' (-41) setting session active
      
      Eventually (after not long, really), the server would run out of resources
      and fail in weird and wonderful ways (can't malloc, can't create JS runtime
      or context, etc.). The max_clients limit (100, as I have it set) wasn't being
      effectively-imposed on SMTPS connections.
      
      The root-cause: the active_clients (counter) wasn't incremented until *after*
      the cryptlib/TLS setup for SMTPS connections and SMTPS/TLS connections can
      take a long time to fail, resulting in a vulnerability to an effective denial
      of service attack.
      
      Raise the minimum severity of all cryptlib/TLS log messages from Debug to
      Info.
      
      Create wrappers for smtp_thread() [now smtp_client_thread()] and pop3_thread
      [now pop3_client_thread()] that handle basic resource management (thread
      counters, active client counters, the client socket).
      733c39b7
  3. Dec 03, 2023
  4. Nov 26, 2023
  5. Nov 01, 2023
  6. Jun 09, 2023
    • Rob Swindell's avatar
      <Deuce> ... billion-and-one result of comparison of constant 100000 warnings. · 2b087b8b
      Rob Swindell authored
      So Clang-FreeBSD was warning (in compiles of scfg/scfg*.c by Deuce):
      result of comparison of constant 100000 with expression of type 'uint16_t'
      (aka 'unsigned short') is always true
      
      Why? Cause a uint16_t's max value is 65535 (less than 100000). Sure we could
      have just lowered the UIFC max number of config items to 65535, but that would
      have been too easy. And why are these compared-with values of type uint16_t to
      begin with? Because most ctrl/*.cnf lists (of configuration items) were
      limited to 65535 entries cause ... 16-bit DOS, historically. Now that *.cnf
      files aren't used, we could just increase these scfg_t.*_total type sizes from
      16 to 32-bits, yeah? The result is this commit.
      
      I went to (signed) int so we could still keep -1 as the special illegal
      sub/dir num value (e.g. INVALID_SUB, which is sometimes used to indicate the
      email message base). Theoretically, 2 billion configuration items could be
      supported in these lists, but SCFG will limit you to 100000 anyway. So there's
      a whole lot of s/uint/int in this commit.
      
      I'd be very surprised if this doesn't result in some new GCC/Clang warnings,
      but at least the old "comparison of constant 100000" warnings are now gone!
      2b087b8b
  7. Jun 04, 2023
  8. May 30, 2023
    • Rob Swindell's avatar
      Add option (for deon) to notify offline users of new received email (SMTP) msgs · 543620f3
      Rob Swindell authored
      The notification of offline users was removed from the mail server 13 years
      ago (commit 729eb16b) without a lot of fanfare or explanation. Add an
      option for notification of offline users (in addition to online users) for
      those sysops that want that behavior.
      
      Use the userdat is_user_online() function in place of the getnodedat() loop,
      which also wasn't considering nodes in "logon" status as having a user online.
      543620f3
  9. Apr 04, 2023
  10. Apr 02, 2023
    • Rob Swindell's avatar
      Move the special FTN/QWKnet address formatting to a userdat-exported function · e59fbe68
      Rob Swindell authored
      smtp_netmail_addr() - not currently used anywhere else, but may be someday.
      load/mailutil.js's fidoaddr_to_emailaddr() has this same logic (for FTN addrs
      at least and is now used by nntpservice.js).
      
      Also, always pass a buffer to smb_faddrtoa() from the mail server since it's
      multi-threaded and its unsafe to pass NULL (using a static local buffer).
      e59fbe68
  11. Mar 02, 2023
    • Rob Swindell's avatar
      Fix false FORGED mail header 'FROM' field detection/rejection · 7727cc8b
      Rob Swindell authored
      Pretty much any From field that contains an '@' in the username portion
      was subject to comparison to the full email address, but clearly some of
      these rejected emails were not forge attempts:
      
      'Chris @ StubHub' vs 'events@mail.stubhub.com'
      'Eric S. Raymond (@esr)' vs 'gitlab@mg.gitlab.com'
      
      Fixed by requiring that the sender name is actually a well-formed Internet
      email address using smb_netaddr_type(), which was also recently improved to
      be more accurate.
      
      Unrelated change: include reverse-path (email address for bounces) in
      ILLEGALLY-LONG body and header line log messages (usually SPAM from what
      I can tell).
      7727cc8b
  12. Feb 28, 2023
  13. Feb 22, 2023
    • Rob Swindell's avatar
      Fix corrupted RFC822 msg headers when a header field was > 1024 chars · b77a0ba6
      Rob Swindell authored
      When sending an SMB message header via SMTP or POP3, some header fields (lines) could potentially be longer than 1024 and yet sockprintf() was limited to sending 1024 bytes (actually 1022 plus CRLF). This could result in some messages not being sent correctly: header field truncated, not CRLR-terminated, and notably resulting in MIME message contents not being decoded properly in a message viewer/reader. Example (Content-Type is part of the previous header field/line):
      x-ms-exchange-antispam-messagedata-0:
       =?us-ascii?Q?cm9T1Q9G65VC/lKTTqhODKhy5lHT2y6WWMb/WyvJ+EeGEwYmY7ILhzE3yfNM?=
       =?us-ascii?Q?KeFWN9T/PqHBya1plKf/sHgaw0iRmI7Hq+u9Dp4bG8OqdniKQlK+Aa27oXMd?=
       =?us-ascii?Q?Hly6OEYaSu7jbhGGY89LF0gyRVqquqxkaMfpKvG+h4cQnnu4Tl8YAKeE39a2?=
       =?us-ascii?Q?lHW3372ulmb9jvvZU72J2RtZYkuoIr+Wsqhfyuj39wTZ/+C4qKCsYrmTxrki?=
       =?us-ascii?Q?fBZ4gMPzWkrcWAr7zPcXBg8bphJJB8VJFUjQyksA3EG4dtH8+TZeEcNNBmHf?=
       =?us-ascii?Q?oCGnV9wHr9HszzrSkkZ2GGyh3QZLHAVDNe7wDXSy7HJttZugf9kNqKGeaYQL?=
       =?us-ascii?Q?TpljH1aHPe7MiSP9Dmp/xHQ/DWQOZDx5guNS+iMciMt5p5ad+SkQye0hWRhd?=
       =?us-ascii?Q?usHvpllclzIee6lxJ0VSPAzHGlAOhtOolrHdDB2ODjvkEzU7L2Fj2f5x7p9q?=
       =?us-ascii?Q?9d6sUgSz7vZVx8yyR3KPq3jIX0QUnl0xr2Mix9xcmMNcg0yFLPcznqBdLVa8?=
       =?us-ascii?Q?IC7j0+8oy4BjYxr8Z3elxMC2JKq13gPYgR95cwm6hMDiZbMB4EW/J1uJhD/I?=
       =?us-ascii?Q?RIIqTZ+Ywt8nKOfXj6/a9Aauf0wN71QKKA+in7KY9oksIhkUGvWOrtJwkVDL?=
       =?us-ascii?Q?Q2UFrBBJyQHJgumj5Y+bG8FDk/55IfyV9XYEcsdLL4bCF+HX4QPHZCw4P+li?=
       =?us-ascii?Q?bRvN+UxOO8hgXVkgB1q8mNJ62yQuaj0AContent-Type: multipart/alternative;
      	boundary="_000_SN6PR07MB454477F4C32C66D48BA0B02187A09SN6PR07MB4544namp_"
      
      Solved by using asprintf() instead of snprintf() for dynamic string formatting and allocation in one go. Using realloc() to expand the buffer for the appended/required CRLF.
      b77a0ba6
  14. Feb 19, 2023
  15. Feb 16, 2023
  16. Jan 30, 2023
    • Rob Swindell's avatar
      The 3rd great MQTT data scheme update (sorry Nelgin) · e94281e6
      Rob Swindell authored
      - Most published messages (besides log entries) have a timestamp (in ISO8601 format) prepended and tab-separated
      - The order and number of elements in client messages (list and activities) has been updated, now includes user number
      - Server client lists are now published to .../SERVER/client/list
      - Server client activities (connect, disconnect, update) are now published to .../SERVER/client/action/#
      - Server client count is now published to .../SERVER/client (with the maximum client count, if applicable)
      - Server states are now just represented by name (e.g. initializing, ready, stopping, stopped) and not number
      - BBS errors are logged to sbbs/BBS/action/error/LEVEL (where LEVEL is the log level name, e.g. "critical" or "error')
      - All server hack-attempts, SPAM attempts, logins, logouts, uploads, downloads, are published to sbbs/BBS/action/ACTION/*
      - Chat pages are published to sbbs/BBS/action/page/node/#
      - New users (on the terminal server) are published to sbbs/BBS/action/newuser
      - Posted messages and executed external programs (on the terminal server) are published to sbbs/BBS/action/ACTION/CODE topic
      - The event thread started/stopped status is published to .../SERVER/event
      
      Yeah, the wiki will get updated soon to reflect/document all these changes
      e94281e6
  17. Jan 24, 2023
  18. Jan 09, 2023
  19. Jan 04, 2023
    • Rob Swindell's avatar
      Public hack, spam, and error logs at the MQTT BBS-ID topic depth · 7ce24b48
      Rob Swindell authored
      This is more consistent with how these events are logged in a BBS-common log file in data/*.log.
      
      This change also restores the server abbreviation to the error log entries that used to be there until recently.
      7ce24b48
    • Rob Swindell's avatar
      Over-overhaul of MQTT support · 916fdacb
      Rob Swindell authored
      Each Synchronet server is now its own MQTT client. This means there's no
      longer any MQTT logic in the Synchronet "hosts" (e.g. sbbscon.c, ctrl/*.cpp)
      and none needed for SBBS NT services (they'll "just work" with MQTT).
      
      This also means that just about everything (except for nodes, spam and hack)
      is now published per-server (in the sbbs/BBS-ID/hostname/server/ topic branch)
      and if you want aggregated totals or client lists, you'll have to do that in
      your own MQTT client or dashboard.
      
      I also removed the publishing of thread_count and socket_count topics as
      they weren't universally supported across all servers and are of questionable
      value. They can be added back later if determined to be useful.
      916fdacb
  20. Jan 02, 2023
    • Rob Swindell's avatar
      Second part of MQTT overhaul · d1c07811
      Rob Swindell authored
      Now support subscriptions (e.g. recycle topics, node input topics) in SBBSCTRL.
      This required a lot of search/replace and fun with circular struct pointers.
      d1c07811
    • Rob Swindell's avatar
      MQTT support overhaul, mainly for SBBSCTRL compatibility · eb5fdedb
      Rob Swindell authored
      The only difference in the data/scheme is that the "error" topic (error log) is now under each server rather than each host. I don't *think* there are any other changes from the MQTT consumer side.
      
      Still not done: subscribing (e.g. support for recycle or node-spy-input via MQTT) and NT services support.
      
      This change also includes a cool feature that will prompt the sysop if there's a timeout (30 seconds) while waiting for servers to shutdown gracefully and giving the sysop the option to abort (Cancel) the wait (and shutdown ungracefully) or continue the wait (OK).
      eb5fdedb
  21. Dec 30, 2022
    • Rob Swindell's avatar
      Common login control (e.g. via real name) using new find_login_id() function · 7679dcf8
      Rob Swindell authored
      Previously, many servers and services didn't support login by real name
      (e.g. issue #469) even if the sysop had that option enabled in SCFG.
      
      Move login control settings from node.ini to system (main.ini -> login)
      
      The 3 node toggle options:
      - Allow Login by User Number
      - Allow Login by Real Name
      - Always Prompt for Password
      
      ... have been now moved from SCFG->Nodes->Node x->Toggle Options to
      SCFG-System->Toggle Options.
      
      If you upgraded to v3.20a before now, you'll want to double-check these
      settings to make sure they're how you want them set. New upgraders that run
      upgrade_to_v320.js (e.g. via 'jsexec update') will get these settings migrated
      automatically.
      
      Added some error detection/logging to upgrade_to_v320.js when failing to open
      .cnf files.
      
      Constified some more user/login related function args and return types.
      7679dcf8
  22. Dec 29, 2022
  23. Dec 23, 2022
  24. Dec 12, 2022
  25. Dec 05, 2022
    • Rob Swindell's avatar
      Add support for systemd system state notifications · 7e320d92
      Rob Swindell authored
      When the systemd dev package (e.g. libsystemd-dev) is installed, we can use
      sd_notify() to inform systemd of Synchronet server state/status. The state
      values (READY, STOPPING, RELOADING) are "well known" while the status
      value is a free-form text string (the last lputs output).
      
      Eliminated the free-form status() callback from *startup_t.
      Eliminated the now-redundant started() callback from *startup_t.
      
      Eliminated the use of sbbs_status.c/h as nothing is using that interface
      and while I do plan on using a remote control/monitor interface, I'm
      considering use of a standard pub/sub lib and protocol.
      
      This commit is going to break the Windows sbbsctrl build for sure.
      Probably break the sbbsNTsvcs build.
      7e320d92
  26. Nov 12, 2022
    • Rob Swindell's avatar
      Change iniOpenFile() argument meaning from "create" and "for_modify" · f4d2e708
      Rob Swindell authored
      Now, if the BOOL argument value is FALSE, then the .ini file is opened read-only (and thus only read permissions are needed, resolving issue #455).
      
      If the BOOL argument value is TRUE, create-if-not-exist is implied. There are no use cases where we would want to open an .ini file for writing only if it already existed.
      f4d2e708
  27. Oct 18, 2022
    • Rob Swindell's avatar
      Full read/write support of new user.tab userbase file · 8a22b246
      Rob Swindell authored
      Also resolved some 32 vs 64-bit 'long' issues/ambiguities that have long-remained. :-)
      
      This commit also removes logon.lst file support.
      
      There's a TODO block remaining in js_user.c for setting portions of a user's birthdate (e.g. just the year or month or day).
      8a22b246
  28. Mar 08, 2022
  29. Mar 02, 2022
Loading