#docker-build #secret #quick #solution #dirty #meant #http-expose

app httpose

针对“HTTP-expose”的秘密的快速且实用的Docker构建解决方案

1 个不稳定版本

0.1.1 2019年10月18日

#15 in #docker-build

MIT 许可证

14KB
101

httpose

Codefresh build status

针对“HTTP-expose”的秘密的快速且实用的Docker构建解决方案。

注意:此工具不使用任何HTTP上的SSL,并假设工作网络环境在没有加密的情况下是安全的(例如 localhost)。

开始使用

只需运行

# stdin
## Serves at `127.0.0.1:2048` by default
./httpose (secret will be consumed via stdin)
## (CTRL-C to terminate)

## Pipe in also works
echo xxx | ./httpose
## (CTRL-C to terminate)

# env var
HTTPOSE_SECRET=xxx ./httpose
## (CTRL-C to terminate)

# by file
echo xxx > /tmp/secret
./httpose -f /tmp/secret
## (CTRL-C to terminate)
rm /tmp/secret

## Serves at 0.0.0.0 interface and port 12345
## Not recommended to serve out of 127.0.0.1 unless within Docker bridge mode
./httpose -a 0.0.0.0:12345

## Help details
./httpose -h

当服务启动时,您可以通过 curlwget 获取秘密值

# curl
curl -s http://127.0.0.1:2048/

# wget
wget -qO - http://127.0.0.1:2048/

变更日志

有关更多详细信息,请参阅 CHANGELOG.md

Cargo 构建

您需要安装 cargorustc。有关更多信息,请参阅 (rustup)[https://rustup.rs]

要使用 cargo 以发布模式构建,只需运行

cargo build --release

要执行,只需运行

cargo run --release -- [args...]

Docker 构建

要构建镜像,只需运行

docker build . -t httpose

# Host network mode for simplicity
docker run --rm -it --net host httpose

# Bridge mode, requires changing of listening address
docker run --rm -it -p 2048:2048 httpose -a "0.0.0.0:2048"

# Secret by env var (not recommended because docker inspect can see the secret)
docker run -e HTTPOSE_SECRET=xxx --rm -it --net host httpose

# Secret by file
docker run -v "`pwd`/xxx:/xxx" --rm -it --net host httpose -f "/xxx"

# Help details
docker run --rm -it httpose -h

依赖关系

~12–20MB
~266K SLoC