I was able to get this working awhile ago on Server 5.3.1. Using your terminal command, I get:
TESTING#1 example.com: default._domainkey.example.com => pass
Here's what I have to set it up in amavisd.conf:
dkim_key('example.com', 'default', '/var/db/dkim/example.com.default.pem');
The following allows me to use the single key to work for all of the virtual sites hosted on the server:
@dkim_signature_options_bysender_maps = ({
'.' => {d => 'example.com',a => 'rsa-sha256',c => 'relaxed/simple',ttl => 30*24*3600 },} );
I just checked my notes and realized that there was another piece to the puzzle to get this working.
Not sure which version of Server you are using, but there is a bug in Amavisd in certain versions of Server 5 that requires you to make a change. The details are here:
https://discussions.apple.com/thread/7684786
Note that the directions tell you to insert the patch beneath the line :
Amavis::load_policy_bank($_,$msginfo) for @bank_names_cl;
There are two instances of that line, at least in Server V 5.3.1. You'll want to work with the second instance further down, which actually has the blank line underneath. Be aware that any future updates to the Server app may overwrite this patch.
Depending on your setup, you also may wish to move the originating port from the default 10024 to 10026 in amavisd.conf.