根據http://opendkim.org/opendkim.conf.5.html,ExternalIgnoredHosts
和InternalHosts
選項支援與選項相同的格式,PeerList
如下:
該集應在每行包含主機名稱、網域名稱(例如「.example.com」)、IP 位址、IPv6 位址(包括 IPv4 映射位址)或 CIDR 樣式 IP 規格(例如「192.168.1.0/ 24 英吋)。
IP 位址和子網路被正確識別為內部主機,但未選取所有主機名稱和網域。
這是/etc/opendkim.conf
LogWhy yes
Syslog yes
SyslogSuccess yes
UMask 002
UserID opendkim:opendkim
KeyTable refile:/etc/opendkim/key.table
SigningTable refile:/etc/opendkim/signing.table
ExternalIgnoreList refile:/etc/opendkim/trusted.hosts
InternalHosts refile:/etc/opendkim/trusted.hosts
AutoRestart yes
AutoRestartRate 10/1M
Background yes
Canonicalization relaxed/simple
DNSTimeout 5
Mode sv
Nameservers 192.168.100.1,192.168.100.2
OversignHeaders From
SignatureAlgorithm rsa-sha256
SubDomains no
Socket local:/var/spool/postfix/opendkim/opendkim.sock
PidFile /run/opendkim/opendkim.pid
和/etc/opendkim/trusted.hosts
127.0.0.1
::1
localhost
mailserver # mail server hostname
192.168.100.50 # test server
webserver.domain.local # web server
.domain.local # entire local domain
*.testdomain.local # entire local test domain
和main.cf
米爾特選項:
milter_default_action = accept
milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_type} {auth_authen}
milter_protocol = 6
smtpd_milters = local:opendkim/opendkim.sock
non_smtpd_milters = $smtpd_milters
來自的郵件192.168.100.50
按預期簽名:
mailserver postfix/qmgr[5406]: 59CA920E11: removed
mailserver postfix/smtpd[5412]: connect from testserver.mydomain.com[192.168.100.50]
mailserver postfix/smtpd[5412]: 41BD520E11: client=testserver.mydomain.com[192.168.100.50]
mailserver postfix/cleanup[5436]: 41BD520E11: message-id=<>
mailserver opendkim[5427]: 41BD520E11: DKIM-Signature field added (s=default, d=contoso.com)
mailserver postfix/qmgr[5406]: 41BD520E11: from=<[email protected]>, size=371, nrcpt=1 (queue active)
mailserver postfix/smtp[5437]: 41BD520E11: to=<[email protected]>, relay=ASPMX.L.GOOGLE.COM[173.194.76.27]:25, delay=0.4, delays=0.01/0/0.13/0.26, dsn=2.0.0, status=sent (250 2.0.0 OK 1610364907 k20si14443742wrc.23 - gsmtp)
mailserver postfix/qmgr[5406]: 41BD520E11: removed
但是,儘管解析了客戶的名稱,但來自的郵件webserver.domain.local
並未被視為內部郵件:
mailserver postfix/smtpd[5846]: connect from webserver.domain.local[192.168.100.51]
mailserver postfix/smtpd[5846]: 4F00620E11: client=webserver.domain.local[192.168.100.51]
mailserver postfix/cleanup[5850]: 4F00620E11: message-id=<>
mailserver opendkim[5840]: 4F00620E11: webserver.domain.local [192.168.100.51] not internal
mailserver opendkim[5840]: 4F00620E11: not authenticated
mailserver opendkim[5840]: 4F00620E11: no signature data
mailserver postfix/qmgr[5821]: 4F00620E11: from=<[email protected]>, size=371, nrcpt=1 (queue active)
mailserver postfix/smtp[5851]: 4F00620E11: to=<[email protected]>, relay=ASPMX.L.GOOGLE.COM[74.125.133.27]:25, delay=0.83, delays=0.01/0/0.43/0.39, dsn=2.0.0, status=sent (250 2.0.0 OK 1610365309 g124si15021166wma.170 - gsmtp)
mailserver postfix/qmgr[5821]: 4F00620E11: removed
我是否遺漏了與主機名稱如何解析相關的內容,或者與此功能如何實現相關的更基本的內容?我還嘗試過*.domain.local
和.domain.local
in的域組合,/etc/opendkim/trusted.hosts
但沒有成功。
任何和所有的幫助將不勝感激。
版本號碼:
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
~$ postconf mail_version
mail_version = 3.3.0
opendkim -V
~$ opendkim -V
opendkim: OpenDKIM Filter v2.11.0
Compiled with OpenSSL 1.1.1 11 Sep 2018
SMFI_VERSION 0x1000001
libmilter version 1.0.1
Supported signing algorithms:
rsa-sha1
rsa-sha256
Supported canonicalization algorithms:
relaxed
simple
Active code options:
POLL
QUERY_CACHE
USE_DB
USE_LDAP
USE_LUA
USE_ODBX
USE_UNBOUND
_FFR_ATPS
_FFR_RBL
_FFR_REPLACE_RULES
_FFR_SENDER_MACRO
_FFR_STATS
_FFR_VBR
libopendkim 2.11.0: atps query_cache
答案1
透過從/etc/opendkim/trusted.hosts
.那裡的星號不僅阻止了域通配符的工作,而且還阻止了檔案中所有其他字串條目的工作,儘管 IP 位址不受影響。
IP 位址有效,但字串無效:
127.0.0.1
::1
localhost
mailserver # mail server hostname
192.168.100.50 # test server
webserver.domain.local # web server
.domain.local # entire local domain
*.testdomain.local # entire local test domain
IP 位址和字串都有效:
127.0.0.1
::1
localhost
mailserver # mail server hostname
192.168.100.50 # test server
webserver.domain.local # web server
.domain.local # entire local domain
.testdomain.local # entire local test domain