jenkins-cli icon indicating copy to clipboard operation
jenkins-cli copied to clipboard

No error message for "Can't verify SSL peers..."

Open raine opened this issue 11 years ago • 2 comments

When running the script, I would get no output other than No jobs found for pattern /./

After adding print $res->decoded_content() . "\n"; after line 368 in jenkins-static, I'd get the output

Can't verify SSL peers without knowing which Certificate Authorities to trust

This problem can be fixed by either setting the PERL_LWP_SSL_CA_FILE
envirionment variable or by installing the Mozilla::CA module.

To disable verification of SSL peers set the PERL_LWP_SSL_VERIFY_HOSTNAME
envirionment variable to 0.  If you do this you can't be sure that you
communicate with the expected peer.

Can't connect to jenkins:80 (Bad hostname)

LWP::Protocol::http::Socket: Bad hostname 'jenkins' at /System/Library/Perl/Extras/5.16/LWP/Protocol/http.pm line 51.

No jobs found for pattern /./

raine avatar Dec 16 '14 13:12 raine

What is your jenkins hostname? It defaults to "jenkins" but that does not work in your case. You probably need a ~/.jenkins file, here is the example I put in the README:

cat ~/.jenkins 
baseuri: http://jenkins.build.host
jobs: 
      - MyJob-1
      - MyJob-2
      - MyJob-3
stoplight: 1
# ssl_opts is any option listed in "perldoc IO::Socket::SSL"
ssl_opts:
      # by default we ignore invalid certs; set to nil to validate
      SSL_verify_callback:
      SSL_version: SSLv3

Otherwise you can set the --baseuri on the command line.

-Cory

coryb avatar Dec 16 '14 16:12 coryb

Hey @coryb,

Sorry for being unclear.

The jenkins hostname is not an issue, I have it in config and it works fine, IF I use the following ssl_opts

ssl_opts:
  verify_hostname: 0

For some reason it just says Can't connect to jenkins:80 (Bad hostname) in the output if it has the SSL issue as in my original output. (without verify_hostname: 0)

The reason I made this issue was that I couldn't figure out that the problem was SSL, without adding debug print in the code. Not printing an error about that will probably confuse many users of this tool if they have the same issue.

Thanks.

raine avatar Dec 16 '14 17:12 raine