From 3a18a8acb4f670458424753178bbeb94280de1d2 Mon Sep 17 00:00:00 2001 From: mbthiery Date: Wed, 17 Aug 2022 21:49:47 -0400 Subject: [PATCH 1/4] Add default hotspot denylist --- src/poc/miner_poc_denylist.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/poc/miner_poc_denylist.erl b/src/poc/miner_poc_denylist.erl index 9f3185b4b..849d9012c 100644 --- a/src/poc/miner_poc_denylist.erl +++ b/src/poc/miner_poc_denylist.erl @@ -18,8 +18,10 @@ start_link() -> case application:get_env(miner, denylist_keys, undefined) of DenyKeys = [H|_] when is_list(H) -> case application:get_env(miner, denylist_url, undefined) of - undefined -> + "none" -> ignore; + undefined -> + gen_server:start_link({local, ?MODULE}, ?MODULE, [github_release, "https://api.github.com/repos/helium/denylist/releases/latest", DenyKeys], []); DenyURL -> Type = application:get_env(miner, denylist_type, github_release), gen_server:start_link({local, ?MODULE}, ?MODULE, [Type, DenyURL, DenyKeys], []) From 283972c809d0c06801c62983f8c30573a295ca02 Mon Sep 17 00:00:00 2001 From: mbthiery Date: Thu, 18 Aug 2022 21:09:13 -0400 Subject: [PATCH 2/4] handle undefined denykeys --- src/poc/miner_poc_denylist.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/poc/miner_poc_denylist.erl b/src/poc/miner_poc_denylist.erl index 849d9012c..536ae606b 100644 --- a/src/poc/miner_poc_denylist.erl +++ b/src/poc/miner_poc_denylist.erl @@ -26,8 +26,10 @@ start_link() -> Type = application:get_env(miner, denylist_type, github_release), gen_server:start_link({local, ?MODULE}, ?MODULE, [Type, DenyURL, DenyKeys], []) end; - undefined -> + "none" -> ignore; + undefined -> + gen_server:start_link({local, ?MODULE}, ?MODULE, [github_release, "https://api.github.com/repos/helium/denylist/releases/latest", []], []); Other -> lager:warning("unhandled denylist_keys format ~p", [Other]), ignore From e0a90a897602f1cfe9c4b6ba7b780acf3cd0dcd1 Mon Sep 17 00:00:00 2001 From: mbthiery Date: Tue, 4 Oct 2022 17:05:28 -0400 Subject: [PATCH 3/4] Move Denylist change to miner.app.src env --- src/miner.app.src | 12 +++++++++++- src/poc/miner_poc_denylist.erl | 8 ++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/miner.app.src b/src/miner.app.src index 38844f0b2..cfc40c66f 100644 --- a/src/miner.app.src +++ b/src/miner.app.src @@ -36,7 +36,17 @@ grpc_client ]}, {included_applications, [blockchain, sibyl]}, - {env,[]}, + {env, + [ + {miner, + [ + {denylist_keys, ["1SbEYKju337P6aYsRd9DT2k4qgK5ZK62kXbSvnJgqeaxK3hqQrYURZjL"]}, + {denylist_type, github_release}, + {denylist_url, "https://api.github.com/repos/helium/denylist/releases/latest"} + ] + } + ] + }, {modules, []}, {maintainers, ["Helium"]}, diff --git a/src/poc/miner_poc_denylist.erl b/src/poc/miner_poc_denylist.erl index 13c61b5de..e7fe77064 100644 --- a/src/poc/miner_poc_denylist.erl +++ b/src/poc/miner_poc_denylist.erl @@ -18,18 +18,14 @@ start_link() -> case application:get_env(miner, denylist_keys, undefined) of DenyKeys = [H|_] when is_list(H) -> case application:get_env(miner, denylist_url, undefined) of - "none" -> - ignore; undefined -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [github_release, "https://api.github.com/repos/helium/denylist/releases/latest", DenyKeys], []); + ignore; DenyURL -> Type = application:get_env(miner, denylist_type, github_release), gen_server:start_link({local, ?MODULE}, ?MODULE, [Type, DenyURL, DenyKeys], []) end; - "none" -> - ignore; undefined -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [github_release, "https://api.github.com/repos/helium/denylist/releases/latest", []], []); + ignore; Other -> lager:warning("unhandled denylist_keys format ~p", [Other]), ignore From 4fefff792e759096daee1308a0a87b45ebc4b4f7 Mon Sep 17 00:00:00 2001 From: mbthiery Date: Sun, 9 Oct 2022 13:35:10 -0400 Subject: [PATCH 4/4] Add comments about denylist --- config/sys.config | 1 + src/miner.app.src | 1 + 2 files changed, 2 insertions(+) diff --git a/config/sys.config b/config/sys.config index 7a8d20554..b6f88d436 100644 --- a/config/sys.config +++ b/config/sys.config @@ -101,6 +101,7 @@ ]}, {miner, [ + %% Change these variables to override the default denylist values. {denylist_keys, ["1SbEYKju337P6aYsRd9DT2k4qgK5ZK62kXbSvnJgqeaxK3hqQrYURZjL"]}, {denylist_type, github_release}, {denylist_url, "https://api.github.com/repos/helium/denylist/releases/latest"}, diff --git a/src/miner.app.src b/src/miner.app.src index cfc40c66f..dda3940d3 100644 --- a/src/miner.app.src +++ b/src/miner.app.src @@ -38,6 +38,7 @@ {included_applications, [blockchain, sibyl]}, {env, [ + %% This section provides a default denylist configuration. Load custom denylist configuration by overriding values in sys.config.src {miner, [ {denylist_keys, ["1SbEYKju337P6aYsRd9DT2k4qgK5ZK62kXbSvnJgqeaxK3hqQrYURZjL"]},