503 response to a taxii 1.1 discovery request when using Libtaxii againt limo


#1

Problem

If you are attempting to do a taxii 1.1 discovery with libtaxii against limo you may encounter the following issue:

HTTP ERROR Code 503 Service Unavailable.

Solution

You will need to make sure that you pass the header “Host: limo.anomali.com” to the Discovery Request, see example below (esp. the lines in **bold**):

import libtaxii as taxii

import libtaxii.clients as taxii_clients

import libtaxii.messages_11 as tm11

from urllib2 import URLError

Set taxii version, message id and extended headers

TAXII_VERSION = taxii.VID_TAXII_XML_11

message_id = str(tm11.generate_message_id())

Set up the taxii client

credentials = {‘username’: ‘guest’, ‘password’: ‘guest’}

client = taxii_clients.HttpClient()

client.set_use_https(True)

client.set_auth_type(taxii_clients.HttpClient.AUTH_BASIC)

client.set_auth_credentials(credentials)

Set up the discovery request

req_msg = tm11.DiscoveryRequest(message_id=message_id)

headers = {

‘host’: ‘limo.anomali.com

}

print ‘Discovery Request: \n{}\n’.format(req_msg.to_xml(pretty_print=True))

try:

resp = client.call_taxii_service2(“limo.anomali.com”, “/api/v1/taxii/taxii-discovery-service/”, TAXII_VERSION, req_msg.to_xml(pretty_print=True), headers=headers)

except URLError as e:

print e

sys.exit(‘Could not connect to taxii service.’)

Let me know if find this helpful by simply clicking the Like Button or comment below if you have any further questions or issues?


#2

This issue was also present when using api.threatstream.com when going through a proxy. Thanks for the recommendation, did not see any supporting documentation otherwise.