Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@he32
Copy link
Contributor

@he32 he32 commented Mar 9, 2017

Changes proposed in this pull request:

  • Add support for the CAA resource record type

Tests will be added in a later commit, so hold off with merging of
this branch for now.

I'll note that the tinydns export of the CAA record is .. sketchy, and
needs further testing.

Copy link
Collaborator

@msimerson msimerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy to see this PR. :-)

my @match_one = ("mailto:", "http:", "https:");
my $match = 0;
foreach (@match_one) {
if ($value =~ /$_/i) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good habit to anchor regexes when possible. Adding a ^ to anchor to the string start would do.

if ($value =~ /$_/i) {
$match = 1;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this entire foreach clause could be replaced with an anchored grep for invalid syntax:

if (grep { $value !~ /^$_/i } @match_one) {

Copy link
Collaborator

@msimerson msimerson Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although, I'd also change the name of @match_one to @valid_iodef_schemes, or something like that.

{ name => 'www', address => '2607:f729:0000:0000:0000:0000:0000:0001', type => 'AAAA', },
{ name => 'test.com.', weight => '0', priority => "issue", address => "ca.example.com", type => 'CAA', ttl=>3600 },
{ name => 'test.com.', weight => '128', priority => "iodef", address => "mailto:security@test.com", type => 'CAA', ttl=>3600 },
{ name => 'test.com.', weight => '0', priority => "iodef", address => "https://ca-report.test.com/", ttl=>3600 },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing type on this one is causing one of your test failures.

@he32
Copy link
Contributor Author

he32 commented Mar 9, 2017

There!
This is btw. the same as issue #156, which came from one of my colleagues.

@msimerson
Copy link
Collaborator

Fixes #156

@msimerson
Copy link
Collaborator

Looks great! Have you tested the client portions in the client UI with a browser to assure they do what you expect? If so, this looks ready to merge.

@he32
Copy link
Contributor Author

he32 commented Mar 9, 2017

Nope, my colleague is working on setting up a local test rig, and I'll point him to this change set so that it can be properly tested. So, if you will, you can hold off till that's done as well.

@msimerson
Copy link
Collaborator

msimerson commented Mar 9, 2017

TODO

  • test nictool changes in browser
  • test tinydns export

@he32
Copy link
Contributor Author

he32 commented Mar 10, 2017

It's getting there, but I could not get any of the checks in _valid_caa() to fire (and give visible feedback in the web UI) when I edit or create RRs through the web UI that would violate the checks in that function in NicToolServer/Zone/Record/Sanity.pm. Any hints?

@msimerson
Copy link
Collaborator

but I could not get any of the checks in _valid_caa() to fire

My first guess: you didn't 'make install && apachectl restart', to get your modified version installed and running.

@he32
Copy link
Contributor Author

he32 commented Mar 13, 2017

Your hunch was correct, there was an inconsistency between what had been installed and what the source tree contained. That's now fixed, and the checks in Record/Sanity.pm fire correctly and give feedback via the GUI when you violate the rules encoded there.

I've also made a small adjustment to the tinydns export code, so that what's exported better matches what's in the RFC. However, I've not tried to feed the generated data to tinydns itself. The example
zone I'm playing with came out as

Zfoo:ns1.example.com.:hostmaster.foo.:2017031302:16384:900:1048576:2560:86400::
&foo::ns1.example.com.:86400::
&foo::ns2.example.com.:86400::
&foo::ns3.example.com.:86400::
+bar.foo:127.0.0.1:3600::
+bar.foo:127.0.0.2:3600::
:caatest.foo:257:\200\005iodefhttps\072\057\057ca-err.example.com\057:86400::
:foo.:257:\000\005issuesome-example-ca-issuer.com:86400::
:ca.foo:257:\200\005iodefmailto\[email protected]:86400::

Any chance you could test that tinydns "eats" this correctly?

@msimerson
Copy link
Collaborator

msimerson commented Mar 13, 2017

tinydns-data compiles the records all right, and tinydns serves them (in some fashion), but something isn't right:

$ dig +short foo @66.128.51.172 CAA
$ dig +short ca.foo @66.128.51.172 CAA
$ dig +short catest.foo @66.128.51.172 CAA
$ dig +short ca.foo @66.128.51.172
$ dig +short caatest.foo @66.128.51.172

Likely because my version of dig (9.8.3) is too old to support CAA records (yup, CAA support added in 9.9.6).

Again with more modern tools:

$ drill foo @66.128.51.172 CAA
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 6546
;; flags: qr aa rd ; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 0 
;; QUESTION SECTION:
;; foo.	IN	CAA

;; ANSWER SECTION:
foo.	86400	IN	CAA	0 issue "some-example-ca-issuer.com"

That's more like it. :-)

@msimerson msimerson merged commit d953d3e into NicTool:master Mar 13, 2017
@msimerson
Copy link
Collaborator

@he32 , I've opened PR #193 which contains a couple changes to CAA records. I'd appreciate if you'd review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants