LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-27-2019, 05:19 AM   #1
jeremywebdev
LQ Newbie
 
Registered: Mar 2019
Posts: 12

Rep: Reputation: Disabled
Question DKIM result failing due to altered body


Hi there,

Finding this confusing to be bluntly honest with you.

I have virtualmin running on CentOS 6.10, it's dkim-milter and postfix, what I have quite essentially done is made it append a disclaimer specific to a domain and had some trouble with getting the correct email domain so the disclaimer was even picked up as such so that it placed it at the end of the email.

/etc/postfix/disclaimer
Code:
#!/bin/sh 
# Localize these. 
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail

# For multiple domains:
DOMAIN_A_ADDRESSES=/etc/postfix/domain_a_addresses
DOMAIN_B_ADDRESSES=/etc/postfix/domain_b_addresses
# Exit codes from <sysexits.h> 
EX_TEMPFAIL=75 
EX_UNAVAILABLE=69 

# Clean up when done or when aborting. 
trap "rm -f in.$$" 0 1 2 3 15 

# Start processing. 
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit 
$EX_TEMPFAIL; }

cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }

from_domain=`grep -m1 "^From: " in.$$ | cut -f 2 -d "@" | cut -d ">" -f 1`

# hsmedia.co.uk domain name disclaimer
if [ `grep -wi ^${from_domain}$ ${DOMAIN_A_ADDRESSES}` ]; then
  /usr/bin/altermime --input=in.$$ \
                   --disclaimer=/etc/postfix/domain_a_disclaimer.txt \
                   --disclaimer-html=/etc/postfix/domain_a_disclaimer.txt.html || \
                    { echo Message content rejected; exit $EX_UNAVAILABLE; }
fi

if [ `grep -wi ^${from_domain}$ ${DOMAIN_B_ADDRESSES}` ]; then
  /usr/bin/altermime --input=in.$$ \
                   --disclaimer=/etc/postfix/domain_b_disclaimer.txt \
                   --disclaimer-html=/etc/postfix/domain_b_disclaimer.txt.html || \
                    { echo Message content rejected; exit $EX_UNAVAILABLE; }
fi

$SENDMAIL "$@" <in.$$

exit $?
Then the master.cf file contains:
Code:
<below every submission and smtp it has this below (since I am running two virtual hosts on virtualmin all using their own dedicated IPs:>
    -o content_filter=dfilt:
Right at the bottom is:
Code:
dfilt     unix    -       n       n       -       -       pipe
    flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}
Though I doubt the master.cf is the problem, I am just not sure about where to go from here really and get this working, did amazing getting the disclaimer working though, thought this was too easy haha

Any help is hugely appreciated in advance,
Jeremy,

Last edited by jeremywebdev; 03-27-2019 at 05:25 AM.
 
Old 03-27-2019, 05:37 AM   #2
jeremywebdev
LQ Newbie
 
Registered: Mar 2019
Posts: 12

Original Poster
Rep: Reputation: Disabled
Although on some deeper digging around the web I did find this result when sending a test email to this site http://www.appmaildev.com/en/dkim/, where it says this as a result:
Quote:
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=<removed_due_to_security>; s=dkim;
t=1553682784; bh=o6u9SwTFr9ixPtZCmrDMC/sTE2bZ+ftbqcUKb+wLqic=;
h=From:To:Subjectate:Message-ID:MIME-Version:Content-Type;
b=Sz1+tlDGbPV8KgJGX5raZF+k2e8TYgz/2EV7Y+wWyT6TCiIgYV76cXAeG0hcLvnvf
f40Ov7RLgKt5EYBKnP6jO46csjr5G3pLYN5fnxuw79ffjVAlOhqotaij60rQmW2AJ2
bHg04NH7fvMImTenWfMFKMKkaON/0tUtWgXE9J20Cr96AMejuJRkx+jYsgYrNLpjti
ESlCgR0PbUg83MCtpM0kKC0GtMEVpZOZixrMAFdy/rEC8Nvd+AwdoHHUzOZ5/1ERaq
ldZZS+hVGF0bg1D4drdt0rIZwAB7oLgUP8EQgHnzqam27lDtu1gYNmLE3oOOjnzQ5z
Wdh/nYp4cA3uw==
Signed-by: myemail@mydomain.co.uk
Expected-Body-Hash: w07cFI8oqc3Ikjr1P/rlOGVNXzoMkFcEGuKNBsxjPw8=

DKIM-Result: fail (wrong body hash: o6u9SwTFr9ixPtZCmrDMC/sTE2bZ+ftbqcUKb+wLqic=)
Kind regards,
Jeremy.

Last edited by jeremywebdev; 03-27-2019 at 06:06 AM. Reason: To add in address of dkim checking
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] DKIM Keeps bringing up dkim=neutral (bad format) header.i=@ j.smith1981 Linux - Server 4 08-28-2019 06:26 AM
Grep data inside <body>*</body> only tpubcom Linux - Newbie 3 10-11-2009 06:19 PM
LXer: Set Up DKIM For Multiple Domains On Postfix With dkim-milter 2.8.x (CentOS 5.3) LXer Syndicated Linux News 0 09-07-2009 06:20 PM
Hello every body, i'm using redhat linux I don't know about samba server any body seenas Linux - Newbie 2 07-04-2009 03:47 AM
LXer: Set Up DKIM On Postfix With dkim-milter (CentOS 5.2) LXer Syndicated Linux News 0 04-06-2009 12:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration