#mtls #proxy #minimalist #http #mapping #client #key

bin+lib http-mtls-proxy

快速极简的 mTLS 代理

1 个不稳定版本

0.1.0 2023 年 12 月 19 日

#5 in #mtls

MIT 许可证

25KB
653 代码行

http-mtls-proxy

一个用 Rust 编写的 mTLS 代理(http 到 mTLS-https),旨在在终端中运行。有关 Spring Boot Test Containers 的信息,请参阅 http-mtls-proxy-boot3-test-container

安装

cargo install http-mtls-proxy

用法

Usage: http-mtls-proxy [OPTIONS] <MAPPING1> [MAPPING]...

Arguments:
  <MAPPING1>    Define the request mappings. Ex ':9000/foo/:path*=https://example.com/{path}'
  [MAPPING]...

Options:
      --client <CLIENT>  Create a client for outbound requests. Ex. --client foo=*.example.com
      --cert <CERT>      Define the certificate a client should use for mTLS. Ex. --cert foo=/path/to/example.com.pem
      --key <KEY>        Define the key a client should use for mTLS. Ex. --key foo=/path/to/example.com.key
  -h, --help             Print help
  -V, --version          Print version

示例

http-mtls-proxy \
  --client "aZone=https://*.mtls.a-zone.internal:*/*" \
  --cert "aZone=/path/to/a-zone-user123.pem" \
  --key "aZone=/path/to/a-zone-user123.key" \
  --client "bZone=https://*.mtls.b-zone.internal:*/*" \
  --cert "bZone=/path/to/b-zone-user123.pem" \
  --key "bZone=/path/to/b-zone-user123.key" \
  ":3000/:letter([ab])-zone/:service/:path*=https://{service}.mtls.{letter}-zone.internal{/path}" \
  ":4000/something-special/:path*=https://something-special.mtls.b-zone.internal{/path}"

依赖项

~19–31MB
~569K SLoC