From 337ae071d2f86968b4fb3a5ee70090bb778d5a64 Mon Sep 17 00:00:00 2001 From: Andreas Perhab Date: Fri, 11 Jul 2025 00:14:39 +0200 Subject: [PATCH] open-dkim: use numerical uid and gid for chown (#4517) Co-authored-by: Casper --- CHANGELOG.md | 3 ++- target/bin/open-dkim | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a2e4699..c17b0d15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ All notable changes to this project will be documented in this file. The format - [`DMS_CONFIG_POLL`](https://docker-mailserver.github.io/docker-mailserver/v15.0/config/environment/#dms_config_poll) supports adjusting the polling rate (seconds) for the change detection service `check-for-changes.sh` ([#4450](https://github.com/docker-mailserver/docker-mailserver/pull/4450)) ### Fixes - +- **DKIM** + - `setup config dkim domain subdomain.example.com` no longer throws an error if the owner of config/opendkim/keys does not exist in the container ([#4517](https://github.com/docker-mailserver/docker-mailserver/pull/4517)) - **Internal:** - The DMS _Config Volume_ (`/tmp/docker-mailserver`) will now ensure it's file tree is accessible for services when the volume was created with missing executable bit ([#4487](https://github.com/docker-mailserver/docker-mailserver/pull/4487)) - Removed the build-time hostname workaround for Postfix as Debian has since patched their post-install script ([#4493](https://github.com/docker-mailserver/docker-mailserver/pull/4493)) diff --git a/target/bin/open-dkim b/target/bin/open-dkim index 60927635..1a1b43ac 100755 --- a/target/bin/open-dkim +++ b/target/bin/open-dkim @@ -152,8 +152,9 @@ function _generate_dkim_keys() { # Ensure ownership is consistent for all content belonging to the base directory, # During container startup, an internal copy will be made via `_setup_opendkim()` - # with ownership we expect, while this chown is for the benefit of the users ownership. - chown -R "$(stat -c '%U:%G' "${OPENDKIM_BASE_DIR}")" "${OPENDKIM_BASE_DIR}" + # with ownership we expect, while this chown is for the benefit of the users' ownership. + # use numerical uid and gid in case the owner of the directory does not exist inside container + chown -R "$(stat -c '%u:%g' "${OPENDKIM_BASE_DIR}")" "${OPENDKIM_BASE_DIR}" } # Prepare a file with one domain per line (iterated via while loop as DKIM_DOMAIN):