can anyone help me with some certificate issues..? I'm using Landscape, and trying to use the python API, but I get a CA mismatch, but I've downloaded the .pem, and pointed the script to the location of the .pem.. I get a 403, and error: Message: {"message": "The request signature we calculated does not match the signature you provided. Check your key and signing method.", "error": "SignatureDoesNotMatch"}
Trying to do some testing on a LAN without a CA, the script is being run on the server that Landscape is being run on. Here is the contents of my python script, obviously with critical information changed.
#!/usr/bin/python
import os, json, sys
from landscape_api.base import API, HTTPError
# change these accordingly
uri = "https://placeholder.bla"
key = "VQ6PP8Vxxxxxx971NHRY"
secret = "RZ+IOK0s8+UQkRWfsxxxxxxxxLhSFKDwIf5Df"
ca = "~/api/key.pem"
api = API(uri, key, secret, ca)
try:
computers = api.get_computers(query="alert:security-upgrades")
except HTTPError, e:
print ("\nGot server error:\n"
"Code: %d\n"
"Message: %s\n") % (e.code, e.message)
sys.exit(1)
if len(computers) == 0:
print "No computers have pending security upgrades."
else:
for computer in computers:
print "Id:", computer["id"]
print "Title:", computer["title"]
print "Hostname:", computer["hostname"]
print "Last ping:", computer["last_ping_time"]
print "Memory:", computer["total_memory"]
if computer["reboot_required_flag"]:
print "Needs to reboot!"
print