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

getaddrinfo calls with a service name fail on Docker images that lack /etc/services #623

Closed
danports opened this issue Mar 28, 2019 · 9 comments

Comments

@danports
Copy link

Certain Docker images (like mcr.microsoft.com/dotnet/core/runtime-deps:*-bionic/*-stretch-slim, based on Ubuntu/Debian) do not bundle /etc/services, which causes getaddrinfo calls with a service name to fail. I see only one place in this library where a service name is passed to getaddrinfo:
https://github.com/Microsoft/omi/blob/5a2a017f48f616b209d72316bfc8a701ce089a7a/Unix/http/httpclientauth.c#L2565

On affected Docker images, this problem results in authentication failing with a misleading MI_RESULT_ACCESS_DENIED error, and various downstream issues (e.g. you can't use the PowerShell SDK in a Linux .NET Core container running one of the official images listed above to connect to a Windows machine via WSMan).

danports added a commit to danports/dotnet-runtime-powershell that referenced this issue Mar 28, 2019
@JumpingYang001
Copy link
Contributor

@danports any suggestion about how to fix it?

@JumpingYang001
Copy link
Contributor

@danports in fact, omi don't officially support PowerShell now, so I think we might not fix it ...

@danports
Copy link
Author

danports commented Apr 1, 2019

To be clear, this is a problem in this library, not in PowerShell. I am definitely not an expert in this area and haven't tested this, but from what I've read, it should be possible to fix this by passing a string containing a port number (e.g. "80") to getaddrinfo rather than "http".

@JumpingYang001
Copy link
Contributor

80 is a fixed number, I don't think it is a good solution.

@danports
Copy link
Author

danports commented Apr 4, 2019

True, 80 is a fixed number, but what is the risk of the HTTP port changing? Furthermore, it doesn't look like the port passed into the call even matters - the code only uses the ai_canonname field of the addrinfo struct. It doesn't pass the addrinfo struct to connect, so the port number is irrelevant. "http" could be changed to any valid port number passed as a string.

@JumpingYang001
Copy link
Contributor

won't fix.

@danports
Copy link
Author

danports commented May 1, 2019

I am very puzzled by your decision to leave this bug unaddressed, especially considering the workaround is so simple. But the decision is yours to make, and I will respect that.

@JumpingYang001
Copy link
Contributor

@danports you can new a PR to fix it as PowerShell is not in our scope now.

danports added a commit to danports/omi that referenced this issue May 7, 2019
@danports
Copy link
Author

danports commented May 7, 2019

Alright, I opened #631. Just to clarify, this is an issue in this library whether it is used in the PowerShell stack or not.

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

No branches or pull requests

2 participants