首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RSPAMD + DKIM签名:如何能够为多个域使用单个DKIM密钥?

RSPAMD + DKIM签名:如何能够为多个域使用单个DKIM密钥?
EN

Server Fault用户
提问于 2019-04-07 15:26:36
回答 1查看 4.2K关注 0票数 0

通过使用OPENDKIM的KeyTables和SigningTable,我能够为多个域设置一个DKIM键。但是由于公司开始使用RSPAMD,我不能再和RSPAMD一起使用OPENDKIM,而需要使用RSPAMD的DKIM签名模块。

这是一个很长的故事,但我最终在这种情况下,我需要为其他公司品牌领域设置一个单一的DKIM密钥。通常,我会在OPENDKIM中这样做:

代码语言:javascript
复制
*@maincorp.com mail._domainkey.maincorp.com
*@brand1.com mail._domainkey.maincorp.com
*@brand2.com mail._domainkey.maincorp.com

But,如何在RSPAMD中进行签名?通过浏览和使用RSPAMD文档,我尝试了几种没有成功的方法。是否可以像在OPENDKIM中一样,为多个域使用一个DKIM键在RSPAMD中签名?

请注意,离我的选秀还有很远的距离:

在1对1方案上,即DKIM与不同域名的DKIM键签署到目前为止是有效的。但我需要1到N方案,1 DKIM密钥为多个域.

备注:

  1. 我明白,我可以简单地为每个品牌的域名添加一个CNAME记录,指向maincorp.com _domainkey。但是,每个品牌域名都是在另一个国家注册的,而我无法立即获得(这将是一个相当长的官僚机构),因此这是不可能的。
  2. 我正在使用Opendkim和Spamassassin,并得到任命在第一工作良好,但现在,西班牙刺客取代了RSPAMD和Opendkim不再被使用。

谢谢,

托马斯

对于您的参考,这里是local.d/ DKIM _signing.conf中的dkim签名配置:

我的local.d/dkim_signing.conf:

代码语言:javascript
复制
enabled = true;

If false, messages with empty envelope from are not signed
allow_envfrom_empty = true;

# If true, envelope/header domain mismatch is ignored
allow_hdrfrom_mismatch = false;

# If true, multiple from headers are allowed (but only first is used)
allow_hdrfrom_multiple = false;

# If true, username does not need to contain matching domain
allow_username_mismatch = true;

# If false, messages from authenticated users are not selected for signing
auth_only = true;

# Default path to key, can include '$domain' and '$selector' variables
#path = "/etc/opendkim/userkeys/$domain/$selector.private";
path = "/etc/opendkim/keys/mailcorp.com/mail.private";

# Default selector to use
#selector = "default";
selector = "mail";

# If false, messages from local networks are not selected for signing
sign_local = true;

# Map file of IP addresses/subnets to consider for signing
# sign_networks = "/some/file"; # or url
# Symbol to add when message is signed
symbol = "DKIM_SIGNED";

# Whether to fallback to global config
try_fallback = false;
selector_map = "/etc/rspamd/dkim_selectors.map";
path_map = "/etc/rspamd/dkim_paths.map";

# Domain to use for DKIM signing: can be "header" (MIME From), "envelope" (SMTP From) or "auth" (SMTP username)
use_domain = "header";

# Domain to use for DKIM signing when sender is in sign_networks ("header"/"envelope"/"auth")
use_domain_sign_networks = "header";

# Domain to use for DKIM signing when sender is a local IP ("header"/"envelope"/"auth")
use_domain_sign_local = "header";

# Whether to normalise domains to eSLD
use_esld = false;

# Whether to get keys from Redis
# Not using redis, keys coming from files in /etc/opendkim
use_redis = false;

# Hash for DKIM keys in Redis
key_prefix = "DKIM_KEYS";

My /etc/rspamd/dkim_selectors.map:

代码语言:javascript
复制
maincorp.com mail
brand1.com mail
brand2.com mail

和my /etc/rspamd/dkim_dkim.my:

代码语言:javascript
复制
maincorp.com /etc/opendkim/keys/mancorp.com/mail.private
brand1.com /etc/opendkim/keys/mancorp.com/mail.private
brand2.com /etc/opendkim/keys/mancorp.com/mail.private

在local.d/dkim_signing.conf上使用上面的配置,结果如下:

  • 当电子邮件是从@mailcorp.com发送的,它没有问题,DKIM将被签署。为什么?因为在DNS mailcorp.com有_domainkey。
  • 但是,当从@brand1.com和@brand2.com发送电子邮件时,DKIM将不会被签名,除非我在brand1.com和brand2.com中添加了CNAME记录,而我从第一次就不想这样做。

需要完成What (主要目标),使用上面的配置还没有实现这一点,我需要您的帮助:

目的是使brand1.com和brand2.com能够由一个现有的DKIM密钥签名,该密钥已经在maincorp.com中的TXT记录中实现,而无需在每个brand1.com和brand2.comDNS面板中添加CNAME或TXT记录_domainkey。

至于maincorp.com,它已经在工作了,因为它在DNS面板中有mail._domainkey.maincorp.com的TXT记录。但不为brand1.com和brand2.com工作。

请帮帮我..。

2019年4月9日UPDATE:

我发现,不幸的是,我需要的这个特性还没有得到RSPAMD的支持,至少在受到质疑的时候是这样的。好吧,希望他们能做到。

因此,就目前而言,我只需将CNAME记录添加到brand1.com和brand2.com中,以便DKIM有效并签名:(。

非常感谢您的耐心和帮助!祝你有愉快的一天!

EN

回答 1

Server Fault用户

发布于 2020-06-26 08:20:37

让人们更容易在同一个问题上跌跌撞撞。下面是一个示例,说明如何使用上面的注释中提到的键和签名表,以便您可以对每个from域进行签名,并使用来自域的选择器而不是from域:

代码语言:javascript
复制
key_table = [ 
  "maincorp.com maincorp.com:dkim:/var/lib/rspamd/dkim/dkim.key"
];
signing_table = [ 
  "*@maincorp.com maincorp.com",
  "*@brand1.com maincorp.com",
  "*@brand2.com maincorp.com"
];

或者,只需签署每一个域。

代码语言:javascript
复制
signing_table = [ 
  "* maincorp.com",
];

这将导致以下dkim签名:

代码语言:javascript
复制
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maincorp.com;
    s=dkim; t=[...];
    h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to:
     cc; bh=[...];
    b=[...]

官方垃圾邮件dkim_签署文件

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/961913

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档