Skip to content

Commit

Permalink
Use xsltproc instead of Xalan
Browse files Browse the repository at this point in the history
See ukf/ukf-meta#159.
  • Loading branch information
iay committed Mar 22, 2018
1 parent dcddefd commit 4f74fc5
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 82 deletions.
38 changes: 0 additions & 38 deletions build/Xalan.pm

This file was deleted.

9 changes: 4 additions & 5 deletions build/check_entity.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/perl -w
use Xalan;
use File::Temp qw(tempfile);
use Date::Parse;
use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);
Expand Down Expand Up @@ -28,16 +27,16 @@
# temporary file
$temp = '../xml/embedded.pem';
unlink($temp) if -e $temp;

# extract embedded certificates
open(EXTRACT, xalanCall . " -IN $fn -OUT $temp -XSL extract_embedded.xsl|")
open(EXTRACT, "xsltproc --output $temp extract_embedded.xsl $fn|")
|| die "could not open certificate extract process";
while (<EXTRACT>) {
print $_;
}
close EXTRACT;
die "no embedded certificates extracted" unless -e $temp;

# check embedded certificates
open(CHECK, "cd ../xml; perl ../build/check_embedded.pl <$temp|")
|| die "could not open certificate check process";
Expand All @@ -47,7 +46,7 @@
print $_;
}
close CHECK;

# clean up
unlink($temp) if -e $temp;
}
Expand Down
4 changes: 1 addition & 3 deletions build/extract_locs.pl
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/perl -w

use Xalan;

