SonarQube服务器与MSBuild之间存在信任问题

SonarQube服务器与MSBuild之间存在信任问题,msbuild,sonarqube,ssl-certificate,sonarqube-scan,sonarqube-ops,Msbuild,Sonarqube,Ssl Certificate,Sonarqube Scan,Sonarqube Ops,我想对.NET项目运行SonarQube分析 我已经设置了一个docker映像,其中包含所描述的先决条件 按照说明操作时: mono /msbuild/SonarQube.Scanner.MSBuild.exe begin /d:sonar.login=<my-sonarqube-secret-token> /k:somenameipasshere SonarQube Scanner for MSBuild 4.0.2 Default properties file was foun

我想对
.NET
项目运行SonarQube分析

我已经设置了一个docker映像,其中包含所描述的先决条件

按照说明操作时:

mono /msbuild/SonarQube.Scanner.MSBuild.exe begin /d:sonar.login=<my-sonarqube-secret-token> /k:somenameipasshere
SonarQube Scanner for MSBuild 4.0.2
Default properties file was found at /msbuild/SonarQube.Analysis.xml
Loading analysis properties from /msbuild/SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
16:49:01.29  Updating build integration targets...
16:49:01.305  Fetching analysis configuration settings...
16:49:01.433  Failed to request and parse 'https://myserver.sonarqube.local/api/server/version': Error: TrustFailure (One or more errors occurred.)
16:49:01.433  A server certificate could not be validated. Possible cause: you are using a self-signed SSL certificate but the certificate has not been installed on the client machine. Please make sure that you can access https://myserver.sonarqube.local without encountering certificate errors.
16:49:01.434  Pre-processing failed. Exit code: 1
mono/msbuild/SonarQube.Scanner.msbuild.exe begin/d:sonar.login=/k:somenameipasshere
MSBuild 4.0.2的SonarQube扫描仪
默认属性文件位于/msbuild/SonarQube.Analysis.xml
从/msbuild/SonarQube.analysis.xml加载分析属性
开始预处理。
正在准备工作目录。。。
16:49:01.29正在更新生成集成目标。。。
16:49:01.305正在获取分析配置设置。。。
16:49:01.433未能请求并分析'https://myserver.sonarqube.local/api/server/version“:错误:信任失败(发生了一个或多个错误。)
16:49:01.433无法验证服务器证书。可能原因:您正在使用自签名SSL证书,但该证书尚未安装在客户端计算机上。请确保您可以访问https://myserver.sonarqube.local 不会遇到证书错误。
16:49:01.434预处理失败。退出代码:1
。。。但是

# keytool -import -file /sonar-scanner/certs/myserver.sonarqube.local.crt -keystore /sonar-scanner/jre/lib/security/cacerts     -alias myserver.sonarqube.local -storepass <somepass> -noprompt 
keytool error: java.lang.Exception: Certificate not imported, alias <myserver.sonarqube.local> already exists
#keytool-import-file/sonar scanner/certs/myserver.sonarqube.local.crt-keystore/sonar scanner/jre/lib/security/cacerts-alias myserver.sonarqube.local-storepass-noprompt
keytool错误:java.lang.Exception:未导入证书,别名已存在

显然,MSBuild扫描仪与
声纳扫描仪
的情况不同,不能使用
keytool

必须通过典型的(debian/ubuntu)过程将服务器使用的CA证书复制到
/usr/local/share/CA certificates/
并运行
sudo update CA certificates


然后可以与SonarQube服务器进行安全通信。

mono
还需要信任证书。根据您的发行版,您可能需要添加
ca证书mono
包。