java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli

Jenkins JIRA | Andrea Barbieri | 7 years ago
  1. 0

    According to Hudson 1.350 changelog: - Authentication support in Hudson CLI. (issue 3796) it should be possible now to use the CLI when Authorization is set up... but it does not seem to work. My setup: - Enable security ticked - Authorization Matrix-based security Anonymous (all denied) admin (all allowed) I can only login at the Hudson dashboard if I use the admin account. But when I try to use the hudson CLI (downloaded the jar file from http://localhost:8080/hudson/cli) I get: C:\Work\hudson>java -jar hudson-cli.jar -s http://localhost:8080/hudson help Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:51) at hudson.cli.CLI.<init>(CLI.java:90) at hudson.cli.CLI.<init>(CLI.java:62) at hudson.cli.CLI.main(CLI.java:171) The same happens when I provide the username and password details: C:\Work\hudson>java -jar hudson-cli.jar -s http://localhost:8080/hudson help --username admin --password theRightPassword Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:51) at hudson.cli.CLI.<init>(CLI.java:90) at hudson.cli.CLI.<init>(CLI.java:62) at hudson.cli.CLI.main(CLI.java:171) is this the correct way to provide auth credentials via the CLI args?

    Jenkins JIRA | 7 years ago | Andrea Barbieri
    java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli
  2. 0

    According to Hudson 1.350 changelog: - Authentication support in Hudson CLI. (issue 3796) it should be possible now to use the CLI when Authorization is set up... but it does not seem to work. My setup: - Enable security ticked - Authorization Matrix-based security Anonymous (all denied) admin (all allowed) I can only login at the Hudson dashboard if I use the admin account. But when I try to use the hudson CLI (downloaded the jar file from http://localhost:8080/hudson/cli) I get: C:\Work\hudson>java -jar hudson-cli.jar -s http://localhost:8080/hudson help Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:51) at hudson.cli.CLI.<init>(CLI.java:90) at hudson.cli.CLI.<init>(CLI.java:62) at hudson.cli.CLI.main(CLI.java:171) The same happens when I provide the username and password details: C:\Work\hudson>java -jar hudson-cli.jar -s http://localhost:8080/hudson help --username admin --password theRightPassword Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:51) at hudson.cli.CLI.<init>(CLI.java:90) at hudson.cli.CLI.<init>(CLI.java:62) at hudson.cli.CLI.main(CLI.java:171) is this the correct way to provide auth credentials via the CLI args?

    Jenkins JIRA | 7 years ago | Andrea Barbieri
    java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli
  3. 0

    [JENKINS-5930] CLI authenticated mode not working - Jenkins JIRA

    jenkins-ci.org | 7 months ago
    java.io.IOException: Server returned HTTP response code: 403 for URL:
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    1.480.3. Enable security, with whatever security realm (e.g. Unix authentication), and matrix authentication with one user given all permissions and anonymous none. Enable the default crumb issuer. Configure the authenticated user's SSH public keys. Now from a shell try to use the CLI: {code:none} $ java -jar jenkins-cli.jar -s http://localhost:8080/ -i ~/.ssh/id_dsa help Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/cli at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625) at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:77) at hudson.cli.CLI.connectViaHttp(CLI.java:155) at hudson.cli.CLI.<init>(CLI.java:139) at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:68) at hudson.cli.CLI._main(CLI.java:438) at hudson.cli.CLI.main(CLI.java:373) {code} If you disable the crumb issuer, the same command works as expected. {{Jenkins.doCli}} in {{POST}} mode would go through {{CrumbFilter}}, and the CLI client makes no attempt to send a crumb. If there is some way a JavaScript form submission could trick a browser into initiating a complete CLI session and sending a destructive command, then the client should be amended to check for {{/crumbIssuer/api/xml}} and send a crumb; otherwise {{CrumbFilter}} should be amended to exempt {{/cli}}.

    Jenkins JIRA | 4 years ago | Jesse Glick
    java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/cli

  1. hari haran 1 times, last 7 months ago
  2. tyson925 571 times, last 4 weeks ago
  3. jedcua 2 times, last 4 months ago
  4. thiago.santos 2 times, last 4 months ago
  5. kkandda 4 times, last 6 months ago
2 more registered users
40 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    Server returned HTTP response code: 403 for URL: http://localhost:8080/hudson/cli

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream()
  2. Java RT
    HttpURLConnection.getInputStream
    1. sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    1 frame
  3. Hudson
    CLI.main
    1. hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:51)
    2. hudson.cli.CLI.<init>(CLI.java:90)
    3. hudson.cli.CLI.<init>(CLI.java:62)
    4. hudson.cli.CLI.main(CLI.java:171)
    4 frames