diff options
author | Leif Johansson <leifj@sunet.se> | 2010-12-14 13:05:46 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2010-12-14 13:05:46 +0100 |
commit | 67d03db1de44d1a281b1efac89918a263db14539 (patch) | |
tree | 8efca950094c0396f55b182908740c6e2855f6b8 /scripts/pull-and-verify.sh | |
parent | f610a5696357cc4235c430f684ee992a242e6922 (diff) |
basic aggregator
Diffstat (limited to 'scripts/pull-and-verify.sh')
-rwxr-xr-x | scripts/pull-and-verify.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/pull-and-verify.sh b/scripts/pull-and-verify.sh new file mode 100755 index 00000000..3035126e --- /dev/null +++ b/scripts/pull-and-verify.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +function die() { + echo $* + exit 1 +} + +URL=$1 +CERT=$2 +DIR=$3 + +TMPF=`mktemp` +wget --no-check-certificate -O$TMPF $URL || die "Unable to download $URL: $?" +samlsign -c $CERT -f $TMPF || die "Unable to verify $URL with $CERT: $?" +TMPD=`mktemp -d` +xsltproc --stringparam output $TMPD xslt/import-metadata.xsl $TMPF || die "Unable to import metadata from $URL: $?" +rsync -avz $TMPD/ $DIR +( +echo '?xml version="1.0"?>' +echo "<EntitiesDescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" xmlns:xi=\"http://www.w3.org/2001/XInclude\" Name=\"http://md.swamid.se/md/$3.xml\">" +for md in $3/*.xml; do + echo "<xi:include href=\"$md\"/>" +done +echo "</EntitiesDescriptor>" +) > $3.mxml +rm -rf $TMPF $TMPD |