For educational reasons I've decided to create my own CA. Here is what I learned.
Lets get some context first.
#!/bin/bash | |
set -e | |
b2hex() { echo -n $1|base64 --decode | xxd -p -u | tr -d \\n; } | |
modulus=$(b2hex u2/nlDLMbqLY+XBnWlqHv74a/wvmPoefKv+5NkTU0sbQAEMN7Gar9Hgp50uMUQhiOhwO6L4hezrY021etPyh2Q==) | |
exponent=$(b2hex AQAB) | |
asn1conf=$(echo -e "asn1=SEQUENCE:pubkeyinfo\n[pubkeyinfo]\nalgorithm=SEQUENCE:rsa_alg\npubkey=BITWRAP,SEQUENCE:rsapubkey\n[rsa_alg]\nalgorithm=OID:rsaEncryption\nparameter=NULL\n[rsapubkey]\nn=INTEGER:0x$modulus\ne=INTEGER:0x$exponent" | openssl asn1parse -genconf /dev/stdin -noout -out /dev/stdout | base64) |
import ssl | |
from requests.adapters import HTTPAdapter | |
CFG_FILE = '<path_to_cfg>' | |
secure_hosts = [ | |
'https://<host>' | |
] | |
class SSLAdapter(HTTPAdapter): | |
def __init__(self, certfile, keyfile, password=None, *args, **kwargs): |
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized
/** | |
* Docker Registry 代理 Worker | |
* | |
* 功能说明: | |
* 1. 根路径请求重定向到 Docker 官网 | |
* 2. 针对 /v2/ 请求返回带有 WWW-Authenticate 挑战的响应, | |
* 引导 Docker 客户端获取认证 Token。 | |
* 3. 针对 /auth/token 请求,从 Docker 授权服务获取认证 Token。 | |
* 4. 对于其他请求(如拉取镜像配置或镜像数据),转发到上游 Docker Registry, | |
* 并在必要时对请求路径进行调整(例如缺失默认命名空间时自动补全 "library")。 |