You are not logged in.

#1 2021-03-14 01:15:48

vanillamilkk
Member
Registered: 2021-03-11
Posts: 14

dkim=fail (body hash did not verify)

I have Minecraft, csgo, web, mail, etc server hosted on my home. I also have domain with complete A, AAA, MX, DKIM, DMARC, SRV, SPF record.
All are working flawlessly except the mail server with a little problem. Most of my mails sent directly to spam on major server (gmail, outlook, etc)

So my setup is :
Thunderbird (local pc) --> Postfix (Arch Server) ---> ISP smtp server (MyRepublic) --> Outlook (Microsoft)

Received: from TY2PR0101MB2415.apcprd01.prod.exchangelabs.com
 (2603:1096:404:5f::20) by SL2PR01MB2652.apcprd01.prod.exchangelabs.com with
 HTTPS; Sat, 6 Mar 2021 16:56:18 +0000
Received: from AM5PR0701CA0055.eurprd07.prod.outlook.com (2603:10a6:203:2::17)
 by TY2PR0101MB2415.apcprd01.prod.exchangelabs.com (2603:1096:404:5f::20) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Sat, 6 Mar
 2021 16:56:17 +0000
Received: from AM7EUR06FT038.eop-eur06.prod.protection.outlook.com
 (2603:10a6:203:2:cafe::43) by AM5PR0701CA0055.outlook.office365.com
 (2603:10a6:203:2::17) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.13 via Frontend
 Transport; Sat, 6 Mar 2021 16:56:15 +0000
Authentication-Results: spf=pass (sender IP is 158.140.187.14)
 smtp.mailfrom=kcml.my.id; outlook.com; dkim=fail (body hash did not verify)
 header.d=kcml.my.id;outlook.com; dmarc=pass action=none
 header.from=kcml.my.id;compauth=pass reason=100
Received-SPF: Pass (protection.outlook.com: domain of kcml.my.id designates
 158.140.187.14 as permitted sender) receiver=protection.outlook.com;
 client-ip=158.140.187.14; helo=smtpid.myrepublic.co.id;
Received: from smtpid.myrepublic.co.id (158.140.187.14) by
 AM7EUR06FT038.mail.protection.outlook.com (10.233.255.152) with Microsoft
 SMTP Server id 15.20.3890.19 via Frontend Transport; Sat, 6 Mar 2021 16:56:14
 +0000
X-IncomingTopHeaderMarker:
 OriginalChecksum:E97796DC5F80840B531C19CB3E919D534348DAC0F691B0B9B3C27810D6AB020F;UpperCasedChecksum:44F64B691AD7B5EB548E179B9B0E7014E252E1FECB49D28FEF6CB85989792471;SizeAsReceived:2288;Count:22
Received: from mail.kcml.my.id (unknown [158.140.163.137])
	by smtpid.myrepublic.co.id (Postfix) with ESMTP id 27DB83C1BA57
	for <xxxxxx@outlook.com>; Sat,  6 Mar 2021 23:56:12 +0700 (WIB)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtpid.myrepublic.co.id 27DB83C1BA57
Authentication-Results-Original: smtpid.myrepublic.co.id;	dkim=pass (2048-bit
 key) header.d=kcml.my.id header.i=@kcml.my.id header.b="GtT4m13/"
Received: from [192.168.1.248] (unknown [158.140.163.137])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by mail.kcml.my.id (Postfix) with ESMTPSA id D5B3F100D00
	for <xxxxxx@outlook.com>; Sat,  6 Mar 2021 23:56:11 +0700 (WIB)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=kcml.my.id; s=default;
	t=1615049771; bh=ZPrKwWTm/YG3PnvbUNe4oNxXUVRgLej0FXUjqodyJ1g=;
	h=Subject:References:To:From:Date:In-Reply-To;
	b=GtT4m13/6Am505V95DnRArDD7aaEA0XHX4VymH4+voTQtGpj8vFb3x4i9LWM2oTW+
	 BKyWNDkmsEWg2HOIVFGSitg2R7yIKiJQ0edskwYmBgCdlHFN4Fa0k6AVp/8r5ou6Xr
	 oEL4PLe0q7bW7M3HsuvdO4rtZ6a5SIl2Xph9bJ01lVnEil9wDexl169rnHEesuyvwY
	 RsiM58xLWhGlK+TGVDgtAtqV9ZVMNQUZ65uiKHmpb6cJHDiWgAIkDrsqrNk/X27C4n
	 OgCLhDl7/0b7+pKNkikVuwpjL0bgoGS6gwpF87/OEwXV9pQz5SH+GJd683rtng40d6
	 A4ezc5OVc+yww==
