3

I'm trying to unlock Jenkins 2 using the curl command in the VM where Jenkins Server is installed. I have the following:

curl 'admin:a84b61b7f2704b18ada3cbd32c3ad39e@127.0.0.1:8080/j_acegi_security_check -X POST -d {"from":"","j_username":"admin","j_password":"a84b61b7f2704b18ada3cbd32c3ad39e","Jenkins-Crumb":"90b3cf29bdf16c9790227a3f8a8674bf"}'

The secrets are showing but I have a bash variable for each one. When I execute the curl command I always have a 302 status code.

Someone can help me?

StephenKing
  • 36,187
  • 11
  • 83
  • 112
  • Why is a 302 status code bad? That would suggest that you logged-in successfully and are being redirected to the home page. Otherwise it would be a 401, or maybe 403. – Christopher Orr Mar 14 '17 at 23:01
  • Are you the Jenkins administrator as well? You're aware of the [`jenkins.install.runSetupWizard`](https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties) property? – StephenKing Mar 15 '17 at 06:57
  • Hi, thanks for the comment. I'm trying to configure Jenkins with bash scripts due to I need to prepare it without UI configuration as I can. I know the runSetupWizard over the /etc/default and jenkins file, but I need to secure Jenkins since bash scripts. – Ricardo Pina Arellano Mar 15 '17 at 17:07
  • If I execute the request using DHCP or another API Client, it works; but I don't know if I need a special header or something like that. Right now, my curl is: – Ricardo Pina Arellano Mar 15 '17 at 17:09
  • curl -i -X POST \ -H "Content-Type:application/x-www-form-urlencoded" \ -H "User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" \ -H "Accept:*/*" \ -d "from=/" \ -d "j_username=admin" \ -d "j_password=591e0cbfc6f4488291eac4b72c56772a" \ -d "Jenkins-Crumb=817cfa1009f8e8b8db579a8b969e79bb" \ -d "json={ \"from\": \"/\", \"j_username\": \"admin\", \"j_password\": \"591e0cbfc6f4488291eac4b72c56772a\", \"Jenkins-Crumb\": \"817cfa1009f8e8b8db579a8b969e79bb\" }" \ 'http://1270.0.1:8080/j_acegi_security_check' – Ricardo Pina Arellano Mar 15 '17 at 17:10

0 Answers0