require 5.6.0;
+use IO::File;
use IO::Socket::UNIX;
use Getopt::Long;
"pidfile=s" => \$pidfile,
"timeout=i" => \$timeout);
+STDOUT->autoflush(1);
+
if (!defined($path)) {
print("Usage: authsock.pl --path=<sockpath> --type=type --pidfile=pidfile\n");
exit(1);
--- /dev/null
+$TTL 300 ; 5 minutes
+@ IN SOA ns1.example.nil. hostmaster.example.nil. (
+ 1 ; serial
+ 2000 ; refresh (2000 seconds)
+ 2000 ; retry (2000 seconds)
+ 1814400 ; expire (3 weeks)
+ 3600 ; minimum (1 hour)
+ )
+@ NS ns1.example.nil.
+ NS ns2.example.nil.
};
};
+zone "grant-external.test" {
+ type primary;
+ file "grant-external.test.db";
+ update-policy {
+ grant "local:auth.sock" external * CNAME;
+ };
+};
+
zone "many.test" {
type primary;
allow-update { any; };
. ../conf.sh
cp -f ns1/example1.db ns1/example.db
+cp -f ns1/grant-external.test.db.in ns1/grant-external.test.db
sed 's/example.nil/other.nil/g' ns1/example1.db >ns1/other.db
sed 's/example.nil/unixtime.nil/g' ns1/example1.db >ns1/unixtime.db
sed 's/example.nil/yyyymmddvv.nil/g' ns1/example1.db >ns1/yyyymmddvv.db
status=1
}
+n=$((n + 1))
+ret=0
+echo_i "check that grant external pass client address properly ($n)" {
+($PERL "${TOP_SRCDIR}/bin/tests/system/authsock.pl" --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 >authsock.out.test$n 2>&1 &) &
+sleep 1
+nextpart authsock.out.test$n >/dev/null
+$NSUPDATE -k ns1/ddns.key -d <<EOF >nsupdate.udp.test$n 2>&1 || ret=1
+server 10.53.0.1 ${PORT}
+zone grant-external.test
+update add cnameoverudp.grant-external.test 0 IN CNAME grant-external.test.
+send
+EOF
+nextpart authsock.out.test$n | grep ' addr= ' >/dev/null || ret=1
+$NSUPDATE -v -d <<EOF >nsupdate.tcp.test$n 2>&1 || ret=1
+server 10.53.0.1 ${PORT}
+zone grant-external.test
+update add cnameovertcp.grant-external.test 0 IN CNAME grant-external.test.
+send
+EOF
+nextpart authsock.out.test$n | grep ' addr=10.53.0.1 ' >/dev/null || ret=1
+kill $(cat authsock.pid) || true
+[ $ret = 0 ] || {
+ echo_i "failed"
+ status=1
+}
+
if ! $FEATURETEST --gssapi; then
echo_i "SKIPPED: GSSAPI tests"
else
EXTRA_ARTIFACTS = pytest.mark.extra_artifacts(
[
"Kxxx*",
+ "authsock.out.*",
+ "authsock.pid",
"dig.out.*",
"nextpart.out.*",
"nsupdate.*out*",
+ "nsupdate.tcp.*",
+ "nsupdate.udp.*",
+ "perl.update_test.out",
"policy.expected.*",
"policy.log*",
- "perl.update_test.out",
"typelist.out.*",
"update.in.*",
"verylarge",
"ans*/ans.run",
"ns*/*.jnl",
"ns*/*.jnl",
+ "ns1/auth.sock",
"ns1/ddns.key",
"ns1/example.db",
+ "ns1/grant-external.test.db",
"ns1/keytests.db",
"ns1/legacy*.key",
"ns1/many.test.db",
echo_i "testing external update policy (CNAME) with auth sock ($n)"
ret=0
-$PERL ./authsock.pl --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 >/dev/null 2>&1 &
+($PERL "${TOP_SRCDIR}/bin/tests/system/authsock.pl" --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 >/dev/null 2>&1 &) &
sleep 1
test_update $n testcname.example.nil. CNAME "86400 CNAME testdenied.example.nil" "testdenied" || ret=1
n=$((n + 1))