0

我有一个在 https 上运行的 sonarQube。为了达到它,我提供了两个文件(都是 .pem),一个有证书,另一个有私钥。

    -----BEGIN CERTIFICATE-----
MIIF0zCCA7ugAwIBAgIUX1ki3XRjzEnEDZxsnZ9ENjcDFDIwDQYJKoZIhvcNAQEN
BQAwfjELMAkGA1UEBhMCU0UxEjAQBgNVBAgTCVN0b2NraG9sbTESMBAGA1UEBxMJ
-----END CERTIFICATE-----

    -----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEArnFpeCXhMqUHZ6c7dDN8zfsEzQNHpsM37hu4soqRwhGFIpr+
U4ZGgXol0UtRtfXte9sEEJAUhfuWqpCIBx6Ps2NFc4DA47axzEvLEu8nWHxQzTJE
-----END RSA PRIVATE KEY-----

我使用上面的 .pem 文件创建了一个 .p12 文件

openssl pkcs12 -in mycertkey.p12 -out mycerts.crt -nokeys -clcerts

然后我使用上面的 .p12 文件创建了一个 .cer 文件

openssl x509 -inform pem -in mycerts.crt -outform der -out mycerts.cer

收到此 .cer 文件后,我将其添加到 sonar-cli docker image 的 java 的密钥库中

keytool -keystore /opt/java/openjdk/lib/security/cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias mycert2 -file mycerts.cer

它已成功添加。

然后我在我的 ant 项目上运行 sonar-scanner 命令

sonar-scanner -DskipTests -Dsonar.projectKey=ant_test -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_KEY

这样做后,我的输出低于输出。

    INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
INFO: Linux 4.18.0-305.el8.x86_64 amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.054s
INFO: Final Memory: 4M/13M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
        at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
        at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
        at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to parse entry in bootstrap index: <!DOCTYPE html>
        at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.parse(BootstrapIndexDownloader.java:59)
        at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:44)
        at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
        at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
        ... 7 more
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

有人可以帮我吗?我不确定我在这里做错了什么。

4

0 回答 0