1

Topic: Space after d= and s= in Gmail header is causing DKIM to fail on gmail

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.7.3 MARIADB edition.
- Deployed with iRedMail Easy or the downloadable installer? Downloadable installer
- Linux/BSD distribution name and version:Red Hat Enterprise Linux 8.10
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====


I found a forum post with this exact issue but no resolution.  I have a new iredmail server setup with latest versions and have it setup for multiple domains.  I am seeing DKIM fail on one of my domains at least with @gmail.com addresses because when gmail reads the DKIM it places a space after the d= and the s= in the header (see below.)  I am not seeing this behavior when sending to Office365 domains (see below.)  I have checked my config and the definition doesn't have any spaces in it.  What can I do to further troubleshoot this:

GOOGLE HEADER
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= mydomain.com; h=content-transfer-encoding:content-type :message-id:user-agent:subject:to:from:date:mime-version; s= dkim; t=1744719476; x=1745583477; bh=65U7jpwPpS84NFanIBa+0J9tjoH kNkELBh4hQNCBoRk=; b=YkBQ3f2AgSYyyFYK40H5R0b4cm02I/tupB7B+PQk4vV XBXWw81VcbHlJUvrhfhnQQsaoy4cVOwGw3Lu9WPVfvs8TnKKp4Fa66RNOJ7sKrYA mOPZu8rb3WYdQo1e2IDc2KNFUhmXDvi+frOPb9a8aVpmDFqo7Xl94jMpoTlfQgnw +Sqy6o9Owf8C91r6xM4rZHRZJ/ahFAuC9/2wfAghCrE3BMgd/bdQ8z/smjZShNMw 20ASCbHAOauTWnajLBYxhZZ6U7FndnSFHZTaRerFizPRdfEfbmQw4pqkNYYrPS6m aqTkH9dqaK2YhEb+z5WbgiglFmNiHRcqRXTg/WVoiXw==

I can't find a way to remove the space after d= or the one after s=

I should add that so far I am only seeing this behavior when I send to gmail.com.  I am sure other domains will flag it the same way, but O365 passes it for DKIM but it places the data on different lines and the d= and s= lines don't have a space at the end of them:

O365 HEADER
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=
    mydomain.com; h=content-transfer-encoding:content-type
    :message-id:user-agent:subject:to:from:date:mime-version; s=
    dkim; t=1744720801; x=1745584802; bh=6dGRTJ9k/x390Q+OebGxYyo5aqS
    OjPTtxyL9WDi/E/c=; b=Hn0kBrl8B9SJnyHiD+9FHJIbDVbOt6SjFkiOVNo1SoM
    0658q39ZrYSxVLBsUj3o317WOpqsV0duAiGkNpb/5XMu8ptG/jpuBtAGJJxC9UC/
    vJjkl1y2iW8rImYE0ZFC7PktC9JljHQwxxNwNvBy3bGD3YaZ1txh2xELdP6RqNqE
    i12YPwD01q4Tjuq1Ha0CXS1LrzjtVcaIQoAmMK5prqcd+pekYRN5uwSExZS5SjFu
    n9QIavaoHCwz5kgEck7mwpjLvMiQroPrsMZhiGpiKC4whNun8hHr5U8PQvaGD1Rd
    roJCDmmUQmSVXe1PtMnzT1AMx03xXP+5R6ogcsLh+jw==

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Space after d= and s= in Gmail header is causing DKIM to fail on gmail

UPDATE:   I removed the dkim key for the domain and recreated it from scratch and now it is passing Google's check even though the spaces still remain in the header after the d= and s= .  So Disregard and posting this update for other's who might have run into this problem as a possible solution....just recreate it smile