-
Notifications
You must be signed in to change notification settings - Fork 891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add dns support #1247
add dns support #1247
Conversation
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Can this DNS option also check CAA policies down the line, or perhaps verify TLS certificate is authorized based on said CAA policy? |
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
yes I think it might be interesting to explore this idea. this could be an additional parameter |
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
@@ -123,4 +136,89 @@ public void nodeAllowlistCheckShouldIgnoreDiscoveryPortParam() throws Exception | |||
"Exception not expected. Validation of nodes in allowlist should ignore the optional discovery port param."); | |||
} | |||
} | |||
|
|||
@Test | |||
public void nodeAllowlistCheckShouldWorkWithHostnameIfDndEnabled() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a typo in this test name? (Dnd
instead of Dns
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch . Changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code and test LGTM.
As it's been just over a month since this PR was raised, any reason for it not being reviewed or preventing merging?
@@ -209,12 +210,15 @@ private LocalPermissioningConfiguration localConfigPermissioningConfiguration() | |||
localConfigNodesPermissioningFile = createTemporaryPermissionsFile(); | |||
} | |||
|
|||
List<String> nodesAsListOfStrings = | |||
final List<String> nodesAsListOfStrings = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; these local variables could be have more succinct names (as we know they are list of strings from typing).
Maybe something like localPermittedNodes
and localPermittedEnodeUrls
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's changed 👍
public void dnsEnabledOptionIsParsedCorrectly() { | ||
TestBesuCommand besuCommand = parseCommand("--Xdns-enabled", "true"); | ||
|
||
assertThat(besuCommand.getEnodeDnsConfiguration().dnsEnabled()).isEqualTo(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; isTrue()
and isFalse()
can be nicer to read then isEqualTo(true)
and isEqualTo(false)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
No It's just that I was working on something else 😄 . I also wanted to take the time to validate my implementation on Azure etc. Thanks for your review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and once you've verified the Azure deployment you mention, feel free to merge 👍
} | ||
|
||
private List<EnodeURL> bootNodes = null; | ||
private final List<String> bootnodes = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be camelCased? bootNodes
? It was before and other places in the edited code retain the camel casing. Whatever it chosen it should be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
public InetAddress getIp() { | ||
this.ip = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is doing a DNS lookup every time the design intent? If not perhaps ip
should be a supplier and this logic gets put in a Suppliers.memoize
call? If it is the design intent it's work a comment so a later refactoring doesn't undo it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's a voluntary choice to DNS lookup every time. Because a cache could give a bad IP before it is invalidated again. If the "dns-update-enabled" flag is false it will do it only once.
we could add a cache but I'm afraid that this will prevent nodes from communicating each other while waiting for the next cache update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added a comment 👍
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
…pport Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
/** | ||
* Get IP of the EnodeURL | ||
* | ||
* <p>If "dns" and "dns-update" are enabled -> DNS lookup every time to have the IP up to date and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <p>If "dns" and "dns-update" are enabled -> DNS lookup every time to have the IP up to date and | |
* <p>If "dns" and "dns-update" are enabled -> DNS lookup every time to have the IP up to date and |
* <p>If "dns" and "dns-update" are enabled -> DNS lookup every time to have the IP up to date and | ||
* not to rely on an invalid cache | ||
* | ||
* <p>If the "dns" is enabled but "dns-update" is disabled -> IP is retrieved only one time and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <p>If the "dns" is enabled but "dns-update" is disabled -> IP is retrieved only one time and | |
* <p>If the "dns" is enabled but "dns-update" is disabled -> IP is retrieved only one time and |
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM karim.t2am@gmail.com
PR description
This PR add the support to DNS. By default Besu refuses the use of a DNS but it is possible to use it by adding the following flag
--Xdns-enabled=true
. Adding this flag will resolve the hostname when starting besu and then it won't changeIf there is a need for a more dynamic update (eg for permissioning) add also this flag
--Xdns-update-enabled = true
( this will query the DNS every time. So you must trust the DNS on which you are looking for the IP)Test performed