Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: [PATCH] mail/alpine: unable to send mail in default install
To:
Lloyd <ng2d68@proton.me>, Lucas Gabriel Vuotto <lucas@sexy.is>, <ports@openbsd.org>
Date:
Wed, 30 Apr 2025 11:05:16 +0100

Download raw body.

Thread
see kern_exec.c line 600

-- 
  Sent from a phone, apologies for poor formatting.

On 29 April 2025 21:00:26 Lloyd <ng2d68@proton.me> wrote:

> Sorry for the duplicate message but I have some more information to share:
>
> I instrumented some fake sendmail binaries/scripts to I can insert myself
> in between and execute a ktrace. Note that below the "/usr/sbin/send-mail"
> is just a symlink to smtpctl to trigger "sendmail compat mode" of smtpd.
>
> Unfortunately in both cases below this is the entire ktrace. I've already
> eliminated mailwrapper(8) as the source of any issues as it successfully
> calls smtpctl and that's where the hang is happening. Below two examples
> show a call to smtpctl with default Alpine args and a forced "-t" arg:
>
> 14906 ktrace   RET   ktrace 0
> 14906 ktrace   CALL  execve(0x6fd7f687e0ff,0x6fd7f687df88,0x6fd7f687dfb0)
> 14906 ktrace   NAMI  "/usr/sbin/send-mail"
> 14906 ktrace   ARGS
> [0] = "/usr/sbin/send-mail"
> [1] = "-bs"
> [2] = "-odb"
> [3] = "-oem"
>
> 18856 ktrace   RET   ktrace 0
> 18856 ktrace   CALL  execve(0x77fb458a4f7f,0x77fb458a4e18,0x77fb458a4e30)
> 18856 ktrace   NAMI  "/usr/sbin/send-mail"
> 18856 ktrace   ARGS
> [0] = "/usr/sbin/send-mail"
> [1] = "-t"
>
> Regards
> Lloyd
>
> On Tuesday, April 29th, 2025, Lucas Gabriel Vuotto wrote:
>
>> Hey Lloyd,
>>
>> On Tue, Apr 29, 2025 at 02:00:17AM +0000, Lloyd wrote:
>>
>>> There is a bug in Alpine whereby out of the box it is unable to send email on
>>> an OpenBSD box, even locally. By default, sending a message in unconfigured
>>> Alpine will fork out to sendmail(8) which hangs for some unknown reason and
>>> the sendmail wrapper process needs to be killed. Receiving mail works fine.
>>>
>>> Running /usr/sbin/sendmail -t < ~/dead.letter against the abandoned message
>>> works fine, so the interface between Alpine and the sendmail wrapper is
>>> broken.
>>>
>>> I ran a ktrace but couldn't find anything substantiative. Rather than debug
>>> this further, there is a much simpler patch to get Alpine working in the
>>> default install. The below change sets the value of smtp-server to localhost
>>> in the file which gets copied to /etc/pine.conf on installation. With this
>>> variable set, Alpine connects to the local smtpd over TCP rather than using
>>> the sendmail(8) utility, if the user has no smtp server defined.
>>>
>>> /etc/pine.conf is overridden by the user's ~/.pinerc so this should be a
>>> non-destructive change that will not impact anything but an unconfigured
>>> installation which falls back to using sendmail(8), which does not work.
>>>
>>> If it did work, then I believe --with-smtp-msa-flags=-t should be set in
>>> the Makefile as well since the hard-coded defaults pass bogus flags to
>>> sendmail(8). This didn't work either so it really doesn't matter, I believe
>>> the issue lies somewhere in the threading mechanism and how it forks out
>>> to sendmail. It's possible a prior security-related change broke something.
>>>
>>> This issue dates back to at least OpenBSD 6.8:
>>>
>>> https://marc.info/?l=openbsd-misc&m=161141614219034&w=2
>>
>>
>> I'm not an alpine user, but got curious about this issue. Would you mind
>> sharing the bits of `ktrace -di alpine` related to exec functions with
>> me? It's important you share only those bits, as ktrace output might
>> include data like passwords.
>>
>> For the record, I verified that adding --with-smtp-msa-flags=-t does
>> indeed set it in the code, so that should be working.
>>
>> Lucas