Support outbound network allow lists for services

未关闭
#19 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
kubernetes, rust

调研方向

Start by reading the deploy path in cli/src/deploy.rs around lines 225–229 and Fiberd's hluk argument in hluk_linux.go around lines 287–292, then inspect the Service Identity inventory issue #38 and the related readiness and inventory issues #28 and #31. Define the policy contract and enforcement boundaries, including omitted versus empty rules and port semantics, before tracing how policy reaches artifact metadata, EdgePolicy, Fiberd and Kubernetes. Done means validated per-service rules are enforced with the required integration and connection-level tests.

由索引模型根据 Issue 内容生成。

描述

a-needs-info

There is currently no way to declare which external endpoints a service can reach. This is a missing feature, not an intentional restriction.

Use case: running small, bounded tools for coding agents, such as code review or validation, in hardware-isolated fibers. These tools typically need access to one or two external endpoints (a model API or git host, for example), but shouldn't need broader network access. Declaring a small allow list per service would cover this.

This is the primary networking-policy issue, covering features 5 and 10 in the Service Identity inventory (#38): the lampyr.yaml policy contract and the enforcement layers.

Current state
  • lampyr.yaml doesn't have a network configuration field.
  • Deploy hardcodes network.outbound: ["127.0.0.1"] in EdgePolicy (cli/src/deploy.rs:225-229).
  • Fiberd independently passes the same value to hluk (hluk_linux.go:287-292).
  • Nothing appears to read EdgePolicy, and editing it had no effect in testing.

hluk's allow list itself works. Running locally on Kind with KVM, a Node.js template service connecting to a non-loopback IP failed with connect EACCES. After replacing the loopback entry in Fiberd's --net-allow argument with that IP, the same snapshot returned HTTP 200, without changing EdgePolicy or the CapacityGrant spec.

hluk currently accepts IPs and hostnames, but not CIDRs or host:port, and hostnames allow all ports on the resolved IPs. The design doc uses storage.example.com:443, so port-aware rules need more than passing the configuration through. The hostname issue in hyperlight-unikraft#247 (fixed in hyperlight-unikraft#248) also affects the pinned runtime.

Proposed approach

Declare outbound destinations in lampyr.yaml:

network:
  outbound:
    - host: login.microsoftonline.com
      port: 443
    - host: management.azure.com
      port: 443
  • Make network.outbound optional, and include it in the artifact metadata so it's tied to the service revision.
  • Carry it through EdgePolicy and Fiberd's warm state, then pass each entry to hluk via --net-allow.
  • Apply Kubernetes network policies on top of the hluk policies for defense in depth.
  • Keep the current restriction when the field is omitted, and deny egress when the list is explicitly empty. No allow-all fallback.
  • Typed Service references, if needed for policy, should build on the existing direct cluster-local Service calls without forcing an application-specific proxy URL, binding API, or extra-hop architecture.

Runtime propagation and enforcement build on the fiberd-k8s-controller grant Pod model that homes now use. An earlier exploratory prototype provides experiments, not an obligation to retain its Home proxy or annotation design.

Requirements
  • One declaration is the source of truth; users must not maintain equivalent Hyperlight and Kubernetes policy files by hand.
  • Validate exact destinations, ports, duplicates, malformed input, and bounded rule counts (the previous specification proposed at most 64).
  • Explicitly define omitted versus empty policy, defaults, migration and intentional behavior changes; never introduce an allow-all fallback.
  • Enforce guest permissions separately from trusted execution-host dependencies: DNS, registry, issuer and Kubernetes control traffic needed by the host must not become guest application authority.
  • Honor declared ports; host-only Hyperlight rules alone are not evidence of port enforcement.
  • Standard NetworkPolicy protects hosts where supported. Public FQDN enforcement needs a verified hostname-aware backend, such as Azure Cilium/ACNS. Fail explicitly when unavailable; no broad public CIDR/storage wildcard substitute.
  • Azure infrastructure enablement remains provider work, while core applies approved workload policy; no cloud-provider Kubernetes credentials.
  • Document which providers support which policy semantics.
  • Integrate ownership, readiness/drift status, updates, delete, uninstall and rollback with the separate inventory/readiness work.
  • Test actual denied connections, DNS changes/search behavior, exact ports, malformed inputs and no management/API/metadata escape, not only generated YAML.
Binding-derived policy

When typed bindings are implemented, their required connectivity should feed the same outbound-policy pipeline.

  • A binding is the application-facing resource relationship and may project a URL, credentials, CA material, or other configuration.
  • Lampyr should derive the minimum enforceable Hyperlight and Kubernetes network permissions required by that binding.
  • Users should not repeat a bound Service or resource under network.outbound.
  • Raw network.outbound entries grant transport reachability only. They must not create bindings, inject application configuration, or imply resource authorization.

For example:

bindings:
  PROCESSOR:
    service: worker-processor

network:
  outbound:
    - host: login.microsoftonline.com
      port: 443

PROCESSOR supplies the application configuration and derives access to that exact Service. The explicit outbound rule independently permits the Azure login endpoint.

This keeps one policy-enforcement path while preserving the distinction between resource discovery/configuration and raw network permission.

Related work

Sub-issues cover infrastructure support (#29), restricted registry transport (#30), readiness (#28), and owned inventory/cleanup (#31). #28 and #31 are shared with Service Identity (#38), but have their parent here.

Define the policy contract and enforcement boundaries here first. Azure capability enablement and registry transport can proceed alongside that work; integrate inventory, cleanup, and readiness before end-to-end acceptance. Identity and networking remain independent permissions. Cluster-local visibility and direct cluster-local Service calls are already supported and are not part of this work.

Open questions
  1. Who approves egress? The signed grant and immutable template seem to be the current security boundary, and deploy marks EdgePolicy as admitted directly. Is that intentional, or should EdgePolicy have a separate admission step?
  2. Should the first version support IPs only, given hluk's current destination support?
主要语言
Rust
星标
3
派生
2
平均合并
3 天 57 分钟
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hyperlight-dev/lampyr 的其他 Issue

查看 hyperlight-dev/lampyr 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。