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

Clarify localhost usage in security documentation #9338

Closed
mx-psi opened this issue Jan 22, 2024 · 6 comments
Closed

Clarify localhost usage in security documentation #9338

mx-psi opened this issue Jan 22, 2024 · 6 comments
Labels
area:documentation good first issue Good for newcomers help wanted Good issue for contributors to OpenTelemetry Service to pick up

Comments

@mx-psi
Copy link
Member

mx-psi commented Jan 22, 2024

          Hi, just wanted to suggest that you have somewhere in the docs a warning about the case where `localhost` gets resolved via DNS to some real address and things go very weird.  This has happened enough times to me that I reflexively type `127.0.0.1` instead, but I recognize that ipv6 is a thing.

Originally posted by @bboreham in #8510 (comment)

@TylerHelmuth TylerHelmuth added help wanted Good issue for contributors to OpenTelemetry Service to pick up good first issue Good for newcomers priority:p2 Medium area:documentation and removed priority:p2 Medium labels Jan 22, 2024
@professorabhay
Copy link

Hey, Take a look to that!

Warning: DNS Resolution for 'localhost'

When configuring security settings or specifying network endpoints, it's common to use the hostname 'localhost' to refer to the loopback interface (IPv4 address 127.0.0.1). However, it's crucial to be aware that in some network configurations, 'localhost' may be subject to DNS resolution, leading to unexpected behavior.

In situations where 'localhost' is resolved to an actual IP address other than the loopback interface, security risks may arise. This can result in unintended exposure of services or data to external networks.

To mitigate this risk, consider using the explicit loopback IP addresses:
- IPv4: 127.0.0.1
- IPv6: ::1

Additionally, if IPv6 is in use, ensure that your applications and security configurations support both IPv4 and IPv6 loopback addresses to avoid any compatibility issues.

For added clarity and consistency, it is advisable to explicitly specify the loopback IP address instead of relying solely on the 'localhost' hostname, especially in security-critical configurations. This practice helps ensure that your applications behave predictably across different network environments.

@mx-psi
Copy link
Member Author

mx-psi commented Jan 23, 2024

@professorabhay
Copy link

Sure @mx-psi!
Are there any changes you want to see?

@mx-psi
Copy link
Member Author

mx-psi commented Jan 23, 2024

We can discuss in the PR itself, it's easier to make comments there

@Sanket-0510
Copy link
Contributor

Hey @mx-psi this is open from a week without any PR, I would like to address this one. I believe we can address this in more simple and precise language for users to understand. I would like to raise PR for the same.


When setting up security or specifying network locations, people often use 'localhost.' Be cautious! In some setups, 'localhost' might undergo DNS resolution and end up with an unexpected IP, risking security.

Risk Alert:
If 'localhost' resolves to a different IP due to DNS, your data might accidentally leak outside.

How to Stay Safe:
Always use these IPs instead:

IPv4: 127.0.0.1
IPv6: ::1
IPv6 Reminder:
If you're using IPv6, make sure your system supports both IPv4 and IPv6 loopback addresses to avoid issues.

Top Tip:
For clarity and safety, directly mention the IP (127.0.0.1) instead of relying only on 'localhost,' especially in sensitive setups. Keep things consistent across different networks.

mx-psi added a commit that referenced this issue Mar 6, 2024
…9444)

**Description:** <Describe what has changed.>
warning and alert for using localhost which might go under DNS
resolution and end up with an unexpected IP, risking security.

**Link to tracking Issue:** #9338 

**Documentation:** Added Waring and risk alert in
https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/security-best-practices.md

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
@mx-psi
Copy link
Member Author

mx-psi commented Mar 13, 2024

Fixed by #9444

@mx-psi mx-psi closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:documentation good first issue Good for newcomers help wanted Good issue for contributors to OpenTelemetry Service to pick up
Projects
None yet
Development

No branches or pull requests

4 participants