Subject: Fwd: Hmm yes?
References: <4a1699a4-ad79-9e07-796f-ddf4848c807f@kcml.my.id>
To: xxxxxx@outlook.com
From: vanilla milkk <xxxxx@kcml.my.id>
X-Forwarded-Message-Id: <4a1699a4-ad79-9e07-796f-ddf4848c807f@kcml.my.id>
Message-ID: <a0f228c9-1466-db19-65e5-f19011953d05@kcml.my.id>
Date: Sat, 6 Mar 2021 23:56:10 +0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.8.0
In-Reply-To: <4a1699a4-ad79-9e07-796f-ddf4848c807f@kcml.my.id>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="L06vZsQobKP3U5ubXG0R5VXrAEh4lxLZ7"
X-My-Republic-MailScanner-Information: Please contact the ISP for more information
X-My-Republic-MailScanner-ID: 27DB83C1BA57.A5657
X-My-Republic-MailScanner: Found to be clean
X-My-Republic-MailScanner-SpamScore: s
X-My-Republic-MailScanner-From: xxxxx@kcml.my.id
X-Spam-Status: No
X-IncomingHeaderCount: 22
Return-Path: xxxxx@kcml.my.id
MIME-Version: 1.0

I followed all the dkim, dmarc, postfix setup on Arch Wiki, and im quite lost what part i did wrong?
Tell me if you need more information.

Offline

#2 2021-03-14 15:11:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: dkim=fail (body hash did not verify)

It looks like there may be a copy paste error in the key in your TXT record likely where you concatenated the multiple parts - e.g., if you took the generated public key from opendkim, you need to do some manual editing to put multiple lines together properly.

Are you using openDKIM?  If so, what is the content of the public key at /etc/opendkim/${YOURSELECTOR}.txt? How did you create your TXT record for your DNS server (e.g., what exactly was entered for the txt record)?

FYI, I found the tools at mail-tester.com helpful in setting up my SPF/DKIM and DMARC which I coincendentially just worked through last weekend.  So I feel your pain on the confusion - while our wiki is generally excellent, it's really lacking in specifics for SPF/DKIM configuration.

