Hi Simon
So I have tried below:
1) Import the cert using option -certfulldump, in file certfile.cer. The file contains CA cert and private key in below format:
-----BEGIN CERTIFICATE-----
...
...
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
...
...
-----END PRIVATE KEY-----
2) Now, on the enterprise server, add this to java key store using below command:
keytool -importcert -keystore $JAVA_HOME/lib/security/cacerts -file $WORKSPACE/certfile.cer -alias owasp_zap_root_ca -storepass changeit -noprompt
3) Use the certfile.cer in zap container:
docker run --user=0 --net zaptestnet --rm -v $WORKSPACE:/zap/wrk/:rw -t owasp/zap2docker-live bash -c "zap.sh -cmd -certload /zap/wrk/certfile.cer -addonupdate
The command outputs below:
Found Java version 11.0.16
Available memory: 13869 MB
Using JVM args: -Xmx3467m
Jan 05, 2023 2:54:48 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Check for updates call failed --> Update call is failing again
Root CA certificate loaded from /zap/wrk/certfile.cer --> root CA is loaded using the file that we passed but after trying the update with new cert
Zap logs show the same thing:
2023-01-05 14:45:22,971 [main ] INFO DbMigrate - Successfully applied 1 migration to schema "PUBLIC", now at version v1 (execution time 00:00.022s)
2023-01-05 14:45:22,977 [main ] INFO CallbackService - Started callback service on
0.0.0.0:374492023-01-05 14:45:22,979 [main ] INFO ExtensionNetwork - Creating new root CA certificate.
--> We are passing the cert, but zap is still creating a new cert2023-01-05 14:45:24,079 [main ] INFO ExtensionNetwork - New root CA certificate created.
2023-01-05 14:45:25,196 [ZAP-cfu] WARN ExtensionCallHome - Certificate chain may be invalid. Are you using a corporate or intermediate proxy? Is its CA certificate in your Java truststore?
2023-01-05 14:45:26,115 [main ] ERROR CommandLine - Check for updates call failed
2023-01-05 14:45:26,223 [main ] INFO CommandLine - Root CA certificate loaded from /zap/wrk/certfile.cer -
-> It loads the cert after doing all the work. :(
What could be the issue here?
Thanks!