构建能让socat支持TLSv.13特性的容器环境
文档说明:只记录关键地方;
试验环境: linux debian 11
目标socat 支持TLSv1.3
免安装socat 运行时
curl -L https://github.com/jingjingxyk/build-static-socat/blob/main/setup-socat-runtime.sh?raw=true | bash
Dockerfile
FROM alpine:latest
RUN test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk update
RUN apk add ca-certificates curl openssl openssl-dev
RUN apk add socat privoxy proxychains-ng tini
ENTRYPOINT ["tini", "--"]
构建 build.sh
#!/bin/bash
set -eux
day=$(date -u +"%Y%m%dT%H%MZ")
# day=$(date "+%Y%m%d%H")
export DOCKER_BUILDKIT=1
image="registry.cn-beijing.aliyuncs.com/jingjingxyk-public/app:socat-alpine-$day"
docker build -t $image -f Dockerfile .
docker push $image
源码安装socat
#!/bin/bash
set -exu
__CURRENT__=`pwd`
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}
apt install -y curl gcc libssl-dev make
curl -L -O http://www.dest-unreach.org/socat/download/socat-1.7.4.3.tar.gz
tar -zxvf socat-1.7.4.3.tar.gz
cd socat-1.7.4.3
./configure
make -j `grep "processor" /proc/cpuinfo | sort -u | wc -l`
make install
window 下使用socat
- 安装msys2
- msys2 环境下安装依赖: pacman -S gcc make openssl-devel ca-certificates
- 下载socat最新源码包 http://www.dest-unreach.org/socat/download/socat-1.7.4.4.tar.gz
- 编译 socat
- tar -zxvf socat-1.7.4.4.tar.gz
- cd socat-1.7.4.4
- ./configure
- make
- make install