Open dereks opened 4 years ago
It's not a path issue. I edited /usr/bin/opendkim-genkey directly to troubleshoot this.
I can see that it is running this command:
openssl genrsa -out default.private 2048 > /dev/null 2>&1
The > /dev/null 2>&1
silences all output, which is extremely unhelpful. I'd remove that "feature".
When I change that to print out stuff:
openssl genrsa -out default.private 2048
Then I get the real error:
genrsa: Can't open "default.private" for writing, Is a directory
opendkim-genkey: openssl exited with status %d
So it was just PEBKAC. I was following this excellent tutorial
https://www.linuxbabe.com/mail-server/setting-up-dkim-and-spf
I accidentally ran
sudo mkdir -p /etc/opendkim/keys/$MY_EMAIL_DOMAIN_NAME/default.private
which is incorrect.
This is now a bugfix request to apply this patch:
--- opendkim-genkey-dist 2018-02-05 23:24:29.000000000 +0000
+++ opendkim-genkey 2020-08-19 18:01:06.110425566 +0000
@@ -138,7 +138,7 @@
print STDERR "$progname: WARNING: RFC6376 advises minimum 1024-bit keys\n";
}
-$status = system("openssl genrsa -out " . $selector . ".private " . $bits . " > /dev/null 2>&1");
+$status = system("openssl genrsa -out " . $selector . ".private " . $bits);
if ($status != 0)
{
if ($? & 127
That way people can see the error the openssl is reporting to them.
I think the best thing to do with this issue is submit a PR against the "develop" branch. We'll test it and merge it into the "next" branch for release with the beta.
I get this error:
I do have openssl installed at the normal location:
As you see above I am running this as root.
Google shows that this is an old error dating back to 2013. These pages recommend checking your "path":
https://helperbyte.com/questions/250376/howtogeneratedkim https://superuser.com/questions/1470054/opendkim-not-working-opendkim-genkey-openssl-exited-with-status-d https://ask.puppet.com/question/1596/opendkim-genkey-openssl-exited-with-status-d/
But I don't know what file I'm supposed to look in for this "path" variable. It seems to be a Python array with brackets, not a shell environment PATH.
This seems like a bug in the package. This is on a clean install of Ubuntu, with everything installed using apt-get, so the openssl path should be well known.