Compare commits

...

3 Commits

2 changed files with 55 additions and 15 deletions

View File

@ -553,7 +553,7 @@
<license url="https://creativecommons.org/licenses/by/2.5/se/deed.en">CC BY 2.5 Sweden</license>
<feed format="rss" lang="English" type="all" id="saia-en-all">
<curl>
<url>https://www.havkom.se/en/utredningar?categoryId=0&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/en/utredningar?categoryId=0&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -567,7 +567,7 @@
</feed>
<feed format="rss" lang="English" type="road" id="saia-en-road">
<curl>
<url>https://www.havkom.se/en/utredningar?categoryId=203&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/en/utredningar?categoryId=203&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -581,7 +581,7 @@
</feed>
<feed format="rss" lang="English" type="rail" id="saia-en-rail">
<curl>
<url>https://www.havkom.se/en/utredningar?categoryId=204&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/en/utredningar?categoryId=204&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -595,7 +595,7 @@
</feed>
<feed format="rss" lang="English" type="air" id="saia-en-air">
<curl>
<url>https://www.havkom.se/en/utredningar?categoryId=202&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/en/utredningar?categoryId=202&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -609,7 +609,7 @@
</feed>
<feed format="rss" lang="English" type="marine" id="saia-en-marine">
<curl>
<url>https://www.havkom.se/en/utredningar?categoryId=205&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/en/utredningar?categoryId=205&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -623,7 +623,7 @@
</feed>
<feed format="rss" lang="English" type="military" id="saia-en-military">
<curl>
<url>https://www.havkom.se/en/utredningar?categoryId=206&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/en/utredningar?categoryId=206&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -637,7 +637,7 @@
</feed>
<feed format="rss" lang="Swedish" type="all" id="saia-sv-all">
<curl>
<url>https://www.havkom.se/utredningar?categoryId=0&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/utredningar?categoryId=0&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -651,7 +651,7 @@
</feed>
<feed format="rss" lang="Swedish" type="road" id="saia-sv-road">
<curl>
<url>https://www.havkom.se/utredningar?categoryId=203&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/utredningar?categoryId=203&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -665,7 +665,7 @@
</feed>
<feed format="rss" lang="Swedish" type="rail" id="saia-sv-rail">
<curl>
<url>https://www.havkom.se/utredningar?categoryId=204&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/utredningar?categoryId=204&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -679,7 +679,7 @@
</feed>
<feed format="rss" lang="Swedish" type="air" id="saia-sv-air">
<curl>
<url>https://www.havkom.se/utredningar?categoryId=202&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/utredningar?categoryId=202&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -693,7 +693,7 @@
</feed>
<feed format="rss" lang="Swedish" type="marine" id="saia-sv-marine">
<curl>
<url>https://www.havkom.se/utredningar?categoryId=205&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/utredningar?categoryId=205&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -707,7 +707,7 @@
</feed>
<feed format="rss" lang="Swedish" type="military" id="saia-sv-military">
<curl>
<url>https://www.havkom.se/utredningar?categoryId=206&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
<url verify-ssl="false">https://www.havkom.se/utredningar?categoryId=206&amp;onGoingWithReport=1&amp;sortReportDate=1</url>
</curl>
<pup>.investigation .desc</pup>
<jq path="saia.jq">
@ -1203,7 +1203,7 @@
<url>https://www.tlb.gov.hk/aaia/eng/index.html</url>
<feed type="aviation" lang="English" format="rss" id="aaia-en">
<curl>
<url verify-ssl="false">https://www.tlb.gov.hk/aaia/eng/investigation_reports/index.html</url>
<url>https://www.tlb.gov.hk/aaia/eng/investigation_reports/index.html</url>
</curl>
<pup>table tr:not(:first-child)</pup>
<jq path="aaia.jq">
@ -1215,7 +1215,7 @@
</feed>
<feed type="aviation" lang="Simplified Chinese" format="rss" id="aaia-zh-hans">
<curl>
<url verify-ssl="false">https://www.tlb.gov.hk/aaia/sc/investigation_reports/index.html</url>
<url>https://www.tlb.gov.hk/aaia/sc/investigation_reports/index.html</url>
</curl>
<pup>table tr:not(:first-child)</pup>
<jq path="aaia.jq">
@ -1227,7 +1227,7 @@
</feed>
<feed type="aviation" lang="Traditional Chinese" format="rss" id="aaia-zh-hant">
<curl>
<url verify-ssl="false">https://www.tlb.gov.hk/aaia/tc/investigation_reports/index.html</url>
<url>https://www.tlb.gov.hk/aaia/tc/investigation_reports/index.html</url>
</curl>
<pup>table tr:not(:first-child)</pup>
<jq path="aaia.jq">

View File

@ -50,6 +50,12 @@
</xsl:if>
</xsl:template>
<xsl:key
name="ssl-hosts"
match="//itsb:link[@verify-ssl = 'false' or @verify-ssl = '0'] | //itsb:url[@verify-ssl = 'false' or @verify-ssl = '0']"
use="substring-before(substring-after(text(), 'https://'), '/')"
/>
<xsl:template match="/">
<xsl:text><![CDATA[#!/bin/bash
set -o pipefail
@ -81,6 +87,16 @@ if ! command -v json2xml >/dev/null 2>&1; then
fi
]]></xsl:text>
<xsl:apply-templates
select="//itsb:link[@verify-ssl = 'false' or @verify-ssl = '0'][generate-id() = generate-id(key('ssl-hosts', substring-before(substring-after(text(), 'https://'), '/'))[1])]"
mode="check"
/>
<xsl:apply-templates
select="//itsb:url[@verify-ssl = 'false' or @verify-ssl = '0'][generate-id() = generate-id(key('ssl-hosts', substring-before(substring-after(text(), 'https://'), '/'))[1])]"
mode="check"
/>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="//itsb:feed[not(itsb:link)]" />
</xsl:template>
@ -255,6 +271,30 @@ fi
</xsl:text>
</xsl:template>
<xsl:template match="itsb:link[@verify-ssl = 'false' or @verify-ssl = '0'] | itsb:url[@verify-ssl = 'false' or @verify-ssl = '0']" mode="check">
<xsl:variable name="url_host" select="substring-before(substring-after(text(), 'https://'), '/')" />
<xsl:variable name="connect">
<xsl:text>'</xsl:text>
<xsl:call-template name="escape">
<xsl:with-param name="text" select="$url_host" />
</xsl:call-template>
<xsl:if test="not(contains($url_host, ':'))">
<xsl:text>:443</xsl:text>
</xsl:if>
<xsl:text>'</xsl:text>
</xsl:variable>
<xsl:text>log Checking SSL certificate for </xsl:text>
<xsl:value-of select="$connect" />
<xsl:text>
openssl s_client -quiet -no_ign_eof -verify_return_error -connect </xsl:text>
<xsl:value-of select="$connect" />
<xsl:text><![CDATA[ </dev/null >/dev/null 2>/dev/null && echo SSL verification is disabled for ]]></xsl:text>
<xsl:value-of select="$connect" />
<xsl:text>, but it was successful. Consider re-enabling it.
</xsl:text>
</xsl:template>
<xsl:template match="*">
<xsl:message terminate="yes">
<xsl:text>Unmatched element</xsl:text>