From 69821f62141a5b7899c49398bcb3321daffe70b8 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 23 Jan 2014 14:51:35 +0200 Subject: [PATCH] Fix DNSSEC handling and use secure-zone instead of static keys --- .../regression-tests/dnsbackend.rb | 3 ++ .../list-all-records/expected_dnssec_part1 | 8 +++++ .../list-all-records/expected_dnssec_part3 | 3 ++ .../list-all-records/expected_result | 3 -- .../regression-tests/test-schema.sql | 3 -- .../regression-tests/zeromq-backend.rb | 2 ++ regression-tests/feed_ds.pl | 32 +++++++++++++++++++ 7 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part1 create mode 100644 modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part3 create mode 100755 regression-tests/feed_ds.pl diff --git a/modules/remotebackend/regression-tests/dnsbackend.rb b/modules/remotebackend/regression-tests/dnsbackend.rb index 8fce5e56f..29a8f3897 100644 --- a/modules/remotebackend/regression-tests/dnsbackend.rb +++ b/modules/remotebackend/regression-tests/dnsbackend.rb @@ -65,6 +65,9 @@ class DNSBackendHandler < WEBrick::HTTPServlet::AbstractServlet { "name" => url.shift } + else + { + } end [method, args] diff --git a/modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part1 b/modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part1 new file mode 100644 index 000000000..2dfc73b91 --- /dev/null +++ b/modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part1 @@ -0,0 +1,8 @@ +example.com. 120 IN NS ns1.example.com. +example.com. 120 IN NS ns2.example.com. +example.com. 120 IN SOA ns1.example.com. hostmaster.example.com. 2000010101 28800 7200 1209600 120 +example.com. 120 IN SOA ns1.example.com. hostmaster.example.com. 2000010101 28800 7200 1209600 120 +ns1.example.com. 120 IN A 192.168.2.2 +ns2.example.com. 120 IN A 192.168.2.3 +outpost.example.com. 120 IN A 192.168.2.1 +outpost.example.com. 120 IN AAAA fe80::1 diff --git a/modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part3 b/modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part3 new file mode 100644 index 000000000..99438d965 --- /dev/null +++ b/modules/remotebackend/regression-tests/list-all-records/expected_dnssec_part3 @@ -0,0 +1,3 @@ +up.example.com. 120 IN NS ns1.example.com. +up.example.com. 120 IN NS ns2.example.com. +www.example.com. 120 IN A 192.168.2.255 diff --git a/modules/remotebackend/regression-tests/list-all-records/expected_result b/modules/remotebackend/regression-tests/list-all-records/expected_result index f9d0649c4..1f6061378 100644 --- a/modules/remotebackend/regression-tests/list-all-records/expected_result +++ b/modules/remotebackend/regression-tests/list-all-records/expected_result @@ -6,9 +6,6 @@ ns1.example.com. 120 IN A 192.168.2.2 ns2.example.com. 120 IN A 192.168.2.3 outpost.example.com. 120 IN A 192.168.2.1 outpost.example.com. 120 IN AAAA fe80::1 -up.example.com. 120 IN DS 38674 8 1 50EA84825288D03BF9DDDA0B0B5F8964C6FBAFA8 -up.example.com. 120 IN DS 38674 8 2 BF31EF7AEA46F2ADCA7A61FBB0629FB5C24116DF0F22EC0115DBC7EB DDDEE04E -up.example.com. 120 IN DS 38674 8 3 6ED18DCEABA6D2547F2FC82BA3801FDC919DB51B0E44BAA261B887C8 24DD9A2D up.example.com. 120 IN NS ns1.example.com. up.example.com. 120 IN NS ns2.example.com. www.example.com. 120 IN A 192.168.2.255 diff --git a/modules/remotebackend/regression-tests/test-schema.sql b/modules/remotebackend/regression-tests/test-schema.sql index dbc2e8a5e..5d891ec3d 100644 --- a/modules/remotebackend/regression-tests/test-schema.sql +++ b/modules/remotebackend/regression-tests/test-schema.sql @@ -77,9 +77,6 @@ insert into records (domain_id, name, type, ttl, content, ordername, auth) selec insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns2.example.com", "up", 0 FROM domains WHERE name = "example.com"; insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns1.example.com", "A", "120", "192.168.2.2", "ns1", 1 FROM domains WHERE name = "example.com"; insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns2.example.com", "A", "120", "192.168.2.3", "ns2", 1 FROM domains WHERE name = "example.com"; -insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "DS", "120", "38674 8 1 50ea84825288d03bf9ddda0b0b5f8964c6fbafa8", "up", 1 FROM domains WHERE name = "example.com"; -insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "DS", "120", "38674 8 2 bf31ef7aea46f2adca7a61fbb0629fb5c24116df0f22ec0115dbc7ebdddee04e", "up", 1 FROM domains WHERE name = "example.com"; -insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "DS", "120", "38674 8 3 6ed18dceaba6d2547f2fc82ba3801fdc919db51b0e44baa261b887c824dd9a2d", "up", 1 FROM domains WHERE name = "example.com"; insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "SOA", "120", "ns1.example.com hostmaster.example.com 2000010101 28800 7200 1209600 120", "", 1 FROM domains WHERE name = "up.example.com"; insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns1.example.com", "", 1 FROM domains WHERE name = "up.example.com"; insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns2.example.com", "", 1 FROM domains WHERE name = "up.example.com"; diff --git a/modules/remotebackend/regression-tests/zeromq-backend.rb b/modules/remotebackend/regression-tests/zeromq-backend.rb index 073781ebf..74d88cade 100755 --- a/modules/remotebackend/regression-tests/zeromq-backend.rb +++ b/modules/remotebackend/regression-tests/zeromq-backend.rb @@ -8,6 +8,8 @@ require 'zero_mq' $:.unshift File.dirname(__FILE__) require "backend" +h = Handler.new("#{File.dirname(__FILE__)}/remote.sqlite3") + f = File.open "/tmp/tmp.txt","a" f.sync = true diff --git a/regression-tests/feed_ds.pl b/regression-tests/feed_ds.pl new file mode 100755 index 000000000..1a0de560a --- /dev/null +++ b/regression-tests/feed_ds.pl @@ -0,0 +1,32 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use 5.005; + +# usage: feed_ds.pl domain parent pdnssec sqdb + +my $domain = shift; +my $parent = shift; +my $pdnssec = shift; +my $sqdb = shift; + +open IN, "-|", "$pdnssec show-zone $domain 2>&1"; + +my $recs = []; + +while() { + chomp; + if (/DS = (.*) IN DS (.*);/) { + # we have data + + push @$recs, [ $1, $2 ] + } +} + +for my $rec (@$recs) { + my ($name,$value) = @$rec; + my $sql = qq(INSERT INTO records (domain_id, name, type, content, ttl, auth) SELECT id, "$name", "DS", "$value", 120, 1 FROM domains WHERE name = "$parent"); + # then feed data + qx(sqlite3 $sqdb '$sql') +} -- 2.40.0