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

来源:互联网 发布:郑州java培训学校 编辑:程序博客网 时间:2024/04/27 11:18

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都能识别。

过程:


1.Add 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)
2.Go to Action | Properties | Certificate.
3.Click Change certificate... and follow the wizard instructions to generate a new self-signed certificate.
再次执行svn,会提示证书生成者不受信赖的警告,选择永久接受即可。


这样问题就解决了。

 

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

方法如下:

wget http://subversion.tigris.org/downloads/subversion-1.6.3.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.3.tar.gz
tar xvfz subversion-1.6.3.tar.gz
tar xvfz subversion-deps-1.6.3.tar.gz
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/ld.so.conf and add /usr/local/lib
ldconfig

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

dpkg --purge subversion

原创粉丝点击