On Tue, 20 Jun 2023 at 21:12, Brian Reichert <
reic...@numachi.com> wrote:
>
> I have probably shot myself in the foot by rushing, but I hope
> someone can help shovel me out of this one.
>
> I'm (finally) trying to stand up a new server based on indimail,
> and am at the stage of configuring DKIM.
>
> The error I'm currently getting occurs after I tried to configure
> qmail-inject to sign messages.
>
> I'm following multiple sets of notes:
>
>
http://indimail.blogspot.com/2009/04/how-to-set-dkim-signature-in-indimail.html
These instructions are decades old. Always use this document
https://github.com/mbhangui/indimail-mta/wiki/0-IndiMail-Wiki
>
>
>
https://notes.sagredo.eu/en/qmail-notes-185/configuring-dkim-for-qmail-92.html
>
The above is what I recommend because those notes have lot of
practical experience behind them.
>
> Based on the latter, with modified pathnames, I was able to
>
> sign email with dk-filter
> sign email with qmail-dkim
>
> I tried to set up signing with qmail-inject, as per the former.
>
> When I try to submit a message, however, I get this error:
>
> root@toride:~# ( echo From:
ro...@toride.numachi.com; \
> > echo To:
reic...@numachi.com; \
> > echo Date: $(date +"%a, %d %b %Y %H:%M:%S %z") \
> > echo Subject: qmail-inject Test Message ) | /usr/bin/qmail-inject
> qmail-inject: fatal: qmail-dkim: DKIMContext structure invalid for this
> operation (#4.3.0)
>
> Does anyone have some insight on what I've done wrong?
>
The error is in the line which prints the date. It is missing a
semi-colon because of which the date gets printed without a newline.
DKIM signing requires a valid rfc822 formatted message with the Date
header in the message. Else it gives DKIMContext Invalid error. Date
is mandatory for DKIM signing because DKIM has the feature where you
can set an expiry date for the generated signature.
echo Date: $(date +"%a, %d %b %Y %H:%M:%S %z") \
Just change the above line to
echo Date: $(date +"%a, %d %b %Y %H:%M:%S %z"); \
Or a script tike this would inject a valid rfc822 formatted email
(
echo From:
ro...@argos.indimail.org
echo To:
mbha...@argos.indimail.org
echo Date: $(date -R)
echo Subject: qmail-inject Test Message
echo
echo Test message
) | /usr/bin/qmail-inject
You can replace qmail-inject with qmail-inject -n to see the mail on
stdout. If you are going to use scripts on the command line to send
out emails, you can set environment variables in $HOME/.defaultqueue
to set DKIMSIGN env variables. See pont 2 and 3 in the chapter
https://github.com/mbhangui/indimail-mta/wiki/0-IndiMail-Wiki#setting-environment-variables
e.g
mkdir $HOME/.defaultqueue
echo "/etc/indimail/control/domainkeys/
numachi.com/private" >
$HOME/.defaultqueue/DKIMSIGN
echo "/usr/sbin/qmail-dkim" > $HOME/.defaultqueue/QMAILQUEUE
If you are the only user on the system, you can set DKIMSIGN,
QMAILQUEUE, etc in /etc/indimail/control/defaultqueue to set the
environment variables globally.
Let me know if you are able to solve your issue. I'm also available
online at #indimail on libera
https://matrix.to/#/#indimail-libera:matrix.org
--
Regards Manvendra -
http://www.indimail.org
GPG Pub Key
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC7CBC760014D250C