Skip to main content

hipp-https-agent

在需要证书的机器上申请和续期 Let’s Encrypt 证书,并把状态上报到服务端。不需要远程登录这台机器。

服务端地址是 https://hipp.site/cert/。程序会自己接上 /api/...,不要再加接口路径。末尾斜杠可以留着。

安装

在证书机器上用 root 安装。申请证书、写 /etc/nginx/certs 和重新加载 Nginx 都需要 root,常驻进程也用这个用户。

sudo pip install -i https://pypi.org/simple hipp-https-agent

已安装过时升级(备份/恢复需 ≥0.2.2):

sudo pip install -U -i https://pypi.org/simple 'hipp-https-agent==0.2.2'
sudo systemctl restart hipp-agent

安装后得到命令 hipp-agent。包在 PyPI 上的名字是 hipp-https-agent。需要 Python 3.7 或更高。显式指定官方索引,是为了避免云主机默认国内镜像尚未同步新包时出现 No matching distribution。

先装好 certbot,并准备校验目录:

sudo apt-get install -y certbot
sudo mkdir -p /var/www/acme

登记

先在 https://hipp.site/cert/ 用手机号登录,在「证书端」点登记,按向导第二步的安装和登记范例操作。证书端名称来自这台机器的 hostname。

再用 root 登记,这样配置会写到 root 的家目录,和后面的常驻进程是同一个用户:

sudo hipp-agent register -s https://hipp.site/cert/ -t <令牌>

-s 是服务端地址。-t 是「证书端令牌」页里的令牌。

配置在 /root/.config/hipp-agent/config.json。控制台里与本机 hostname 同名的域名会一并写入。还没有域名时也可以先登记,补上之后常驻进程会自动取回。

后台常驻

hipp-agent run 是常驻循环:每轮向服务端取配置,按申请、生效、监听推进,并上报心跳。它不会自己退出。直接在终端里跑时,关掉终端进程就没了。

用 systemd 把它留在后台,断线、重启机器之后也会再拉起来:

sudo tee /etc/systemd/system/hipp-agent.service >/dev/null <<'EOF'
[Unit]
Description=hipp certificate agent
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/local/bin/hipp-agent --config /root/.config/hipp-agent/config.json run
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now hipp-agent

若 command -v hipp-agent 不是 /usr/local/bin/hipp-agent,先改单元里的 ExecStart 再执行。仓库里的 deploy/hipp-agent.service 与上面这段相同,给仍从源码安装的人用。

查看是否在跑:

systemctl status hipp-agent
journalctl -u hipp-agent -n 50 --no-pager

停掉或重新拉起:

sudo systemctl stop hipp-agent
sudo systemctl restart hipp-agent

控制台「证书状态」里,最后上报在 3 分钟内存活为正常,否则为异常。

Metadata

Release files for hipp-https-agent 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hipp-https-agent 0.2.2
File Size Uploaded Provenance Actions
hipp_https_agent-0.2.2.tar.gz 21.4 kB Without provenance Details for hipp_https_agent-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hipp-https-agent 0.2.2
File Interpreter ABI Platform Actions
hipp_https_agent-0.2.2-py3-none-any.whl Python 3 none any Details for hipp_https_agent-0.2.2-py3-none-any.whl

Total release size: 46.9 kB

Release files / hipp_https_agent-0.2.2.tar.gz

Download URL hipp_https_agent-0.2.2.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4d708c173dfa0c223226106a128f64a0b509df30e0853ac80c9bea9c0b11ca8b
BLAKE2b-256 checksum
How to use checksums
4c1b2d553713b77057ce42e2e1b8e484ae0ed9cfec86e99ed904f1042e6c69f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.18

Release files / hipp_https_agent-0.2.2-py3-none-any.whl

Download URL hipp_https_agent-0.2.2-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57d77a55bb951215bdd4826f3db00ec113afe2e3bdb2e04c74a51c558bfcdee1
BLAKE2b-256 checksum
How to use checksums
fc6ae3881a8d5c9371e278d6a6cc17a5ffef264ed3dd57bfa1f65340c4094eec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.18

Security for hipp-https-agent 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page