Skip to content
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

fix(server): change the arthas bind ip #2429

Closed
wants to merge 9 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public static synchronized ServerOptions instance() {
"arthas.ip",
"The IP provided by Arthas, it can be accessible from the outside.",
disallowEmpty(),
"0.0.0.0"
"127.0.0.1"
Copy link
Member

@imbajin imbajin Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any context for it (change the IP to localhost)?

Copy link
Contributor Author

@SunnyBoy-WYH SunnyBoy-WYH Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the context you can see the introduction about this issue. i think 0.0.0.0 means any ip, and arthas will set default password, sometime the ci failed.

why prefer localhost not 127.0.0.1? the config item provided by arthas named 'arthas.ip',im not sure localhost as a domain will work.

);

public static final ConfigOption<String> ARTHAS_DISABLED_COMMANDS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ batch.max_write_threads=0
# configuration of arthas
arthas.telnet_port=8562
arthas.http_port=8561
arthas.ip=0.0.0.0
arthas.ip=127.0.0.1
arthas.disabled_commands=jad

# authentication configs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,9 @@ public void testArthasApi() {
" \"command\": \"version\"\n" +
"}";
RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL, false);
// If the request header contains basic auth,
// and if we are not set auth when arthas attach hg, arthas will auth it and return 401.
// ref:https://arthas.aliyun.com/en/doc/auth.html#configure-username-and-password
Response r = arthasApiClient.post(ARTHAS_API_PATH, body);
String result = assertResponseStatus(200, r);
assertJsonContains(result, "state");
assertJsonContains(result, "body");

RestClient arthasApiClientWithAuth = new RestClient(ARTHAS_API_BASE_URL);
r = arthasApiClientWithAuth.post(ARTHAS_API_PATH, body);
assertResponseStatus(401, r);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some exception cases for invalid requests

Copy link
Contributor Author

@SunnyBoy-WYH SunnyBoy-WYH Mar 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we will do later

}
}
Loading