在subversion中绕过ssl证书验证

ica*_*pan 17 svn version-control ssl

我正在管理一个基于subversion的构建系统,我们使用自签名的ssl作为服务器.因此,我们不时会因为添加了新机器并且无法检出而导致构建失败,因为这是该机器第一次联系svn服务器.

错误消息如下:

icasimpan ~$ svn ls https://scm.myserver.com/trunk
Error validating server certificate for 'https://scm.myserver.com:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: scm.myserver.com
 - Valid: from Mon, 05 Dec 2011 00:00:00 GMT until Tue, 11 Dec 2012 23:59:59 GMT
 - Issuer: Terms of use at https://www.verisign.com/rpa (c)10, VeriSign Trust Network, VeriSign, Inc., US
 - Fingerprint: c0:69:f6:67:8d:1f:d2:85:c1:94:9f:59:8e:81:cc:81:3d:1e:44:28
(R)eject, accept (t)emporarily or accept (p)ermanently? 
Run Code Online (Sandbox Code Playgroud)

我通常需要的是像 - 固化参数来卷曲.现在,我们的解决方法是只做一些简单的svn命令,以便我们可以"永久"回答并解决问题...至少在ssl证书再次更改/更新或者构建在另一个新的上完成之前机.

有人解决了这个问题吗?

提前致谢 :)

Dir*_*lik 22

我想你有两个选择; 抛弃所有警告并从命令行设置trust-server-cert和non interactive:

 svn help co
 .... snip....
--non-interactive        : do no interactive prompting
--trust-server-cert      : accept unknown SSL server certificates without
                         prompting (but only with '--non-interactive')
Run Code Online (Sandbox Code Playgroud)

另一种选择是使用openssl s_client和-showcerts之类的东西来检查和验证证书是否在svn调用之前发生了变化 - 然后要么非常干净地中止并让人做出判断调用,或者是脏的东西 - 比如使用-showcert更新〜/ .subversion中的已知证书.

在任何一种情况下 - 非直观魔法都在〜/ .subversion/auth/svn.ssl.server/<serverrecord>中的文件上 - 以提取您需要的证书信息:

cat <serverrecord> | grep ^MII | base64decode  | openssl x509 -text -inform DER
Run Code Online (Sandbox Code Playgroud)

或类似的东西

cat <serverrecord> | grep ^MII | base64decode  | openssl x509 -text -inform DER -noout - out current-cert.pem
Run Code Online (Sandbox Code Playgroud)

然后可以将openssl s_client与-CApath一起使用,或者使用该证书进行验证,以查看它是否已更改和/或使用-showcert进行交叉检查.(注意:替换perl -e'使用MIME :: Base64; print decode_base64(join("",));'for base64decode(如果需要)).