From a795f03c486c0d6c32badc9850870f95d8d09059 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 29 Sep 2015 17:21:14 -0700 Subject: improve the sys channel location repair to check key issues and re-installs and/or site moves --- include/zot.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/zot.php') diff --git a/include/zot.php b/include/zot.php index 8e053ed6f..ed0e84775 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3798,6 +3798,9 @@ function zotinfo($arr) { function check_zotinfo($channel,$locations,&$ret) { + +// logger('locations: ' . print_r($locations,true),LOGGER_DATA); + // This function will likely expand as we find more things to detect and fix. // 1. Because magic-auth is reliant on it, ensure that the system channel has a valid hubloc // Force this to be the case if anything is found to be wrong with it. @@ -3808,10 +3811,15 @@ function check_zotinfo($channel,$locations,&$ret) { // the sys channel must have a location (hubloc) $valid_location = false; if((count($locations) === 1) && ($locations[0]['primary']) && (! $locations[0]['deleted'])) { - $valid_location = true; + if((rsa_verify($locations[0]['url'],base64url_decode($locations[0]['url_sig']),$channel['channel_pubkey'])) + && ($locations[0]['sitekey'] === get_config('system','pubkey')) + && ($locations[0]['url'] === z_root())) + $valid_location = true; + else + logger('sys channel: invalid url signature'); } - if((! $locations) || (! $valid_locations)) { + if((! $locations) || (! $valid_location)) { logger('System channel locations are not valid. Attempting repair.'); -- cgit v1.2.3