From 91b6eba0f7c4fd44dd79f0e868bb9e7a92bccce7 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 31 Dec 2019 16:20:14 +1000 Subject: Add Redirects tests fully. --- apt-panopticommon.lua | 14 ++++++++++---- apt-panopticon-report-email-web.lua | 7 +++++-- apt-panopticon.lua | 4 ++-- explanations.html | 6 ++++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index ca952d3..c03f817 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -4,7 +4,7 @@ local APT = {} APT.rrd = require 'rrd' APT.protocols = {"ftp", "http", "https", "rsync"} -APT.tests = {'raw', 'Integrity', 'Protocol', 'Updated', 'URLSanity', 'Speed'} +APT.tests = {'raw', 'Integrity', 'Protocol', 'Redirects', 'Updated', 'URLSanity', 'Speed'} APT.releases = {"jessie", "ascii", "beowulf", "ceres"} APT.subRels = {'backports', 'proposed-updates', 'security', 'updates'} APT.notExist = @@ -65,6 +65,7 @@ APT.options = -- "rsync", "DNSRR", "Protocol", + "Redirects", "URLSanity", "Integrity", "Updated", @@ -697,6 +698,9 @@ local DSIt = 'DS:IntegrityTimeouts:GAUGE:' .. hb .. ':0:U' local DSPe = 'DS:ProtocolErrors:GAUGE:' .. hb .. ':0:U' local DSPw = 'DS:ProtocolWarnings:GAUGE:' .. hb .. ':0:U' local DSPt = 'DS:ProtocolTimeouts:GAUGE:' .. hb .. ':0:U' +local DSRe = 'DS:RedirectsErrors:GAUGE:' .. hb .. ':0:U' +local DSRw = 'DS:RedirectsWarnings:GAUGE:' .. hb .. ':0:U' +local DSRt = 'DS:RedirectsTimeouts:GAUGE:' .. hb .. ':0:U' local DSUe = 'DS:UpdatedErrors:GAUGE:' .. hb .. ':0:U' local DSUw = 'DS:UpdatedWarnings:GAUGE:' .. hb .. ':0:U' local DSUt = 'DS:UpdatedTimeouts:GAUGE:' .. hb .. ':0:U' @@ -735,10 +739,11 @@ APT.createRRD = function(host, ip, o) os.execute( 'mkdir -p rrd/' .. host .. '/' .. p:upper()) if not APT.checkFile('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') then D('Creating ' .. 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd') - APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', '--start', start, '--step', step, DSIe, DSIw, DSIt, DSPe, DSPw, DSPt, DSUe, DSUw, DSUt, DSSe, DSSw, DSSt, + APT.rrd.create( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', '--start', start, '--step', step, + DSIe, DSIw, DSIt, DSPe, DSPw, DSPt, DSRe, DSRw, DSRt, DSUe, DSUw, DSUt, DSSe, DSSw, DSSt, RRAc0, RRAc1, RRAc2, RRAl0, RRAc3, RRAc4, RRAc5, RRAl1, RRAc6, RRAc7, RRAc8, RRAl2, RRAc9, RRAc10, RRAc11, RRAl3, RRAc12, RRAc13, RRAc14, RRAl4) -- Start them at 0 so the average has something to work on. - APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', (APT.now - 600) .. ':0:0:0:0:0:0:0:0:0:0:0:0') + APT.rrd.update( 'rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', (APT.now - 600) .. ':0:0:0:0:0:0:0:0:0:0:0:0:0:0:0') end end os.execute( 'mkdir -p rrd/' .. host .. '/Speed') @@ -757,10 +762,11 @@ APT.updateRRD = function(results, host, ip) APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':' .. results[p]['Integrity'].errors .. ':' .. results[p]['Integrity'].warnings .. ':' .. results[p]['Integrity'].timeouts .. ':' .. results[p]['Protocol'].errors .. ':' .. results[p]['Protocol'].warnings .. ':' .. results[p]['Protocol'].timeouts .. ':' .. + results[p]['Redirects'].errors .. ':' .. results[p]['Redirects'].warnings .. ':' .. results[p]['Redirects'].timeouts .. ':' .. results[p]['Updated'].errors .. ':' .. results[p]['Updated'].warnings .. ':' .. results[p]['Updated'].timeouts .. ':' .. results[p]['URLSanity'].errors .. ':' .. results[p]['URLSanity'].warnings .. ':' .. results[p]['URLSanity'].timeouts) else - APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':U:U:U:U:U:U:U:U:U:U:U:U') + APT.rrd.update('rrd/' .. host .. '/' .. p:upper() .. '/Tests.rrd', APT.now .. ':U:U:U:U:U:U:U:U:U:U:U:U:U:U:U') end end if nil ~= results.speed then diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 05699ee..3365d78 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua @@ -212,7 +212,8 @@ end local makeTable = function(web, hosts) web:write("\n" .. - "" .. + "" .. "" .. "\n") local bg = '' @@ -234,6 +235,7 @@ local makeTable = function(web, hosts) local protocol = status(hosts, k, results, "Protocol") local sanity = status(hosts, k, results, "URLSanity") local integrity = status(hosts, k, results, "Integrity") + local redirects = status(hosts, k, results, "Redirects") local updated = status(hosts, k, results, "Updated") local rate = v.Rate local min = tonumber(results.speed.min) @@ -295,7 +297,7 @@ local makeTable = function(web, hosts) end web:write("" .. '" .. ' ' .. spd .. " " .. week .." \n") if "" ~= active then web:write("\n") @@ -361,6 +363,7 @@ if nil == email then C("opening mirrors file - " .. e) else local rsync = "[skip]" local dns = DNSrrTest(APT.mirrors, k) local protocol = status(APT.mirrors, k, results, "Protocol") + local redirects = status(APT.mirrors, k, results, "Redirects") local sanity = status(APT.mirrors, k, results, "URLSanity") local integrity = status(APT.mirrors, k, results, "Integrity") local updated = status(APT.mirrors, k, results, "Updated") diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 43eeccf..2237232 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -345,7 +345,7 @@ checkHEAD = function (host, URL, r, retry, sanity) if nil ~= location then pu = url.parse(location, defaultURL) if (pu.host == APT.options.roundRobin.value) and (nil ~= PU.path:find('merged/pool/DEVUAN/')) then - E('DEVUAN packages must not be redirected to ' .. APT.options.roundRobin.value .. ' - ' .. APT.lnk(URL) .. arw .. APT.lnk(location), PU.scheme, sanity, host) + E('DEVUAN packages must not be redirected to ' .. APT.options.roundRobin.value .. ' - ' .. APT.lnk(URL) .. arw .. APT.lnk(location), PU.scheme, 'Redirects', host) end if ('http' == location:sub(1, 4)) and (pu.scheme ~= PU.scheme) then -- Sometimes a location sans scheme is returned, this is not a protocol change. if APT.testing("Protocol") then @@ -393,7 +393,7 @@ checkHEAD = function (host, URL, r, retry, sanity) end end elseif nil ~= PU.path:find('merged/pool/DEBIAN-SECURITY/') then - W('DEBIAN-SECURITY packages must be redirected to a Debian mirror - ' .. APT.lnk(URL) .. arw .. APT.lnk(location), PU.scheme, sanity, host) + W('DEBIAN-SECURITY packages must be redirected to a Debian mirror - ' .. APT.lnk(URL) .. arw .. APT.lnk(location), PU.scheme, 'Redirects', host) end end end diff --git a/explanations.html b/explanations.html index f4d11fa..7e2878d 100644 --- a/explanations.html +++ b/explanations.html @@ -41,6 +41,12 @@ The validity of the HTTPS certificate for each server is tested as well. The IPs are linked to the log for that specific IP when used via the DNS round robin, and is followed by the number of errors, warnings, or timeouts of any.

+

Redirect tests

+

Mirrors that redirect /DEVUAN/ back out to deb.devuan.org is an ERROR.   +/DEBIAN-SECURITY/ packages must be redirected to a Debian mirror, specifically a mirror hosting Debian security updates.   +However, some Devuan mirrors might also be Debian mirrors, so this is just a WARNING. +

+

Protocol tests

The Protocol test will give a warning if the protocol is changed during a redirect, HTTP -> HTTPS for example.   While apt HTTPS transport is now the default in Beowulf / Buster, not everyone with an older release will have that installed, -- cgit v1.1

" .. lnk('FTP') .. "" .. lnk('HTTP') .. "" .. lnk('HTTPS') .. "" .. lnk('RSYNC') .. "" .. lnk('DNS round robin', 'DNS-RR') .. "" .. lnk('Protocol') .. "" .. lnk('URL sanity', 'URL-Sanity') .. "" .. lnk('Integrity') .. "" .. lnk('DNS round robin', 'DNS-RR') .. "" .. lnk('Protocol') .. "" .. lnk('Redirects') .. + "" .. lnk('URL sanity', 'URL-Sanity') .. "" .. lnk('Integrity') .. "" .. lnk('Updated') .. "" .. lnk('Speed range', 'Speed') .. "" .. lnk('Weekly statistics', 'Weekly') .. "" .. lnk('Graphs') .. "
" .. ftp .. " " .. http .. " " .. https .. " " .. rsync .. " " .. dns .. - " " .. protocol .. " " .. sanity .. " " .. integrity .. " ' .. rate .. + " " .. protocol .. " " .. redirects .. " " .. sanity .. " " .. integrity .. " ' .. rate .. '' .. updated .. '" .. graph .. "
" .. active .. "