Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

Re: [Bulk] Re: [Bulk] Re: DKIM for AOL

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


ma1l1ists at yahoo

Nov 24, 2011, 11:05 AM

Post #1 of 4 (646 views)
Permalink
Re: [Bulk] Re: [Bulk] Re: DKIM for AOL

On Thu, 24 Nov 2011 13:04:18 -0500
Vahid Moghaddasi <vahid.moghaddasi [at] gmail> wrote:

> if [[ $DOMAIN == !(+([a-zA-Z0-9\!\#$%*/?|^{}\`~&\'+=_.-])) ]] ; then
> echo "DSender address contains illegal characters."
> exit 0
> fi

Ahh, that was the main thing. As i didn't have bash regex or shopt
though I could have installed bash. I redid this with perl. I
believe Perls quicker at regex but loading the larger perl binary may
slow it down. Are you running bash or another shell?

Mines at version 5 and I haven't diffed them yet but will do.


vahid.moghaddasi at gmail

Nov 24, 2011, 11:17 AM

Post #2 of 4 (597 views)
Permalink
Re: [Bulk] Re: [Bulk] Re: DKIM for AOL [In reply to]

On Thu, Nov 24, 2011 at 2:05 PM, Kevin Chadwick <ma1l1ists [at] yahoo>wrote:

> On Thu, 24 Nov 2011 13:04:18 -0500
> Vahid Moghaddasi <vahid.moghaddasi [at] gmail> wrote:
>
> > if [[ $DOMAIN == !(+([a-zA-Z0-9\!\#$%*/?|^{}\`~&\'+=_.-])) ]] ; then
> > echo "DSender address contains illegal characters."
> > exit 0
> > fi
>
> Ahh, that was the main thing. As i didn't have bash regex or shopt
> though I could have installed bash. I redid this with perl. I
> believe Perls quicker at regex but loading the larger perl binary may
> slow it down. Are you running bash or another shell?
>
> Mines at version 5 and I haven't diffed them yet but will do.
>
> Well, Solaris 10 comes with bash and perl 5.8.4. I thought regex or shopt
are standard in many OS's. I do have shopt and regex on the server.
So you have converted Kyle's qmail-remote.sh to perl? Will you be able to
share that?
At this point, I just want this to work and not really care about speed as
the number
of e-mails to aol.com is very insignificant compaing to our overall volume.
Beside, I am moving all the AOL e-mails to dedicated machines for DKIM
injection.


ma1l1ists at yahoo

Nov 24, 2011, 11:42 AM

Post #3 of 4 (610 views)
Permalink
Re: [Bulk] Re: [Bulk] Re: DKIM for AOL [In reply to]

On Thu, 24 Nov 2011 14:17:12 -0500
Vahid Moghaddasi wrote:

> Well, Solaris 10 comes with bash and perl 5.8.4. I thought regex or shopt
> are standard in many OS's. I do have shopt and regex on the server.>
> Will you be able to share that?

Here, ya go but I'm not sure it will help if your running bash, you
could try changing the sender variable to match.

> So you have converted Kyle's qmail-remote.sh to perl?

No, I just converted that little section and disabled the subdomain
section so it's using both which isn't ideal, but mines low volume. I've
added full paths so just merge in the perl section if you want to try
it. I'll compare to the new version 6 later and forward it to kyle,
though I'm not sure he'll be that interested. The X-DKIM-Originator I
mentioned earlier is for incoming not qmail-remote, so that explains
why you hadn't seen it.


#!/bin/sh
# version 5.1 (not by original author)
PATH=/bin:/usr/bin:/usr/local/bin
host="$1"
sender="$2"
# First, figure out who the sending domain is:
if [ -z "$sender" -a -n "$DEFAULTDOMAIN" ]; then
sender="@$DEFAULTDOMAIN"
fi
if [ -z "$sender" ]; then
sender="@`/bin/hostname`"
fi
DOMAIN="${sender##*@}"
# Sanity-check the domain (regex changed to only match domain chars and converted to /bin/sh + perl from bash for portability, also broke portability by adding paths to bins but that's easy to fix)
/usr/bin/perl -e '
use strict;
use warnings;
my $DOMAIN2PL = q{'"$DOMAIN"'};
if ($DOMAIN2PL =~ qr/[^A-Za-z0-9-.\_]+/) {
print "Message from the qmail-remote wrapper.\n This submitted Sender
domain contained illegal characters.\n $DOMAIN2PL\n"; exit 1 }
' || exit 0
# Now, fill in the basic variables (if they don't exist already)
[ "$DKREMOTE" ] || DKREMOTE="/var/qmail/bin/qmail-remote.orig"
[ "$DKSIGN" ] || DKSIGN="/etc/ssl/domainkeys/"$DOMAIN"/default"
# Now try and find the right subdomain, per RFC 4871
# (you can eliminate this loop if you don't want parent domains signing child
# domain's email)
#if [ "$DOMAIN" ] ; then
# while [ ! -r "${DKSIGN//\%/$DOMAIN}" ] ; do
# # try parent domains, per RFC 4871, section 3.8
# DOMAIN=${DOMAIN#*.}
# DPARTS=( ${DOMAIN//./ } )
# [ ${#DPARTS[*]} -eq 1 ] && DOMAIN="${sender##*@}" && break
# done
#fi
#DKSIGN="${DKSIGN//\%/$DOMAIN}"
#DKSIGN=`echo "$DKSIGN" | /usr/bin/sed s/%/"$DOMAIN"/`
# Now that we have the correct DKSIGN value (i.e. the filename of the key to
# use to sign email), check to see if this file exists
if [ -r "$DKSIGN" ] ; then
# The key does exist, so now use it to generate signatures!
tmp=`/usr/bin/mktemp -t dk.sign.XXXXXXXXXXXXXXXXXXX`
tmp2=`/usr/bin/mktemp -t dk2.sign.XXXXXXXXXXXXXXXXXXX`
/bin/cat - >"$tmp"

# compute the DomainKey signature
error=`(dktest -s "$DKSIGN" -c nofws -h <"$tmp" | \
/usr/bin/sed 's/; d=.*;/; d='"$DOMAIN"';/' > "$tmp2")
2>&1` if [ "$error" ] ; then
# Communicate the problem to qmail (that's why the 'Z')
echo "ZDomainKey error: $error"
/bin/rm "$tmp" "$tmp2"
exit -1
fi

# compute the DKIM signature
error=`(/var/qmail/bin/dkimsign.pl --type=dkim
--selector=default \
--key="$DKSIGN" --method=relaxed
<"$tmp" | \ /usr/bin/tr -d '\r' >> "$tmp2") 2>&1`
if [ "$error" ] ; then
# Communicate the problem to qmail (that's why the 'Z')
echo "ZDKIM error: $error"
/bin/rm "$tmp" "$tmp2"
exit -2
fi

# feed the signatures and the original message to the real
qmail-remote /bin/cat "$tmp2" "$tmp" | "$DKREMOTE" "$@"
retval=$?
/bin/rm "$tmp" "$tmp2"
exit $retval
else
# No signature added
exec "$DKREMOTE" "$@"
fi


vahid.moghaddasi at gmail

Nov 24, 2011, 5:04 PM

Post #4 of 4 (588 views)
Permalink
Re: [Bulk] Re: [Bulk] Re: DKIM for AOL [In reply to]

On Thu, Nov 24, 2011 at 2:42 PM, Kevin Chadwick <ma1l1ists [at] yahoo>wrote:

> if [ -r "$DKSIGN" ] ; then
>

Thanks Kevin, I placed this script (copy paste from mail is not a good
idea) in qmail-remote but
still don't see anything in the header of the mail going out. In fact, the
script is never going
inside the above loop.
The DKSIGN has the value of /etc/domainkeys/example.com/default when the
script runs.
Do I have to do anything with /etc/tcp.smtp? I didn't touch it.

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.