From 72d40f13a40bc23e86cd163053547ea779ab1c06 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 22 Feb 2017 09:07:24 +0000 Subject: [PATCH 1/5] updates: use HTTP, not HTTPS The files are hashed and the hashes signed --- src/common/updates.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/updates.cpp b/src/common/updates.cpp index c84566f5..2140aeaa 100644 --- a/src/common/updates.cpp +++ b/src/common/updates.cpp @@ -96,7 +96,7 @@ namespace tools std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version) { - static const char base[] = "https://updates.getmonero.org/"; + static const char base[] = "http://updates.getmonero.org/"; #ifdef _WIN32 static const char extension[] = ".zip"; #else From 6a5dfb88d2135b02898fec1a31bd47cd076f77ec Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 22 Feb 2017 10:28:01 +0000 Subject: [PATCH 2/5] updates: add all update servers --- src/common/updates.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/updates.cpp b/src/common/updates.cpp index 2140aeaa..6e200144 100644 --- a/src/common/updates.cpp +++ b/src/common/updates.cpp @@ -44,6 +44,10 @@ namespace tools // All four MoneroPulse domains have DNSSEC on and valid static const std::vector dns_urls = { + "updates.moneropulse.org", + "updates.moneropulse.net", + "updates.moneropulse.co", + "updates.moneropulse.se" }; static const std::vector testnet_dns_urls = { "testver.moneropulse.net" From 9f17b1a30f5e774520438ca45dd21090663a6d09 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 22 Feb 2017 10:28:24 +0000 Subject: [PATCH 3/5] updates: s/monerod/monero/ for the main download Also print download success message as global log --- src/cryptonote_core/cryptonote_core.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index c96389ac..a6b62f2f 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1088,7 +1088,7 @@ namespace cryptonote //----------------------------------------------------------------------------------------------- bool core::check_updates() { - static const char software[] = "monerod"; + static const char software[] = "monero"; static const char subdir[] = "cli"; // because it can never be simple #ifdef BUILD_TAG static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG); @@ -1141,7 +1141,7 @@ namespace cryptonote MCERROR("updates", "Download from " << url << " does not match the expected hash"); return false; } - MCINFO("updates", "New version downloaded to " << path); + MGINFO("New version downloaded to " << path); } else { From 822577eb422276bb5ec01adfc9cf705bb7c22b46 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 22 Feb 2017 11:11:45 +0000 Subject: [PATCH 4/5] updates: we now have a user URL, and an automatic one So the user can use https, while the automatic does not have to --- src/common/updates.cpp | 4 ++-- src/common/updates.h | 2 +- src/cryptonote_core/cryptonote_core.cpp | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/updates.cpp b/src/common/updates.cpp index 6e200144..3fa985e2 100644 --- a/src/common/updates.cpp +++ b/src/common/updates.cpp @@ -98,9 +98,9 @@ namespace tools return found; } - std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version) + std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user) { - static const char base[] = "http://updates.getmonero.org/"; + static const char *base = user ? "https://downloads.getmonero.org/" : "http://updates.getmonero.org/"; #ifdef _WIN32 static const char extension[] = ".zip"; #else diff --git a/src/common/updates.h b/src/common/updates.h index 1a70e06f..d84b612d 100644 --- a/src/common/updates.h +++ b/src/common/updates.h @@ -33,5 +33,5 @@ namespace tools { bool check_updates(const std::string &software, const std::string &buildtag, bool bestnet, std::string &version, std::string &hash); - std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version); + std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user); } diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index a6b62f2f..470c1feb 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1107,12 +1107,13 @@ namespace cryptonote if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0) return true; - std::string url = tools::get_update_url(software, subdir, buildtag, version); + std::string url = tools::get_update_url(software, subdir, buildtag, version, true); MGINFO("Version " << version << " of " << software << " for " << buildtag << " is available: " << url << ", SHA256 hash " << hash); if (check_updates_level == UPDATES_NOTIFY) return true; + url = tools::get_update_url(software, subdir, buildtag, version, false); std::string filename; const char *slash = strrchr(url.c_str(), '/'); if (slash) From 5901331669f7508362a1f8bd3603b344b5a8a0db Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 22 Feb 2017 11:19:20 +0000 Subject: [PATCH 5/5] updates: remove testnet case It need not be any different --- src/common/updates.cpp | 7 ++----- src/common/updates.h | 2 +- src/cryptonote_core/cryptonote_core.cpp | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/common/updates.cpp b/src/common/updates.cpp index 3fa985e2..8878bb06 100644 --- a/src/common/updates.cpp +++ b/src/common/updates.cpp @@ -35,7 +35,7 @@ namespace tools { - bool check_updates(const std::string &software, const std::string &buildtag, bool testnet, std::string &version, std::string &hash) + bool check_updates(const std::string &software, const std::string &buildtag, std::string &version, std::string &hash) { std::vector records; bool found = false; @@ -50,10 +50,7 @@ namespace tools "updates.moneropulse.se" }; - static const std::vector testnet_dns_urls = { "testver.moneropulse.net" - }; - - if (!tools::dns_utils::load_txt_records_from_dns(records, testnet ? testnet_dns_urls : dns_urls)) + if (!tools::dns_utils::load_txt_records_from_dns(records, dns_urls)) return false; for (const auto& record : records) diff --git a/src/common/updates.h b/src/common/updates.h index d84b612d..e494ed7a 100644 --- a/src/common/updates.h +++ b/src/common/updates.h @@ -32,6 +32,6 @@ namespace tools { - bool check_updates(const std::string &software, const std::string &buildtag, bool bestnet, std::string &version, std::string &hash); + bool check_updates(const std::string &software, const std::string &buildtag, std::string &version, std::string &hash); std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user); } diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 470c1feb..98c53890 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1101,7 +1101,7 @@ namespace cryptonote std::string version, hash; MCDEBUG("updates", "Checking for a new " << software << " version for " << buildtag); - if (!tools::check_updates(software, buildtag, m_testnet, version, hash)) + if (!tools::check_updates(software, buildtag, version, hash)) return false; if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0)