EDIT: could you also clarify how / why you are running your own postfix server and using your ISPs mail server?  I'm not sure I understand this.  If you are running your own mail server, your ISP's mail server should be irrelevant.  I think this resulted in me looking up the TXT record of your ISP instead of your arch server.  If kcml.my.id is your arch server, there does not seem to be any published dkim TXT record (and/or it hasn't yet propogated, though this is generally fairly quick now and it certainly would have it published prior to your creation of this thread).

Last edited by Trilby (2021-03-14 15:23:44)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2021-03-15 10:38:50

vanillamilkk
Member
Registered: 2021-03-11
Posts: 14

Re: dkim=fail (body hash did not verify)

Trilby wrote:

It looks like there may be a copy paste error in the key in your TXT record likely where you concatenated the multiple parts - e.g., if you took the generated public key from opendkim, you need to do some manual editing to put multiple lines together properly.

Are you using openDKIM?  If so, what is the content of the public key at /etc/opendkim/${YOURSELECTOR}.txt? How did you create your TXT record for your DNS server (e.g., what exactly was entered for the txt record)?

Thanks for your help. Yes, im using openDKIM, and here is my public key.

[server ~]# cat /etc/opendkim/keys/kcml.my.id/default.txt
default._domainkey      IN      TXT     ( "v=DKIM1; k=rsa; "
          "p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1gD5q/bv1Vdq4JGiKGkxigvozQ+0FS2ih28nqOTmK34xXcNiWodEY60vQ4H9efvF+v0cPwLSw9bLsf1lx2G7CDZ7FwiLXI35lnSrTdpqX/saQRvtBnGNQb+/uHRabdVnvvzXlsvA7t2Aas/iFrQVhSnpmEDR9AJIYNfOiffINNsGF0ejuxNldgaPqragBPMVf2SBB3yr4M/oG0"
          "VnJWzrZT7UWF9P0KQ/KJpyfxWkcUg10hYXdEDaJ2gsZGBPW9FVkzV7l3u5ertho7NpTx/htPNCsK67G92TRXj7lkw5CQsOnEAp035LQ+zCCRDU67GjNYONxjXGn0cmV606HWrcpQIDAQAB" )  ; ----- DKIM key default for kcml.my.id
Trilby wrote:

FYI, I found the tools at mail-tester.com helpful in setting up my SPF/DKIM and DMARC which I coincendentially just worked through last weekend.  So I feel your pain on the confusion - while our wiki is generally excellent, it's really lacking in specifics for SPF/DKIM configuration.

I just tested it, they give me 7/10 score because my dkim signature is invalid.

Trilby wrote:

EDIT: could you also clarify how / why you are running your own postfix server and using your ISPs mail server?  I'm not sure I understand this.  If you are running your own mail server, your ISP's mail server should be irrelevant.  I think this resulted in me looking up the TXT record of your ISP instead of your arch server.  If kcml.my.id is your arch server, there does not seem to be any published dkim TXT record (and/or it hasn't yet propogated, though this is generally fairly quick now and it certainly would have it published prior to your creation of this thread).

They said they need to scan my email before sending it to the internet. They want me to add "relayhost = smtpid.myrepublic.co.id" inside my postfix configuration. And i just checked the DNS record and its there.

[vanilla@desktop ~]$ dig -t txt default._domainkey.kcml.my.id

; <<>> DiG 9.16.12 <<>> -t txt default._domainkey.kcml.my.id
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65365
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;default._domainkey.kcml.my.id. IN      TXT

;; ANSWER SECTION:
default._domainkey.kcml.my.id. 14400 IN TXT     "v=DKIM1; k=rsa;  p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1gD5q/bv1Vdq4JGiKGkxigvozQ+0FS2ih28nqOTmK34xXcNiWodEY60vQ4H9efvF+v0cPwLSw9bLsf1lx2G7CDZ7FwiLXI35lnSrTdpqX/saQRvtBnGNQb+/uHRabdVnvvzXlsvA7t2Aas/iFrQVhSnpmEDR9AJIYNfOiffINNsGF0ejuxNldgaPqragBPMV" "f2SBB3yr4M/oG0VnJWzrZT7UWF9P0KQ/KJpyfxWkcUg10hYXdEDaJ2gsZGBPW9FVkzV7l3u5ertho7NpTx/htPNCsK67G92TRXj7lkw5CQsOnEAp035LQ+zCCRDU67GjNYONxjXGn0cmV606HWrcpQIDAQAB"

;; Query time: 50 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Mon Mar 15 17:20:50 WIB 2021
;; MSG SIZE  rcvd: 483

[vanilla@desktop ~]$ dig -t txt _dmarc.kcml.my.id

; <<>> DiG 9.16.12 <<>> -t txt _dmarc.kcml.my.id
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41146
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;_dmarc.kcml.my.id.             IN      TXT

;; ANSWER SECTION:
_dmarc.kcml.my.id.      14400   IN      TXT     "v=DMARC1; p=quarantine; pct=20; adkim=s; aspf=r; fo=1; rua=mailto:postmaster@kcml.my.id; ruf=mailto:hostmaster@kcml.my.id;"

;; Query time: 33 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Mon Mar 15 17:21:06 WIB 2021
;; MSG SIZE  rcvd: 181

Offline

#4 2021-03-15 13:57:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: dkim=fail (body hash did not verify)

According to the dig output, your TXT record is indeed invalid.  Your key is split in the middle, remove the space and closing/starting quotes:

- MV" "f2S
+ MVf2S

Though it would also seem that your DNS updates are not propogating.  While I can confirm that dig returns your DKIM TXT record, various website DNS look ups (including mail-tester.com) are not seeing it. edit: either it just propogated, or I did something wrong as it's now showing up - though still with the problematic space.

Last edited by Trilby (2021-03-15 14:03:40)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2021-03-16 18:10:59

ghen
Member
From: Belgium
Registered: 2010-08-31
Posts: 121

Re: dkim=fail (body hash did not verify)

Trilby wrote:

According to the dig output, your TXT record is indeed invalid.  Your key is split in the middle, remove the space and closing/starting quotes:

- MV" "f2S
+ MVf2S

That's how TXT records work, there's a max length of 255, and DKIM keys (at least RSA ones) typically exceed it, so it has to be split.
See eg. https://www.unixfu.ch/how-to-split-dns-dkim-records/ or https://www.mailhardener.com/tools/dns-record-splitter

Offline

#6 2021-03-16 19:22:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: dkim=fail (body hash did not verify)

EDIT: oops - you're correct, sorry.  With mine entering it in the Linode DNS split caused it to fail, but putting it in concatenated worked - but dig still shows mine split.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2021-03-16 19:32:29

ghen
Member
From: Belgium
Registered: 2010-08-31
Posts: 121

Re: dkim=fail (body hash did not verify)

dig is a debug tool and shows the actual wire format.

Offline

#8 2021-03-16 19:48:00

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: dkim=fail (body hash did not verify)

Are you able to successfully sign and verify a mail with opendkim-testkey?

In that case you should probably configure postfix to save a local copy. Verify the dkim result and compare it with the mail you receive as spam.
Maybe something like this to create that copy? https://www.electricmonk.nl/log/2015/03 … tp-server/


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB