V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  v2er119  ›  全部回复第 5 页 / 共 8 页
回复总数  145
1  2  3  4  5  6  7  8  
2025 年 5 月 17 日
回复了 ma46 创建的主题 程序员 想开发一款 HTTPS 抓包工具,求大佬们指点!🚀
非专业人士,问一下,在模拟器里使用主机的代理网络,使用主机的 makecert 的证书 。主机根证书导入后,应该也可以解密代理请求吧。
2025 年 5 月 17 日
回复了 atfeel 创建的主题 程序员 内网穿透,大家是怎么解决的?
2025 年 5 月 11 日
回复了 kincaid 创建的主题 云计算 SSL 证书再有几年 47 天了,大家有什么自动化方案嘛
AI 写脚本,监控+提醒+certbot 自动申请
https://maifeipin.com/archives/zi-dong-bu-shu-xi-tong-jian-kong-jiao-ben
只需替换你的邮箱和 tencentcloud.ini (对应的域名 API key ) 就行了


···
#!/bin/bash

THRESHOLD=7
CREDENTIALS="/etc/letsencrypt/tencentcloud.ini"
EMAIL="[email protected]"
EMAIL_ARG="--email $EMAIL"
# EMAIL_ARG="--register-unsafely-without-email"

nginx_conf_dirs=(
"/etc/nginx/nginx.conf"
"/etc/nginx/conf.d/"
"/etc/nginx/sites-enabled/"
"/etc/nginx/sites-available/"
"/usr/local/nginx/conf/"
)

nginx_cert_files=$(mktemp)
for conf_dir in "${nginx_conf_dirs[@]}"; do
if [ -d "$conf_dir" ]; then
find "$conf_dir" -type f -name "*.conf" 2>/dev/null | while read -r file; do
grep -E '^\s*ssl_certificate\s+' "$file" | awk '{print $2}' | sed "s/['\";]//g" >> "$nginx_cert_files"
done
elif [ -f "$conf_dir" ]; then
grep -E '^\s*ssl_certificate\s+' "$conf_dir" | awk '{print $2}' | sed "s/['\";]//g" >> "$nginx_cert_files"
fi
done

sort -u "$nginx_cert_files" -o "$nginx_cert_files"

while read -r cert_path; do
if [ -z "$cert_path" ]; then continue; fi
if [ ! -f "$cert_path" ]; then
echo "证书文件: $cert_path (未找到!)"
echo "-----------------------------"
continue
fi

expiry_date=$(openssl x509 -noout -enddate -in "$cert_path" 2>/dev/null | cut -d= -f2)
expiry_epoch=$(date -d "$expiry_date" +%s)
now_epoch=$(date +%s)
days_left=$(( (expiry_epoch - now_epoch) / 86400 ))

all_domains=$(openssl x509 -noout -text -in "$cert_path" 2>/dev/null | grep "DNS:" | sed 's/.*DNS://;s/, /\n/g' | tr '\n' ' ')

if [ $days_left -le $THRESHOLD ]; then
main_domain=$(echo "$all_domains" | awk '{print $1}')
echo "证书文件: $cert_path"
echo " 包含域名: $all_domains"
echo " 过期时间: $expiry_date (剩余 $days_left 天)"
echo " 证书即将过期或已过期,自动续期..."

certbot certonly \
-a dns-tencentcloud \
--dns-tencentcloud-credentials "$CREDENTIALS" \
-d $all_domains \
$EMAIL_ARG \
--non-interactive --agree-tos \
--keep-until-expiring

