[GH-ISSUE #1687] OpenDKIM no such file or directory; no permission #1329

Closed
opened 2026-02-27 11:16:32 +03:00 by kerem · 2 comments
Owner

Originally created by @danielsatanik on GitHub (Feb 28, 2019).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1687

Impacted versions

  • Modoboa: 1.13.0
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

Enable DKIM Signing

Current behavior

after just enabling

can't load key from /var/lib/dkim/domain.tld.pem: No such file or directory
94B51C0819: error loading key '1'

when I create a pem file with openssl genrsa etc. the following errors are shown

KeyTable entry for '1' corrupt
can't load key from /var/lib/dkim/domain.tld.pem: Permission denied

also this is what is written inside the public key in postgres

140332928537024:error:0200100D:system library:fopen:Permission denied:../crypto/bio/bss_file.c:74:fopen('/var/lib/dkim/domain.tld.pem','r')140332928537024:error:2006D002:BIO routines:BIO_new_file:system lib:../crypto/bio/bss_file.c:83:unable to load Private Key

Expected behavior

creating a valid private and public key and signing mails

Video/Screenshot link (optional)

Originally created by @danielsatanik on GitHub (Feb 28, 2019). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1687 # Impacted versions * Modoboa: 1.13.0 * installer used: Yes * Webserver: Nginx # Steps to reproduce Enable DKIM Signing # Current behavior after just enabling ``` can't load key from /var/lib/dkim/domain.tld.pem: No such file or directory 94B51C0819: error loading key '1' ``` when I create a pem file with openssl genrsa etc. the following errors are shown ``` KeyTable entry for '1' corrupt can't load key from /var/lib/dkim/domain.tld.pem: Permission denied ``` also this is what is written inside the public key in postgres ``` 140332928537024:error:0200100D:system library:fopen:Permission denied:../crypto/bio/bss_file.c:74:fopen('/var/lib/dkim/domain.tld.pem','r')140332928537024:error:2006D002:BIO routines:BIO_new_file:system lib:../crypto/bio/bss_file.c:83:unable to load Private Key ``` # Expected behavior creating a valid private and public key and signing mails # Video/Screenshot link (optional)
kerem 2026-02-27 11:16:32 +03:00
Author
Owner

@tonioo commented on GitHub (Mar 1, 2019):

@danielsatanik Can you check permissions of the /var/lib/dkim folder? Which user runs the cron job in charge of generating DKIM keys? What is you OS?

<!-- gh-comment-id:468631666 --> @tonioo commented on GitHub (Mar 1, 2019): @danielsatanik Can you check permissions of the /var/lib/dkim folder? Which user runs the cron job in charge of generating DKIM keys? What is you OS?
Author
Owner

@danielsatanik commented on GitHub (Mar 2, 2019):

@tonioo the folder is owned by root:root, that was also suggested, the OS I'm running this on is Ubuntu 18.04LTS, the opendkim user runs the cronjob.

Do you need more detailed information?

Edit:
It seems the /var/lib/dkim folder itself needed the opendkim user to have the permission to write the key file. Thus I fixed it by giving the opendkim group the rights now with chmod g+w /var/lib/dkim

<!-- gh-comment-id:468952149 --> @danielsatanik commented on GitHub (Mar 2, 2019): @tonioo the folder is owned by root:root, that was also suggested, the OS I'm running this on is Ubuntu 18.04LTS, the opendkim user runs the cronjob. Do you need more detailed information? **Edit:** It seems the /var/lib/dkim folder itself needed the opendkim user to have the permission to write the key file. Thus I fixed it by giving the opendkim group the rights now with `chmod g+w /var/lib/dkim`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1329
No description provided.