-
-
Save rphillips/62d2af0cdc0f4023efc0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local dns = require('dns') | |
local tls = require('tls') | |
local json = require('json') | |
local QUERIES = { | |
'_monitoringagent._tcp.dfw1.stage.monitoring.api.rackspacecloud.com', | |
'_monitoringagent._tcp.ord1.stage.monitoring.api.rackspacecloud.com', | |
'_monitoringagent._tcp.lon3.stage.monitoring.api.rackspacecloud.com', | |
} | |
local connect = function(host, port) | |
local client, options, onTlsConnect | |
options = { | |
host = host, | |
port = port | |
} | |
function onTlsConnect() | |
local onError, handshake | |
handshake = { | |
v = "1", | |
id = "0", | |
source = 'agentA', | |
target = 'endpoint', | |
method = 'handshake.hello', | |
params = { | |
token = 'MYTOKEN', | |
agent_id = 'MYUID', | |
agent_name = 'Rackspace Monitoring Agent', | |
process_version = '1.0.0', | |
bundle_version = '1.0.0' | |
} | |
} | |
for k, v in pairs(client._tls.ssl:current_cipher()) do | |
p(k .. ' = ' .. v) | |
end | |
function onError(err) | |
p(err) | |
end | |
client:on('data', p) | |
client:on('error', onError) | |
local data = json.stringify(handshake) .. '\n' | |
p(data) | |
client:write(data) | |
end | |
client = tls.connect(options, onTlsConnect) | |
end | |
local onAnswer = function(err, answer) | |
if err then | |
return p(err) | |
end | |
connect(answer[1].target, 443) | |
end | |
dns.resolveSrv(QUERIES[1], onAnswer) | |
dns.resolveSrv(QUERIES[2], onAnswer) | |
dns.resolveSrv(QUERIES[3], onAnswer) | |
collectgarbage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'bits = 256' | |
'version = TLSv1/SSLv3' | |
'id = 50331701' | |
'algbits = 256' | |
'name = AES256-SHA' | |
'description = AES256-SHA SSLv3 Kx=RSA Au=RSA Enc=AES(256) Mac=SHA1\n' | |
'{"target":"endpoint","source":"agentA","id":"0","params":{"agent_id":"MYUID","agent_name":"Rackspace Monitoring Agent","process_version":"1.0.0","token":"MYTOKEN","bundle_version":"1.0.0"},"v":"1","method":"handshake.hello"}\n' | |
'{"v":"1","id":"0","target":"agentA","source":"endpoint","error":{"code":400,"field":"token","message":"Invalid characters"},"result":null}\n' | |
'bits = 256' | |
'version = TLSv1/SSLv3' | |
'id = 50331701' | |
'algbits = 256' | |
'name = AES256-SHA' | |
'description = AES256-SHA SSLv3 Kx=RSA Au=RSA Enc=AES(256) Mac=SHA1\n' | |
'{"target":"endpoint","source":"agentA","id":"0","params":{"agent_id":"MYUID","agent_name":"Rackspace Monitoring Agent","process_version":"1.0.0","token":"MYTOKEN","bundle_version":"1.0.0"},"v":"1","method":"handshake.hello"}\n' | |
'bits = 256' | |
'version = TLSv1/SSLv3' | |
'id = 50331701' | |
'algbits = 256' | |
'name = AES256-SHA' | |
'description = AES256-SHA SSLv3 Kx=RSA Au=RSA Enc=AES(256) Mac=SHA1\n' | |
'{"target":"endpoint","source":"agentA","id":"0","params":{"agent_id":"MYUID","agent_name":"Rackspace Monitoring Agent","process_version":"1.0.0","token":"MYTOKEN","bundle_version":"1.0.0"},"v":"1","method":"handshake.hello"}\n' | |
'{"v":"1","id":"0","target":"agentA","source":"endpoint","error":{"code":400,"field":"token","message":"Invalid characters"},"result":null}\n' | |
'{"v":"1","id":"0","target":"agentA","source":"endpoint","error":{"code":400,"field":"token","message":"Invalid characters"},"result":null}\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment