构建能让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

  1. 安装msys2
  2. msys2 环境下安装依赖: pacman -S gcc make openssl-devel ca-certificates
  3. 下载socat最新源码包 http://www.dest-unreach.org/socat/download/socat-1.7.4.4.tar.gz
  4. 编译 socat
  5. tar -zxvf socat-1.7.4.4.tar.gz
  6. cd socat-1.7.4.4
  7. ./configure
  8. make
  9. make install

参考文档

  1. Dockerfile
  2. Compose file
  3. Tini作为Docker容器的init进程,tini 解决僵尸进程
  4. 下载socat
  5. msys2
  6. MSYS2 镜像
  7. MSYS2 镜像
  8. msys2 换源
  9. 使用最新版 gcc cmake msys2 Cygwin
posted @ 2022-10-25 20:54  jingjingxyk  阅读(101)  评论(0编辑  收藏  举报