open(XML, xalanCall . " -IN ../mdx/uk/collected.xml -XSL extract_locs.xsl|") || die "could not open input file";
open(XML, "xsltproc extract_locs.xsl ../mdx/uk/collected.xml|") || die "could not open input file";
while (<XML>) {
chop;
if (/^https:\/\/([^\/:]+(:\d+)?)(\/|$)/) {
Expand Down
4 changes: 1 addition & 3 deletions build/extract_locs_edugain.pl
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/perl -w

use Xalan;

open(XML, xalanCall . " -IN ../mdx/int_edugain/imported.xml -XSL extract_locs.xsl|") || die "could not open input file";
open(XML, xalanCall . "xsltproc extract_locs.xsl ../mdx/int_edugain/imported.xml|") || die "could not open input file";
while (<XML>) {
chop;
if (/^https:\/\/([^\/:]+(:\d+)?)(\/|$)/) {
Expand Down
4 changes: 1 addition & 3 deletions build/extract_locs_noports.pl
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/perl -w

use Xalan;

open(XML, xalanCall . " -IN ../mdx/uk/collected.xml -XSL extract_locs.xsl|") || die "could not open input file";
open(XML, xalanCall . "xsltproc extract_locs.xsl ../mdx/uk/collected.xml|") || die "could not open input file";
while (<XML>) {
chop;
if (/^https:\/\/([^\/:]+)(:\d+)?(\/|$)/) {
Expand Down
11 changes: 5 additions & 6 deletions build/probe_certs.pl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/perl -w

use ExtractCert;
use Xalan;

print "Loading endpoint locations...\n";
open(XML, xalanCall . " -IN ../xml/ukfederation-metadata.xml -XSL extract_cert_locs.xsl|") || die "could not open input file";
open(XML, "xsltproc extract_cert_locs.xsl ../xml/ukfederation-metadata.xml|") || die "could not open input file";
while (<XML>) {
if (/^http:/) {
print "skipping http location: $_";
Expand Down Expand Up @@ -37,7 +36,7 @@
# Remove any old copy of the DER file.
#
unlink $temp_der;

#
# Separate location into host and port.
#
Expand All @@ -58,7 +57,7 @@
$failed{$loc} = 1;
next;
}

#
# Use openssl to convert the certificate to text
#
Expand All @@ -75,7 +74,7 @@
$subject = $1;
}
}

if ($subject eq $issuer) {
$issuer = "(self-signed certificate)";
}
Expand All @@ -101,7 +100,7 @@
print "$n: $issuer\n";
foreach $loc (sort keys %locs) {
print " $loc\n";
}
}
}

#
Expand Down
13 changes: 6 additions & 7 deletions build/probe_nk_certs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use POSIX qw(floor);
use Date::Parse;
use ExtractCert;
use Xalan;

sub error {
my($s) = @_;
Expand All @@ -28,7 +27,7 @@ sub comment {
my $longExpiredDays = 30*3; # about three months

print "Loading endpoint locations...\n";
open(XML, xalanCall . " -IN ../xml/ukfederation-metadata.xml -XSL extract_nk_cert_locs.xsl|") || die "could not open input file";
open(XML, "xsltproc extract_nk_cert_locs.xsl ../xml/ukfederation-metadata.xml|") || die "could not open input file";
while (<XML>) {
my ($entity, $url) = split;
if ($url =~ /^https:\/\/([^\/:]+(:\d+)?)\//) {
Expand Down Expand Up @@ -61,7 +60,7 @@ sub comment {
# Remove any old copy of the DER file.
#
unlink $temp_der;

#
# Separate location into host and port.
#
Expand All @@ -82,7 +81,7 @@ sub comment {
$failed{$loc} = 1;
next;
}

#
# Use openssl to convert the certificate to text
#
Expand Down Expand Up @@ -122,7 +121,7 @@ sub comment {
}
next;
}

if (/Not After : (.*)$/) {
$notAfter = $1;
$notAfterTime = str2time($notAfter);
Expand All @@ -143,7 +142,7 @@ sub comment {
}

}

if ($pubSize < 2048) {
warning("short public key: $pubSize bits, certificate expires $notAfter");
}
Expand Down Expand Up @@ -173,7 +172,7 @@ sub comment {
print "$n: $issuer\n";
foreach $loc (sort keys %locs) {
print " $loc\n";
}
}
}

#
Expand Down
13 changes: 6 additions & 7 deletions build/probe_nk_nocerts.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use POSIX qw(floor);
use Date::Parse;
use ExtractCert;
use Xalan;

sub error {
my($s) = @_;
Expand All @@ -30,7 +29,7 @@ sub comment {
my $longExpiredDays = 30*3; # about three months

print "Loading endpoint locations...\n";
open(XML, xalanCall . " -IN ../xml/ukfederation-metadata.xml -XSL extract_nk_nocert_locs.xsl|") || die "could not open input file";
open(XML, "xsltproc extract_nk_nocert_locs.xsl ../xml/ukfederation-metadata.xml|") || die "could not open input file";
while (<XML>) {
my ($entity, $url) = split;
if ($url =~ /^https:\/\/([^\/:]+(:\d+)?)(\/|$)/) {
Expand Down Expand Up @@ -62,12 +61,12 @@ sub comment {
my $entity = $locations{$loc};
print "$count: probing $entity: $loc\n";
$count--;

#
# Remove any old copy of the DER file.
#
unlink $temp_der;

#
# Separate location into host and port.
#
Expand All @@ -88,7 +87,7 @@ sub comment {
$failed{$loc} = 1;
next;
}

#
# Use openssl to convert the certificate to text
#
Expand Down Expand Up @@ -128,7 +127,7 @@ sub comment {
}
next;
}

if (/Not After : (.*)$/) {
$notAfter = $1;
$notAfterTime = str2time($notAfter);
Expand Down Expand Up @@ -179,7 +178,7 @@ sub comment {
print "$n: $issuer\n";
foreach $loc (sort keys %locs) {
print " $loc\n";
}
}
}

#
Expand Down
11 changes: 5 additions & 6 deletions build/probe_nocerts.pl
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/perl -w

use ExtractCert;
use Xalan;

$known_bad{'census.data-archive.ac.uk:8080'} = 1; # it is really http, not https

print "Loading endpoint locations...\n";
open(XML, xalanCall . " -IN ../xml/ukfederation-metadata.xml -XSL extract_nocert_locs.xsl|") || die "could not open input file";
open(XML, "xsltproc extract_nocert_locs.xsl ../xml/ukfederation-metadata.xml|") || die "could not open input file";
while (<XML>) {
chop;
if (/^http:/) {
Expand Down Expand Up @@ -39,12 +38,12 @@
foreach $loc (sort keys %locations) {
print "$count: probing: $loc\n";
$count--;

#
# Remove any old copy of the DER file.
#
unlink $temp_der;

#
# Separate location into host and port.
#
Expand All @@ -65,7 +64,7 @@
$failed{$loc} = 1;
next;
}

#
# Use openssl to convert the certificate to text
#
Expand Down Expand Up @@ -108,7 +107,7 @@
print "$n: $issuer\n";
foreach $loc (sort keys %locs) {
print " $loc\n";
}
}
}

#
Expand Down
7 changes: 3 additions & 4 deletions build/probe_openssl.pl
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/perl -w

use ExtractCert;
use Xalan;

$known_bad{'census.data-archive.ac.uk:8080'} = 1; # it is really http, not https

print "Loading endpoint locations...\n";
open(XML, xalanCall . " -IN ../xml/ukfederation-metadata.xml -XSL extract_nocert_locs.xsl|") || die "could not open input file";
open(XML, "xsltproc extract_nocert_locs.xsl ../xml/ukfederation-metadata.xml|") || die "could not open input file";
while (<XML>) {
chop;
if (/^http:/) {
Expand Down Expand Up @@ -39,12 +38,12 @@
foreach $loc (sort keys %locations) {
print "$count: probing: $loc\n";
$count--;

#
# Remove any old copy of the DER file.
#
unlink $temp_der;

#
# Separate location into host and port.
#
Expand Down

0 comments on commit 4f74fc5

Please sign in to comment.