signing-milter enables you to s/mime sign an ordinary mail while passing a MTA. It is written in C and tested with the postfix MTA. It should work with any MTA implementing the milter protocol.
This repository replaces the daemontools service manager used in the original release by the Debian standard systemd service.
- buster
- bullseye
- bookworm
- trixie
- focal
- jammy
- noble
- resolute
wget -O- https://smeinecke.github.io/signing-milter/scripts/add-repository.sh | bash
apt-get install signing-milterFor releases still using the traditional one-line sources.list format (Debian buster/bullseye/bookworm, Ubuntu focal/jammy):
apt-get install wget lsb-release ca-certificates
wget -O /usr/share/keyrings/smeinecke.github.io-signing-milter.key https://smeinecke.github.io/signing-milter/public.key
echo "deb [signed-by=/usr/share/keyrings/smeinecke.github.io-signing-milter.key] https://smeinecke.github.io/signing-milter/repo $(lsb_release -sc) main" > /etc/apt/sources.list.d/signing-milter.list
apt-get update && apt-get install signing-milterFor releases using the new DEB822 .sources format (Debian trixie, Ubuntu noble/resolute):
apt-get install wget lsb-release ca-certificates
wget -O /usr/share/keyrings/smeinecke.github.io-signing-milter.key https://smeinecke.github.io/signing-milter/public.key
cat > /etc/apt/sources.list.d/signing-milter.sources <<EOF
Types: deb
URIs: https://smeinecke.github.io/signing-milter/repo
Suites: $(lsb_release -sc)
Components: main
Signed-By: /usr/share/keyrings/smeinecke.github.io-signing-milter.key
EOF
apt-get update && apt-get install signing-miltermkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
makeOptional dmalloc support:
cmake -DENABLE_DMALLOC=ON -DCMAKE_BUILD_TYPE=Release ..
makeTo build a Debian package:
dpkg-buildpackage -us -uc -bIf signing-milter is built with WITH_REDIS=ON (the default), it can fetch
S/MIME certificates and private keys from a Redis server instead of, or in
addition to, the local CDB signingtable.
The Redis key for an address is built from the configured prefix and the
lowercased address (e.g. signing-milter:sender@example.com). The hash must
contain the following fields:
pem(required): a PEM blob containing both the signer certificate and the corresponding private key.chain(optional): a PEM blob with the intermediate/root certificate chain.
Example Redis HMSET:
redis-cli HMSET signing-milter:sender@example.com \
pem "$(cat /path/to/sender-cert+key.pem)" \
chain "$(cat /path/to/sender-chain.pem)"To enable the Redis backend, add -r, optionally -P and -W, to
/etc/default/signing-milter:
OPTIONS="-s unix:/var/spool/postfix/signing-milter/signing-milter.sock -c postfix -r redis://127.0.0.1:6379/0 -P signing-milter: -W /etc/signing-milter/passphrase"The passphrase file is used for encrypted private keys loaded from Redis. When
Redis is enabled, the milter queries Redis first; on a miss it falls back to the
local CDB signingtable.
By default CMake searches for libhiredis and enables Redis support:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j"$(nproc)"To build without Redis support (no libhiredis dependency):
cmake -B build -DCMAKE_BUILD_TYPE=Release -DWITH_REDIS=OFF
cmake --build build -j"$(nproc)"The full test suite including the Redis end-to-end test can be run with Docker Compose:
docker compose -f tests/docker-compose.yml up --build --abort-on-container-exitIn default configuration the postfix daemon is chrooted to the spool folder located in /var/spool/postfix/. To use the socket feature of signing-milter the socket + permissions has to be configured in the /etc/default/signing-milter file:
#DISABLE_HOURLY_STATISTICS_LOGGING='yes'
#DISABLE_DAILY_STATISTICS_LOGGING='yes'
OPTIONS="-s unix:/var/spool/postfix/signing-milter/signing-milter.sock -c postfix"Also create the folder within the postfix spool folder with the correct permissions:
mkdir -m o-rwx /var/spool/postfix/signing-milter
chown signing-milter:postfix /var/spool/postfix/signing-milterThe socket has to be configured in postfix in main.cf as new milter:
smtpd_milters = unix:signing-milter/signing-milter.sockAnd reload/restart the services:
systemctl restart signing-milter
systemctl reload postfixAll certificates are configured in the /etc/signing-milter/signingtable file.
Just add the email address + path of the pem file and use
cd /etc/signing-milter && maketo update the cdb database and trigger reloading signing-milter.
The certificates have to be readable by the signing-milter user.
Since version 20120731 signing-milter also supports intermediate certificates.
Just name your certificate with the suffix -cert+key.pem and put the intermediate + root certificate in a file suffixed by -chain.pem in the same folder.
The project is based on signing-milter.org by Andreas Schulze.
Thanks to Rouven Spreckels for the statistics logging fix in PR #9.