执行curl -sSL 提示curl: (35) SSL connect error

curl -sSL https://shipyard-project.com/deploy| ACTION=node DISCOVERY=etcd://192.168.5.252:4001 bash -s

提示如下报错:

curl: (35) SSL connect error

解决方法:升级网络安全服务即可。

yum update nss

<think> 我们注意到用户再次遇到了相同的curl SSL错误。但这次没有出现“chmod: 无法访问”的错误,说明用户已经创建了.git/hooks目录,或者在上次建议后已经解决了目录不存在的问题。 现在问题集中在SSL连接错误。 解决方案: 1. 尝试使用-k选项忽略SSL证书验证(临时方案) 2. 使用wget代替curl,因为wget可能对证书的处理不同 3. 检查系统时间和日期是否正确(SSL证书验证对时间敏感) 4. 更新系统的CA证书包 具体步骤: 步骤1:使用curl-k选项(不安全,但快速) ```bash curl -k -Lo .git/hooks/commit-msg https://gerrit.ep.tp-link.com/tools/hooks/commit-msg ``` 步骤2:使用wget(如果系统安装了wget) ```bash wget --no-check-certificate -O .git/hooks/commit-msg https://gerrit.ep.tp-link.com/tools/hooks/commit-msg ``` 步骤3:检查系统时间 ```bash date # 如果时间错误,需要调整 sudo ntpdate pool.ntp.org # 或者使用timedatectl设置 ``` 步骤4:更新CA证书(Ubuntu/Debian) ```bash sudo apt update sudo apt install ca-certificates ``` 步骤5:如果以上都不行,考虑手动下载并保存 - 用浏览器访问该链接,保存为commit-msg文件,然后复制到.git/hooks/目录下,并赋予执行权限。 完整命令建议(忽略SSL错误): ```bash curl -k -Lo .git/hooks/commit-msg https://gerrit.ep.tp-link.com/tools/hooks/commit-msg && chmod +x .git/hooks/commit-msg ``` 如果企业环境有代理,可能需要设置代理: ```bash export https_proxy=http://proxy.example.com:8080 curl -k -Lo .git/hooks/commit-msg https://gerrit.ep.tp-link.com/tools/hooks/commit-msg ``` 注意:由于是公司内网地址,确保你的网络可以访问gerrit.ep.tp-link.com。 最终验证: ```bash ls -l .git/hooks/commit-msg ``` 如果文件存在且可执行,则成功。 根据用户的问题和我们的解决方案,提出相关问题: 1. 如何永久修复curl出现的SSL证书验证错误? 2. 在企业内网环境中如何正确配置SSL证书信任? 3. 除了忽略证书验证,还有哪些安全的方法解决SSL连接问题? 4. 如何为Git钩子脚本设置全局模板以避免每个仓库重复配置? 注意:必须按照要求输出“§§相关问题§§”开头,然后列出问题。 </think>### 解决 Gerrit Hook SSL 连接问题 您再次遇到 SSL 连接错误:`curl: (35) error:0A000126:SSL routines::unexpected eof while reading`。这表明问题可能源于系统级 SSL/TLS 配置而非目录问题。 ### 系统级解决方案: #### 1. 检查系统时间(SSL 证书验证依赖准确时间) ```bash # 检查系统时间 date timedatectl status # 同步时间(选择一种方法) sudo ntpdate pool.ntp.org # 传统方法 sudo timedatectl set-ntp true # systemd 系统 sudo hwclock --systohc # 同步硬件时钟 ``` #### 2. 更新 SSL/TLS 库 ```bash # Ubuntu/Debian sudo apt update sudo apt install --reinstall ca-certificates openssl libssl1.1 # CentOS/RHEL sudo yum update ca-certificates openssl ``` #### 3. 诊断连接问题 ```bash # 详细诊断连接(注意安全风险) openssl s_client -connect gerrit.ep.tp-link.com:443 -showcerts -debug # 替代方法:使用低安全协议测试 curl -v --tlsv1.2 -Lo /dev/null https://gerrit.ep.tp-link.com ``` #### 4. 强制使用特定 SSL 后端 ```bash # 尝试不同 SSL 后端 curl --ssl backend=openssl -Lo .git/hooks/commit-msg https://gerrit.ep.tp-link.com/tools/hooks/commit-msg curl --ssl backend=gnutls -Lo .git/hooks/commit-msg https://gerrit.ep.tp-link.com/tools/hooks/commit-msg ``` #### 5. 企业网络特殊配置 ```bash # 设置自定义 CA 证书路径 sudo mkdir -p /usr/local/share/ca-certificates/tplink sudo curl -o /usr/local/share/ca-certificates/tplink/ca.crt http://internal-ca.example.com/ca.crt sudo update-ca-certificates # 配置 Git 使用系统证书 git config --global http.sslCAInfo /etc/ssl/certs/ca-certificates.crt ``` ### 永久解决方案: ```bash # 1. 创建安全下载脚本 cat << 'EOF' > ~/download_hook.sh #!/bin/bash TARGET=".git/hooks/commit-msg" URL="https://gerrit.ep.tp-link.com/tools/hooks/commit-msg" # 尝试多种方法 curl --ssl backend=openssl -Lo "$TARGET" "$URL" || \ wget --no-check-certificate -O "$TARGET" "$URL" || \ python3 -c "import urllib.request; urllib.request.urlretrieve('$URL', '$TARGET')" chmod +x "$TARGET" EOF # 2. 运行脚本 chmod +x ~/download_hook.sh ~/download_hook.sh ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值