Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

denisix
Copy link
Contributor

@denisix denisix commented Dec 16, 2023

using DKIM signing in Rspamd - automatically match keys for domains in dkim_signing.conf

Description

in dkim_signing.conf added configuration lines to automatically match domain keys instead of manually adding config for each domain that configured in DMS

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added information about changes made in this PR to CHANGELOG.md

using DKIM signing in Rspamd - automatically match keys for domains in dkim_signing.conf
Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement thanks!

Comment on lines 159 to 160
selector = "mail";
path = "/tmp/docker-mailserver/opendkim/keys/$domain/$selector.private"; # this will automatically match keys for domains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please cite the source for this feature? (EDIT: Not necessary, cited below)

I see on the rspamd dkim docs that selector is used as the default with the $selector variable, but $domain is only mentioned in a comment, is that also a fixed fallback value or is it documented somewhere as dynamic?

EDIT: After reading the first section and going over the config example / defaults, I see that $domain is from use_domain setting, which defaults to dynamically sourced from header but could be configured as a fixed domain. While selector defaults to dkim.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This context with source citing is now also part of the related TODO issue: #3778

docs/content/config/best-practices/dkim_dmarc_spf.md Outdated Show resolved Hide resolved
selector = "mail";
path = "/tmp/docker-mailserver/opendkim/keys/$domain/$selector.private"; # this will automatically match keys for domains

# domain specific configurations can be provided below:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively there is a simple selector_map setting that references a file of $domain $selector pairs per line.

The $domain is used to lookup the $selector override (if any), similar to how the config here works. Assuming selector_maps is compatible with multiple selectors as well, then the only difference from this config below is configuring different path which we don't really need, and a similar setting path_maps supports.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feedback has been migrated to a separate TODO issue: #3778

@polarathene polarathene changed the title Update dkim_dmarc_spf.md docs: Rspamd DKIM config simplify via path setting Dec 16, 2023
@polarathene polarathene added kind/improvement Improve an existing feature, configuration file or the documentation area/documentation service/security/dkim-dmarc-spf service/security/rspamd labels Dec 16, 2023
@polarathene polarathene added this to the v13.1.0 milestone Dec 16, 2023
@polarathene
Copy link
Member

Worth noting perhaps, the default for $domain in the config has eSLD normalization enabled, which means some configurations (like hello@marketing.example.com) won't have a valid direct match (normalizes $domain to example.com).

I think that applies regardless of config approach. Just mentioning for maintainers to be aware of if that ever comes up as a reported problem in future 😅

@georglauterbach
Copy link
Member

Worth noting perhaps, the default for $domain in the config has eSLD normalization enabled, which means some configurations (like hello@marketing.example.com) won't have a valid direct match (normalizes $domain to example.com).

I think that applies regardless of config approach. Just mentioning for maintainers to be aware of if that ever comes up as a reported problem in future 😅

This can probably be configured with use_esld = true;?

@polarathene
Copy link
Member

This can probably be configured with use_esld = true;?

Yes, just raising awareness about it since it may show up some day as a bug report. If it does it's a simple documentation fix for rspamd/faq page(s) to communicate awareness to users.

It's probably unlikely that use_esld needs to be set to false? This is just storage of the private key within DMS for signing, and it's ok to use the same DKIM private key for various sender subdomains? (AFAIK they can all point to the same public key DNS record, or individual DNS records with the same public key)

@georglauterbach
Copy link
Member

@denisix please address the PR feedback; we can then go ahead and merge the PR.

@georglauterbach
Copy link
Member

last ping @denisix

polarathene
polarathene previously approved these changes Jan 14, 2024
Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the contributor is not engaging with review feedback, I'll apply my change suggestion.

DMS could better manage this internally and simplify on configuration a user needs to be aware of and manually manage via docs, but that'll need someone to contribute the change. A separate issue for tracking that with all the information discussed here has been opened.

Regarding the concern with use_esld = true and DKIM related rspamd bug reports, maintainers should be aware of this behaviour where it can affect some users that deviate from our happy path of hostname: mail.example.com with user@example.com mail domains if they have trouble with $domain expecting to match a marketing.example.com (eSLD normalization will look for example.com instead, which may not work if the user has user@marketing.example.com accounts?), instead of example.com (which is probably what they should adjust for, it's ok to use the same key for subdomains).

Since that setting has nothing to do with the contribution here, it's already true in the docs above, I'll go ahead and merge 👍 (we could improve on the docs a bit more by explaining the suggested config further though, especially with the path that isn't actually valid presently)

selector = "mail";
path = "/tmp/docker-mailserver/opendkim/keys/$domain/$selector.private"; # this will automatically match keys for domains

# domain specific configurations can be provided below:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feedback has been migrated to a separate TODO issue: #3778

Comment on lines 159 to 160
selector = "mail";
path = "/tmp/docker-mailserver/opendkim/keys/$domain/$selector.private"; # this will automatically match keys for domains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This context with source citing is now also part of the related TODO issue: #3778

docs/content/config/best-practices/dkim_dmarc_spf.md Outdated Show resolved Hide resolved
Copy link
Contributor

Documentation preview for this PR is ready! 🎉

Built with commit: 405be2c

@polarathene polarathene merged commit ce6ebcc into docker-mailserver:master Jan 15, 2024
@georglauterbach georglauterbach modified the milestones: v14.0.0, v13.3.0 Jan 15, 2024
# The path location is searched for a DKIM key with these variables:
# - `$domain` is sourced from the MIME mail message `From` header
# - `$selector` is configured for `mail` (as a default fallback)
path = "/tmp/docker-mailserver/dkim/keys/$domain/$selector.private";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is wrong, currently the keys are in: /tmp/docker-mailserver/opendkim/keys/

I have used path = "/etc/opendkim/keys/$domain/$selector.private"; until now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is wrong

It's an example and was explicitly changed to that by me for the docs.

The contributor used /tmp/docker-mailserver/... instead of /etc/... but otherwise they also referred to opendkim.

Not sure why you'd want OpenDKIM as the path for rspamd though? I want this to be a unified location for DKIM keys, but someone will need to contribute that change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's more that rspamd wanted to do signing before I would even know it. So I patched the path and selector to use open dkim path. Since opendkim was the first dkim stuff I had setup
Just feels like there is too many moving components in DMS and without a diagram I can not decide to shut down one component or another.
Anyway this config allows to local dkim sign and that's all I needed to pass 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation kind/improvement Improve an existing feature, configuration file or the documentation service/security/dkim-dmarc-spf service/security/rspamd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.