Ask Your Question
0

Logging into Puppet Enterprise console from script

asked 2013-08-15 16:00:01 -0500

GregLarkin gravatar image

I would like to extract some data from the Puppet Enterprise console, and it appears pretty easy to do once authenticated. For instance, I browsed to the URL (PE running in a VM on my machine):

<a href="https://192.168.216.141/node_classes?format=json">https://192.168.216.141/node_classes?format=json</a>

This printed a JSON response that I want to parse and use in a script. However, I'm not sure how to gain access to the URL from a script because the console implements its own authentication form. Does anyone have any insight about how ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-08-15 17:15:15 -0500

Hunner gravatar image

When curling against the Puppet Enterprise console, you have to auth against the RubyCAS server first. A method of doing this would be

$ curl --insecure --cookie-jar cookies.txt --location --data <a href="mailto:'username=user@example.com&password=my_pass'">'username=user@example.com&password=my_pass'</a> 'https://console.example.com/cas/login?service=https://console.example.com/

Further curl queries would have to include the saved cookie to continue the authenticated session:

$ curl --insecure --cookie cookies.txt --cookie-jar cookies.txt 'https://console.example.com/node_classes?format=json'

Alternatively you could run all queries from the console machine itself; authentication is ... (more)

edit flag offensive delete link more

Comments

I can't seem to remove the `mailto` href anchor tags around the login name. Obviously don't include the html tags.

Hunner gravatar imageHunner ( 2013-08-15 17:25:12 -0500 )edit

Excellent, I will try that!

GregLarkin gravatar imageGregLarkin ( 2013-08-15 20:56:41 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-15 16:00:01 -0500

Seen: 420 times

Last updated: Aug 15 '13