Fluxheim/문서/WASM 확장

WASM 확장

전체 프로덕션 프로필을 기반으로 하며 정책 훅의 범위를 제한하고 ACME, 메트릭, OpenTelemetry를 지원하는 전용 Wasm 빌드

제공하는 것

전체 프로덕션 프로필을 기반으로 하며 정책 훅의 범위를 제한하고 ACME, 메트릭, OpenTelemetry를 지원하는 전용 Wasm 빌드.

feature사용 대상
접근 결정실시간 native HTTP/1 access-decision hook은 우선순위, first-deny-wins 구성, fail-closed 동작을 사용합니다.
Header hookrequest-headersresponse-headers hook은 policy-tier 예시처럼 허용 목록의 합성 header만 설정하거나 제거할 수 있습니다.
라우트 결정route-decision hook은 계속 진행, 거부, 또는 설정되어 매칭된 canarymirror 라우트 분기 선택만 할 수 있습니다.
Cache 결정cache-lookup hooks는 continue, pass, bypass 또는 deny를 선택할 수 있습니다. cache-store hooks는 memory/disk cache writes 전에 continue, skip storage 또는 deny를 선택할 수 있습니다.

실행

전용 profile-wasm 압축 파일 또는 이미지를 사용하십시오. 일반 전체 빌드에는 의도적으로 Wasm이 포함되지 않습니다.

공식 Wasm 이미지에는 런타임이 포함되지만 운영자 플러그인은 포함되지 않습니다. 검토한 모듈을 읽기 전용으로 마운트하고 각 모듈을 SHA-256으로 고정하십시오.

podman pull ghcr.io/valkyoth/fluxheim:v1.8.0-wasm

podman run --rm \
  -v ./fluxheim.toml:/etc/fluxheim/fluxheim.toml:ro,Z \
  -v /srv/infra/fluxheim/plugins:/etc/fluxheim/plugins:ro,Z \
  ghcr.io/valkyoth/fluxheim:v1.8.0-wasm

승인된 플러그인 루트

플러그인 파일은 승인된 root 아래의 absolute path를 가진 regular file이어야 하며 symlink나 parent path를 사용할 수 없습니다.

[wasm]
enabled = true
plugin_roots = ["/etc/fluxheim/plugins"]
max_total_concurrent_executions = 256
max_total_preview_concurrent_executions = 32
max_total_cache_concurrent_executions = 256

[[wasm.plugins]]
name = "security_headers"
path = "/etc/fluxheim/plugins/security_headers.wasm"
sha256 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
abi = "fluxheim-policy-v1"
host_call_namespace = "fluxheim-policy-v1"
phases = ["response-headers"]
fail_mode = "fail-closed"

[[wasm.attachments]]
plugin = "security_headers"
vhost = "example"
priority = 100
phases = ["response-headers"]

제한된 실행

Fuel, memory, table, instance, compile-timeout, compile-worker와 호출별 watchdog 제한으로 sandbox 실행 범위를 제한합니다.

[wasm.plugins.limits]
max_module_bytes = "1MiB"
max_compiled_artifact_bytes = "32MiB"
max_memory_bytes = "16MiB"
max_table_elements = 10000
fuel = 5000000
timeout_ms = 50
compile_timeout_ms = 500

프로덕션 참고

컨테이너의 읽기 전용 마운트는 호스트 파일 자체를 보호하지 않습니다. 호스트 설정과 플러그인 디렉터리는 신뢰할 수 있는 소유자가 관리하고 쓰기 권한을 제한해야 합니다.

  • 공개 매니페스트에는 고정된 SHA-256 해시가 필요합니다. 컴파일은 프로세스 전체에서 동시에 최대 2개만 수행되며, 컴파일 결과물은 기본 32 MiB, 절대 최대 256 MiB로 제한됩니다.
  • config file과 기존의 모든 상위 directory를 신뢰할 수 있는 소유권 아래 두고 group이나 다른 user가 쓸 수 없게 하십시오.
  • 릴리스 버전 또는 이미지 digest를 고정하세요.
  • 비밀 값은 공개 문서가 아니라 파일, 환경 변수, 컨테이너 secret에 보관하세요.

Full docs on GitHub

한국어