if [ $? -eq 0 ]; then
echo " 证书续期成功"
# 自动覆盖 Nginx 实际用的证书
src_cert="/etc/letsencrypt/live/$main_domain/fullchain.pem"
src_key="/etc/letsencrypt/live/$main_domain/privkey.pem"
if [ -f "$src_cert" ] && [ -f "$src_key" ]; then
# 只在 Nginx 用的路径和 Let’s Encrypt 路径不一致时覆盖
if [ "$cert_path" != "$src_cert" ]; then
cp -f "$src_cert" "$cert_path"
echo " 已覆盖 Nginx 用的证书: $cert_path"
fi
# 查找 key 路径
key_path=$(grep -E '^\s*ssl_certificate_key\s+' /etc/nginx/nginx.conf /etc/nginx/conf.d/*.conf /etc/nginx/sites-enabled/* /etc/nginx/sites-available/* /usr/local/nginx/conf/*.conf 2>/dev/null | grep "$main_domain" | awk '{print $2}' | sed "s/['\";]//g" | head -n1)
if [ -n "$key_path" ] && [ "$key_path" != "$src_key" ]; then
cp -f "$src_key" "$key_path"
echo " 已覆盖 Nginx 用的私钥: $key_path"
fi
fi
systemctl reload nginx
else
echo " 证书续期失败"
fi
else
echo "证书文件: $cert_path"
echo " 包含域名: $all_domains"
echo " 过期时间: $expiry_date (剩余 $days_left 天)"
fi
echo "-----------------------------"
done < "$nginx_cert_files"

rm -f "$nginx_cert_files"

···
2025 年 5 月 11 日
回复了 syh2 创建的主题 生活 麻了,各位有了自己家庭之后如何和自己母亲相处
各有各的烦,媳妇没有公公婆婆,天天抱怨没有人带孩子,二个孩子从小自己带到大。现在大宝上高中还要 30 公里外租房陪读,一人带一个,自己还要长期加班,分身乏术。
2025 年 4 月 22 日
回复了 mythjava 创建的主题 问与答 请教电子邮件的问题
cf 家的泛域名邮箱很好使,理论上无限个。会帮你转发到指定的邮箱里。
哪有什么好代码,代码为业务服务,极致的体验,最好的代码是机器语言。可读,可维护与极致性能大多场景下是冲突的。
2025 年 4 月 21 日
回复了 cobainlu 创建的主题 问与答 2025 年有什么可以长期持有的海外手机号
GV 保活有好用的 API 的方案吗?我能想到是定制鼠标工作流,模拟器调试。
双网关,需要科学的设备才走 op.不需要科学的走另一个网关。op 负责 dhcp ,通过 dhcp 选项功能给设备动态分配网关
很受启发,我的简阅 rss 项目,有了更大的想象空间,太赞了!
2025 年 4 月 20 日
回复了 rookie 创建的主题 Windows 给微软跪了,升级完 22h4 电脑都用不成了。
24H2 的远程桌面也换了,但是就是时间一长,被远程的电脑桌面就动不了了。没升级前是没有问题的
2025 年 4 月 20 日
回复了 liuzhiyong 创建的主题 职场话题 大龄程序员的一些工作上的感受
这网站纯手工撸的,可以以此为起点,加油!作为 80 后,眼里还有光的人说明还是有干劲的,加油!
作为大龄码农,非常理解,我的网站一样没有一张图片,也是负优化,顺便域名待售。https://maifeipin.com
2025 年 4 月 20 日
回复了 michaelhyperhit 创建的主题 职场话题 如何能认识更多优秀的程序员?
同在合肥,看薪资水平,吊打我们啊,虽然对运维比较感兴趣的,但年纪大了。创业公司,还是要有朝气的年轻人比较好。
2025 年 4 月 19 日
回复了 JustDoIt221 创建的主题 学点什么 花 5.5W 报了个两年的英语培训
还是退了吧,纯心理作用,会的自己肯定能学会,随便一个 AI 都比培训班的老师有耐心。
2025 年 4 月 18 日
回复了 oom 创建的主题 Go 编程语言 分享一款流量分析工具 [GO-FLOW]
看上去不错,要是加个主流系统的二进制版本,用的人就方便多了。现在:No releases published 。当然也可以在 Readme 加上编译过程。
如果不用网线。蓝牙,红外也不是不行。
2025 年 4 月 18 日
回复了 CSGO 创建的主题 问与答 甲骨文永久免费终止了之后无法建立了
我一直用 X86 的,所以有两台。每次都是只关一台,保留一台。再怎么折腾都不怕,用 alway free 的卷 克隆或 OCID 新建就又出来了。
2025 年 4 月 16 日
回复了 RichardHu 创建的主题 宽带症候群 求一个异地回家/回国的组网方案
tailscale +derp 稳定好几年了。
退而求其次,用 cf 的 argo +3389 +长开机的 linux 图形 或 windows 桌面。
换 windows server 吧 我这有两台 5 年多没关机了。
1  2  3  4  5  6  7  8  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2861 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 56ms · UTC 12:33 · PVG 20:33 · LAX 05:33 · JFK 08:33
♥ Do have faith in what you're doing.