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

[BUG] externally hosted model can not have a private ip address #2142

Closed
JohnUiterwyk opened this issue Feb 20, 2024 · 19 comments · Fixed by #2534
Closed

[BUG] externally hosted model can not have a private ip address #2142

JohnUiterwyk opened this issue Feb 20, 2024 · 19 comments · Fixed by #2534
Assignees
Labels
enhancement New feature or request v2.15.0

Comments

@JohnUiterwyk
Copy link

I have use case as well that involves using an "externally hosted model" that is self hosted and located within a private network (or more simply another use cases is if i'm using an api gateway that has a private ip address ), however it seems there is a hard coded requirement that externally hosted models can not have a private ip address:

protected static InetAddress[] validateIp(String hostName) throws UnknownHostException {
InetAddress[] addresses = InetAddress.getAllByName(hostName);
if (hasPrivateIpAddress(addresses)) {
log.error("Remote inference host name has private ip address: " + hostName);
throw new IllegalArgumentException(hostName);
}
return addresses;
}

This seems like an arbitrary restriction, which i think should either be removed or only used when a config flag is provided.

@JohnUiterwyk JohnUiterwyk added bug Something isn't working untriaged labels Feb 20, 2024
@JohnUiterwyk JohnUiterwyk changed the title [BUG] [BUG] externally hosted model can not have a private ip address Feb 20, 2024
@Zhangxunmt
Copy link
Collaborator

Need to verify with security guardians.

@Zhangxunmt Zhangxunmt self-assigned this Feb 27, 2024
@ylwu-amzn ylwu-amzn assigned dhrubo-os and unassigned Zhangxunmt Feb 28, 2024
@dhrubo-os dhrubo-os added enhancement New feature or request and removed bug Something isn't working labels Feb 28, 2024
@dhrubo-os
Copy link
Collaborator

@JohnUiterwyk Thank you for raising this issue. I have removed the bug label, as blocking any private IP addresses was a deliberate choice made after discussions with our security engineers. However, since there is now a request from the community, we will consult with our security engineers to explore how we can accommodate this for our community.

@JohnUiterwyk
Copy link
Author

Thanks @dhrubo-os . My motivation raising the issue to enable private ip addresses is specifically driven by security and data control considerations.

@JohnUiterwyk
Copy link
Author

hi @dhrubo-os, i was wondering if there is any progress on this. i would love to see this included in 2.13 as it looks like a very small change; This private ip restriction is currently a blocker in certain enterprise environments for using some of the amazing capabilities available via the ml-commons open search plugin. Thanks for your effort and attention on this.

@dhrubo-os
Copy link
Collaborator

Hi @JohnUiterwyk , sorry for the late response. I think 2.13 will be bit tight as we are still in conversation with the security team. But we can definitely target for 2.14. Thanks.

@mingshl mingshl moved this to In Progress in ml-commons projects Mar 12, 2024
@JohnUiterwyk
Copy link
Author

thanks @dhrubo-os, great to hear there is progress on this! Also just wanted to say thanks for all you and your teams hard work. This project is incredibly valuable and having a huge impact!

@whittssg
Copy link

whittssg commented May 1, 2024

Did this get updated yet? I was researching this error for a while (while trying to configure a local llm connector):

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "localhost"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "localhost"
  },
  "status": 400
}

and finally tied that response with this issue.

Thanks,

@ylwu-amzn
Copy link
Collaborator

@whittssg The private local ip blocked now for security concern (to block creating connector to bypass security layer to call your local service directly) https://github.com/opensearch-project/ml-commons/blob/main/ml-algorithms/src/main/java/org/opensearch/ml/engine/httpclient/MLHttpClientFactory.java#L76

Will consult with security guys first.

@faileon
Copy link

faileon commented May 12, 2024

So how can we communicate with self hosted embedding inference endpoints? Why can't I communicate within my docker network freely? Is there a workaround for now? Why does opensearch take on the responsibility to decide what is and isnt secure here?

@ylwu-amzn
Copy link
Collaborator

Replied on another Github issue #2126 (comment)

We had a discussion with security guys, they are ok to add a setting for allowing private IP. So user can control whether enable it or not. The setting should be disabled by default. User can enable it if they need. That can solve the problem.

@reuschling
Copy link

I am really interested what the reason is that an externally hosted LLM should be more secure than a self-hosted one reachable over a private IP.
We currently work with a hack that we open the private IP with an externally reachable redirection. This is really ugly in terms of security.

@manzke
Copy link

manzke commented May 22, 2024

Has it been solved and is it part of 2.14.?

Even if you would like to protect from using private, the implementation has too many flaws.
I just use a different internal ip which is not 127.,192.,168.,172. and it will work.
Can't think of a security requirement it should fulfill.

There are better ways to solve this.

@faileon
Copy link

faileon commented May 22, 2024

Has it been solved and is it part of 2.14.?

Even if you would like to protect from using private, the implementation has too many flaws. I just use a different internal ip which is not 127.,192.,168.,172. and it will work. Can't think of a security requirement it should fulfill.

There are better ways to solve this.

It is planned for 2.15

@manzke
Copy link

manzke commented May 22, 2024

Let me know how you want it to be solved and we open a PR.
It was labeled for 2.14 already.

@ylwu-amzn
Copy link
Collaborator

PR #2534

@hadoopdk
Copy link

hadoopdk commented Jul 3, 2024

I still see error in 2.15

{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Remote inference host name has private ip address:"

@reuschling
Copy link

Did you set the new opensearch setting 'connector.private_ip_enabled: true' ? With this it works in my setting.

@holdenma
Copy link

holdenma commented Nov 5, 2024

Seems this setting not allowed on AWS OpenSearch. @ylwu-amzn Can you confirm ? This blocks us

@ylwu-amzn
Copy link
Collaborator

@holdenma , sorry that this setting not supported on AWS. Suggest to deploy your model somewhere else like Sagemaker, EC2 etc. You can create load balancer and use that URL in connector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v2.15.0
Projects
Status: Planned work items
Development

Successfully merging a pull request may close this issue.