Skip to content

Update EC2MetadataUtilServer to only accept localhost address #403

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

Merged
merged 1 commit into from
Jan 30, 2018

Conversation

zoewangg
Copy link
Contributor

Update EC2MetadataUtilServer to only accept localhost address

throws UnknownHostException, IOException {
server = new ServerSocket(port, 1, InetAddress.getByName(address));
server = new ServerSocket(port, 1, InetAddress.getByName("localhost"));
Copy link
Contributor

Choose a reason for hiding this comment

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

should we connect directly to 127.0.0.1 instead so there's no lookup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup! updated

Copy link
Contributor

Choose a reason for hiding this comment

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

Apprently getLocalHost() is actually kinda misleading and doesn't return the address of localhost: https://stackoverflow.com/a/18488982

Looking at it again, I think what you had originally is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, actually, InetAddress.getLoopbackAddress() is what we want.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 nice

@zoewangg zoewangg force-pushed the UpdateEC2MetadataUtilsServer branch 2 times, most recently from a21203b to 14e1351 Compare January 30, 2018 01:44
@zoewangg zoewangg force-pushed the UpdateEC2MetadataUtilsServer branch from 14e1351 to 0407f3d Compare January 30, 2018 17:34
@zoewangg zoewangg merged commit c1cedcb into aws:master Jan 30, 2018
@zoewangg zoewangg deleted the UpdateEC2MetadataUtilsServer branch January 30, 2018 18:52
aws-sdk-java-automation pushed a commit that referenced this pull request Feb 7, 2019
…59713989

Pull request: release <- staging/50a2295d-2367-4909-b2ae-ab1759713989
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants