I've added straightforward systemd unit files in
system/socket-activation/ that make use of this approach, and a
README.md in the same location that describes the tradeoffs.
We want to be able to select the default for Socket differently in the
future.
This change augments the API for dkimpy_milter.util.own_socketfile()
by adding an optional sockname argument. This is a
backward-compatible change. If we aren't committed to API stability
for this function, we could make a more invasive change that would
probably be a more reasonable API going forward, but this is probably
good enough.
The main work here is about bytes vs. strings. This work was
confusing for several reasons:
* pymilter thinks that headers are all strings, but body is bytes
* dkimpy wants to deal with bytes objects generally (though it
accepts a string object as an ed25519 secret key for some reason,
despite requiring bytes as an RSA secret key)
* authres.AuthenticationResultsHeader object converts easily to a
string, but has no direct bytes conversion. meanwhile, it wants
its arguments as strings, but will accept them if they are bytes
and convert them with something like str(), which leaves weird
cruft like "header.a=b'ed25519-sha256'"
* dkimpy_milter/utils.py contains fold() which expects bytes
* self.fp needs to accumulate the on-the-wire version of the message
as a whole (so it needs to be bytes). That means converting the
headers. Header names and values are US-ASCII, per §2.2 of RFC
5322, so they should be convertible cleanly, but we still have to
convert them explicitly so that python knows the right thing to do.
At any rate, tests/runtests all passes with these changes, and the
output for both Authentication-Results: and DKIM-Signature headers
looks the same.
This covers conversion of the whole project to python3, *except* for
the strings/bytes distinction in __init__.py, which i'm leaving for a
second commit.
The changes in this commit are intended to be relatively
uncontroversial, so that the following commit contains the tricky
bits.
Without this patch, this simple script for miltertest:
----
conn = mt.connect("unix:milter.sock")
if conn == nil then
error "mt.connect() failed"
end
if mt.conninfo(conn, nil, "unspec") ~= nil then
error "mt.conninfo() failed"
end
if mt.getreply(conn) ~= SMFIR_CONTINUE then
error "mt.conninfo() unexpected reply"
end
mt.disconnect(conn)
----
Produces the following error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/Milter/__init__.py", line 702, in connect_callback
return m.connect(hostname,family,hostaddr)
File "/usr/lib/python2.7/dist-packages/Milter/__init__.py", line 173, in wrapper
rc = func(self,*args)
File "/home/dkg/src/dkimpy-milter/dkimpy-milter/dkimpy_milter/__init__.py", line 64, in connect
self.receiver = self.getsymval('j').strip()
AttributeError: 'NoneType' object has no attribute 'strip'
- Implemented support for SyslogFacility option
- Initial dataset support: csl
- Only sign if mail from from a domain in Domain and only if Mode is not
verfication only
- Fixed Canonicalize option