Subject: | Creating a TXT record for DKIM / Escaping the ; |
Hello,
my Perl: see perlversion.txt
Net::DNS 0.65
bind 9.5.0-P2
I am trying to create a TXT record for use with the domainkey system.
An example of the data part would be
"v=DKIM1\; k=rsa\; t=y\;
p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB"
If i send the update (see and use the dnsupdate.pl [contains real data]),
the data part is escaped twice again.
i.e.
"v=DKIM1\\\; k=rsa\\\; t=y\\\;
p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB"
If i put the TXT record manually into a zone file, the server returns
the expected result, so i assume, the escaping is a "bug" in Net::DNS
Probably it's only an error on my side, if so, apologize and please tell
me, what i did wrong.
Thanks Torsten
Subject: | dnsupdate.pl |
#!/usr/bin/perl
use Net::DNS;
use Digest::MD5("md5_hex");
$t = 'v=DKIM1\; k=rsa\; t=y\; p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB';
$rt = "porgy._domainkey.test3.com. IN TXT '$t'";
upd($rt);
exit;
sub upd {
my $ru = shift;
my $update = Net::DNS::Update->new("test3.com");
$update->push("update", rr_del("porgy._domainkey.test3.com. IN TXT"));
$update->push("update", rr_add($ru));
$update->sign_tsig("test3.com", "Yl1CRVlIQiZVLUldT08wSEEidm0jcFJ8aCJIWz0oZXI=");
my $res = Net::DNS::Resolver->new;
$res->nameservers('ns0.xtremeweb.de');
my $reply = $res->send($update);
print "\n------------------------- update:\n$ru\n";
# Did it work?
if ($reply) {
if ($reply->header->rcode eq 'NOERROR') {
print "Update succeeded\nNow make a 'host -a porgy._domainkey.test3.com. ns0.xtremeweb.de'\n";
} else {
print 'Update failed: ', $reply->header->rcode, "\n";
}
} else {
print 'Update failed: ', $res->errorstring, "\n";
}
}
Subject: | perlversion.txt |
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.25, archname=i586-linux-thread-multi
uname='linux bach 2.6.25 #1 smp preempt rt 2008-06-04 00:52:17 +0200 i686 i686 i386 gnulinux '
config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Duseshrplib=true -Doptimize=-O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe'
ccversion='', gccversion='4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib /usr/local/lib
libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.8.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.8'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.10.0/i586-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_TRACK_MEMPOOL PERL_USE_SAFE_PUTENV USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Jun 6 2008 18:39:56
@INC:
/usr/lib/perl5/5.10.0/i586-linux-thread-multi
/usr/lib/perl5/5.10.0
/usr/lib/perl5/site_perl/5.10.0/i586-linux-thread-multi
/usr/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i586-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0
/usr/lib/perl5/vendor_perl
.