SSL handshake failed: SSL 错误:在证书中检测到违规的密钥用法

时间:2025-02-09 09:06:46

Linux下svn不能连接上Windows服务器:SSL handshake failed: SSL 错误:在证书中检测到违规的密钥用法。

之前已经在Windows 2003上用visualSVN配置好了SVN服务器,并且在Windows虚拟机的客户端可以正常使用。

但是,今天在Ubuntu 11.10上尝试运行svn,就装了一个subversion.但是使用时报了类似下面的错:

svn: 方法 OPTIONS 失败于 “https://1.0.0.2:8443/svn/xxx”: SSL handshake failed: SSL 错误:在证书中检测到违规的密钥用法。

 

错误原因:这是因为virtual svn在生成鉴权数据的时候使用了一个插件,而这个插件是OpenSSL支持的,但GnuTls是不支持的。


改正方法是:修改服务器上visualsvn使用的证书为第三方产生的证书源码天空,以便windows和linux都能识别。

过程:


the following registry value to the Windows registry:(我的是32位)
for 32-bit system:(运行regedit->找到下面的注册表项->增加一个dword类型的值)

[HKEY_LOCAL_MACHINESOFTWAREVisualSVNVisualSVN Server]
"CreateGnuTLSCompatibleCertificate"=dword:00000001
      for 64-bit system:

[HKEY_LOCAL_MACHINESOFTWAREWow6432NodeVisualSVNVisualSVN Server]
"CreateGnuTLSCompatibleCertificate"=dword:00000001
      Start VisualSVN Server Manager.(打开virsualSVN server)
to Action | Properties | Certificate.
Change certificate... and follow the wizard instructions to generate a new self-signed certificate.
再次执行svn,会提示证书生成者不受信赖的警告,选择永久接受即可。


这样问题就解决了。

 

另外还有一种解决办法(没有进行测试):就是让LINUX下的SVN客户端支持OPENSSL。

方法如下:

wget /downloads/subversion-1.6.
wget /downloads/subversion-deps-1.6.
tar xvfz subversion-1.6.
tar xvfz subversion-deps-1.6.
cd subversion-1.6.3/neon/

sudo apt-get install libssl-dev libxml2-dev
./configure --with-ssl --with-pic
make
make install

cd ..
rm -rf neon
edit /etc/ and add /usr/local/lib
ldconfig

./configure --with-ssl --with-neon=/usr/local
make
make install

dpkg --purge subversion