Skip to content

L7 networkpolicy error #567

@chinazj

Description

@chinazj

Agent Diagnostic

I followed the example from this link:
https://github.com/NVIDIA/OpenShell/tree/main/examples/sandbox-policy-quickstart
but it has not been working successfully. The logs show the following.

Description

I configured a policy like this:

network_policies:
  code_hub:
    name: code_read_write
    endpoints:
      - host: 218.11.11.225
        port: 80
        protocol: rest
        enforcement: enforce
        access: read-only
    binaries:
      - { path: /usr/bin/curl }

Then I ran:

sandbox@demo:~$ curl -v 218.11.11.225:80
* Uses proxy env variable no_proxy == '127.0.0.1,localhost,::1'
* Uses proxy env variable http_proxy == 'http://10.200.0.1:3128'
*   Trying 10.200.0.1:3128...
* Connected to 10.200.0.1 (10.200.0.1) port 3128
> GET http://218.11.11.225/ HTTP/1.1
> Host: 218.11.11.225
> User-Agent: curl/8.5.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 403 Forbidden
* no chunk, no close, no size. Assume close to signal end
<
* Closing connection

The logs are as follows:

[1774352985.070] [sandbox] [INFO ] [openshell_sandbox::proxy] FORWARD action=deny binary=/usr/bin/curl dst_host=218.11.11.225 dst_port=80 method=GET path=/ policy=code_hub reason=endpoint has L7 rules; use CONNECT

I guess I’m using it incorrectly. How should I use the L7 policy?

Reproduction Steps

  1. openshell sandbox create --name demo
  2. vim policy
  3. openshell policy set demo --policy policy.yaml --wait
  4. openshell sandbox connect demo
  5. curl -v 218.11.11.225:80
* Uses proxy env variable no_proxy == '127.0.0.1,localhost,::1'
* Uses proxy env variable http_proxy == 'http://10.200.0.1:3128'
*   Trying 10.200.0.1:3128...
* Connected to 10.200.0.1 (10.200.0.1) port 3128
> GET http://218.11.11.225/ HTTP/1.1
> Host: 218.11.11.225
> User-Agent: curl/8.5.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 403 Forbidden
* no chunk, no close, no size. Assume close to signal end
<
* Closing connection

Environment

  • linux

Logs

Agent-First Checklist

  • I pointed my agent at the repo and had it investigate this issue
  • I loaded relevant skills (e.g., debug-openshell-cluster, debug-inference, openshell-cli)
  • My agent could not resolve this — the diagnostic above explains why

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions