Skip to content

Commit

Permalink
net_smtp: Clarify Bcc and sendmail semantics.
Browse files Browse the repository at this point in the history
* Log warning if Bcc headers are present in DATA.
* Add sendmail client instructions to README.
  • Loading branch information
InterLinked1 committed Feb 17, 2024
1 parent 3a69615 commit 8977d20
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,35 @@ What format does the BBS use to store email?
The BBS mail servers use the maildir++ format. This is similar to what software like Dovecot and Courier use by default,
although certain implementation details may differ.

Does the BBS provide a sendmail binary, for submitting local mail?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

No, it does not. Consequently, you may see messages like this in your cron logs, for example:

:code:`(CRON) info (No MTA installed, discarding output)`

This is because cron did not detect :code:`/usr/bin/sendmail`, which is used by default to submit outgoing mail from outside of the local MTA.

Installing the actual :code:`sendmail` is overkill and not recommended, since it also includes the Sendmail MTA, which will conflict with LBBS.
However, you can install a lightweight client like :code:`ssmtp` or :code:`msmtp` (a more actively maintained variant) to do this.
You just need to ensure you install an SMTP client consistent with the Sendmail interface, so that programs expecting sendmail
will work properly.

If you install msmtp, be sure to `configure it system-wide <https://marlam.de/msmtp/msmtp.html#A-system-wide-configuration-file>`_.

The below is a good default :code:`/etc/msmtprc` for most systems::

account default
host 127.0.0.1
port 25
from [email protected]
tls off
logfile /var/log/msmtp.log

Make sure to substitute the default "from" address with something appropriate for your server.

Then, you can symlink msmtp to sendmail, and things should "just work": :code:`ln -s /usr/bin/msmtp /usr/sbin/sendmail`.

Does the BBS provide any kind of webmail access?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can use `wssmail <https://github.com/InterLinked1/wssmail>`_, a fast and efficient webmail client designed with the BBS's mail server in mind (but may be used with any mail server).
Expand Down
21 changes: 21 additions & 0 deletions nets/net_smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2673,6 +2673,27 @@ static int handle_data(struct smtp_session *smtp, char *s, struct readline_data
}
} else if (!smtp->tflags.dkimsig && STARTS_WITH(s, "DKIM-Signature")) {
smtp->tflags.dkimsig = 1;
} else if (STARTS_WITH(s, "Bcc:")) {
/* This is unexpected, and probably not good news for whatever
* is sending this message.
*
* According to RFC 2822 3.6.3, the sending agent is responsible
* for removing the Bcc: line and just providing it using RCPT.
* So, MTAs should not need to be concerned with Bcc at all,
* since it won't (or shouldn't) appear in the DATA, i.e.
* there should never be "Bcc" headers in messages.
*
* mail.c does handle this in bbs_mail_message, but that's because
* this API is used by things that generate messages and include
* the recipients in the message. It's not unlike the sendmail
* client program which also removes Bcc lines but includes them
* in the RCPT: they need to be processed *somewhere*, but that's
* before it hits core MTA logic, and mail.c is here acting as
* the submitter / user agent.
*
* So, if we see this, then somebody's mail user agent is probably
* not RFC-compliant and is leaking BCC's... probably not desired. */
bbs_warning("Message contains a 'Bcc' header? (%s)\n", s);
} else if (!len) {
indataheaders = 0; /* CR LF on its own indicates end of headers */
}
Expand Down

0 comments on commit 8977d20

Please sign in to comment.