-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that negated addresses are added into pf tables and that hosts resolving to these addresses won't have their addresses added to the table. Test that networks cannot be negated. Test that the same address cannot be specified in normal and negated form.
- Loading branch information
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Create zone file with A and AAAA records in zone regress. | ||
# Start nsd with zone file listening on 127.0.0.1. | ||
# Write hosts of regress zone into pfresolved config. | ||
# Write negated addresses for hosts in regress zone into pfresolved config. | ||
# Start pfresolved with nsd as resolver. | ||
# Wait until pfresolved creates table regress-pfresolved. | ||
# Read IP addresses from pf table with pfctl. | ||
# Check that pfresolved resolved IPv4 and IPv6 addresses. | ||
# Check that pf table only contains the negated IPv4 and IPv6 addresses. | ||
|
||
use strict; | ||
use warnings; | ||
use Socket; | ||
|
||
our %args = ( | ||
nsd => { | ||
record_list => [ | ||
"foo IN A 192.0.2.1", | ||
"foo IN AAAA 2001:DB8::1", | ||
], | ||
}, | ||
pfresolved => { | ||
address_list => [ | ||
"foo.regress.", | ||
"! 192.0.2.1", | ||
"! 2001:DB8::1", | ||
], | ||
loggrep => { | ||
qr{added: 192.0.2.1/32,} => 1, | ||
qr{added: 2001:db8::1/128,} => 1, | ||
}, | ||
}, | ||
pfctl => { | ||
updated => [2, 0], | ||
loggrep => { | ||
qr/^ !192.0.2.1$/ => 1, | ||
qr/^ 192.0.2.1$/ => 0, | ||
qr/^ !2001:db8::1$/ => 1, | ||
qr/^ 2001:db8::1$/ => 0, | ||
}, | ||
}, | ||
); | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Write negated network into pfresolved config. | ||
# Start pfresolved. | ||
# Check that configuration parsing fails. | ||
|
||
use strict; | ||
use warnings; | ||
use Socket; | ||
|
||
our %args = ( | ||
pfresolved => { | ||
address_list => [ | ||
"! 192.0.2.1/24", | ||
], | ||
loggrep => { | ||
qr{negation is not allowed for networks} => 1, | ||
}, | ||
expected_status => 1, | ||
down => "parent: parsing configuration failed", | ||
}, | ||
); | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Write the same address in normal and negated form into pfresolved config. | ||
# Start pfresolved. | ||
# Check that configuration parsing fails. | ||
|
||
use strict; | ||
use warnings; | ||
use Socket; | ||
|
||
our %args = ( | ||
pfresolved => { | ||
address_list => [ | ||
"192.0.2.1", | ||
"! 192.0.2.1", | ||
], | ||
loggrep => { | ||
qr{the same address cannot be specified in normal and negated form} => 1, | ||
}, | ||
expected_status => 1, | ||
down => "parent: parsing configuration failed", | ||
}, | ||
); | ||
|
||
1; |