From 195b378ce2fe28fcb31ffd784b0531475a9e129b Mon Sep 17 00:00:00 2001 From: Stephen von Takach Date: Fri, 9 Mar 2018 15:09:35 +1100 Subject: [PATCH] (cisco:ise) initial docs and basic research --- lib/cisco/ise.md | 130 +++++++++++++++++++++++++++++++++++++++++++++++ lib/cisco/ise.rb | 25 +++++++++ 2 files changed, 155 insertions(+) create mode 100644 lib/cisco/ise.md create mode 100755 lib/cisco/ise.rb diff --git a/lib/cisco/ise.md b/lib/cisco/ise.md new file mode 100644 index 00000000..3c23edcd --- /dev/null +++ b/lib/cisco/ise.md @@ -0,0 +1,130 @@ + +# Cisco ISE Service + +Based on documentation from + +* https://github.com/marksull/cisco-ise/blob/master/lib/cisco-ise/http-session.rb +* https://www.cisco.com/c/en/us/td/docs/security/ise/1-4/api_ref_guide/api_ref_book/ise_api_ref_ch1.html +* https://www.cisco.com/c/en/us/td/docs/security/ise/1-4/api_ref_guide/api_ref_book/ise_api_ref_ch2.html + + +## Getting User Session Data + +API path: + +* /admin/API/mnt/Session/UserName/username +* Uses basic authentication + + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + diff --git a/lib/cisco/ise.rb b/lib/cisco/ise.rb new file mode 100755 index 00000000..00dc906c --- /dev/null +++ b/lib/cisco/ise.rb @@ -0,0 +1,25 @@ +require 'uv-rays' +require 'nokogiri' + +# Documentation: +# https://www.cisco.com/c/en/us/td/docs/security/ise/1-4/api_ref_guide/api_ref_book/ise_api_ref_ch1.html + +module Cisco; end +class Cisco::ISE + def initialize(host, user, pass, floor_mappings) + @host = UV::HttpEndpoint.new(host) + @ldap = Array(use_ou) + @headers = { + authorization: [user, pass] + } + end + + def locate(user: nil) + resp = @host.get(path: "/admin/API/mnt/Session/UserName/#{user}", headers: @headers).value + + return nil if resp.status == 404 + raise "request failed #{resp.status}\n#{resp.body}" unless (200...300).include?(resp.status) + + session = Nokogiri::XML(resp.body) + end +end