Skip to content

dkim: enforce 0600 on private keys at every start - #13

Merged
MarvAmBass merged 1 commit into
masterfrom
dkim-key-permissions
Sep 28, 2026
Merged

MarvAmBass merged 1 commit into
masterfrom
dkim-key-permissions

Conversation

@MarvAmBass

Copy link
Copy Markdown
Member

opendkim refuses a key that group/others can read (key data is not secure) and then tempfails every message of that domain (4.7.1 Service unavailable). The keys live on the /etc/postfix/additional volume, so their mode is whatever the host left — two production gateways had 0644 keys, which delayed all outgoing mail of those domains until the sender retried via the other MX.

The entrypoint now sets every opendkim default.private to 0600 on each start — after the one-time init, so freshly generated keys are covered, and also on a plain docker restart (dkim-helper.sh only runs at first init).

Tested

  • ./test.sh passes
  • key planted with mode 644 on the volume → 0600 after first start, logged (>> DKIM - enforce key permissions + file name)
  • chmod back to 644 inside the container + docker restart → 0600 again

🤖 Generated with Claude Code

opendkim refuses a key that group/others can read ("key data is not
secure") and tempfails every message of that domain with 4.7.1. The keys
live on the /etc/postfix/additional volume, so their mode is whatever the
host left — found 0644 keys on two production gateways, which delayed all
outgoing mail of those domains until the sender retried via the other MX.

The entrypoint now chmods every opendkim default.private to 0600 on each
start (after init, so freshly generated keys are covered as well).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MarvAmBass
MarvAmBass merged commit 7c44a03 into master Sep 28, 2026
2 checks passed
@MarvAmBass
MarvAmBass deleted the dkim-key-permissions branch September 28, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant