<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ISE MNT APIs and Python in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4007134#M454699</link>
    <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/113005"&gt;@hslai&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Posting an update from an earlier post where I mentioned an automation idea utilizing ISE Monitoring APIs in an attempt to gather assistance or suggestions, and help others:&lt;/P&gt;&lt;P&gt;The idea is for an IA member to move a computer object in AD to another security group (quarantine for ex.) upon desire/need to quarantine, run the py script, answer two questions, either shut port or re-auth an endpoint via ISE coa and move them into quarantine based on different authz results in ISE. The questions are:&lt;BR /&gt;1- Do you wish to terminate session or force re-auth?&lt;BR /&gt;2- Enter the endpoint MAC&lt;BR /&gt;Depending on user input the scipt runs different functions (Term_Sess or CoA_Reauth). It then parses the returned xml output to provide feedback to the IA user.&lt;/P&gt;&lt;P&gt;Where I am still working is the Sess_Update part. The goal here would be to provide the IA user with some sort of update that the endpoint session status was successful with actual verification of a vlan or ip move. Two tags I am working on targeting are:&lt;BR /&gt;&amp;lt;vlan&amp;gt;&lt;BR /&gt;&amp;lt;framed_ip_address&amp;gt;&lt;BR /&gt;This way the IA user can identify that a host has now moved to quarantine. The Sess_Update function needs work and is currently not working. However, when issuing a session update get request using curl I see returned xml output. The curl command used to identify the above tags I would like to reference is:&lt;BR /&gt;curl -k --include --user &amp;lt;USER/PASS&amp;gt; --request GET https://&amp;lt;ISE NODE&amp;gt;/admin/API/mnt/Session/MACAddress/XX:XX:XX:XX:XX:XX&lt;/P&gt;&lt;P&gt;See attached for script.&lt;BR /&gt;Thoughts? Any other ideas for endpoint update for IA user? Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jan 2020 18:44:37 GMT</pubDate>
    <dc:creator>Mike.Cifelli</dc:creator>
    <dc:date>2020-01-06T18:44:37Z</dc:date>
    <item>
      <title>ISE MNT APIs and Python</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4007134#M454699</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/113005"&gt;@hslai&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Posting an update from an earlier post where I mentioned an automation idea utilizing ISE Monitoring APIs in an attempt to gather assistance or suggestions, and help others:&lt;/P&gt;&lt;P&gt;The idea is for an IA member to move a computer object in AD to another security group (quarantine for ex.) upon desire/need to quarantine, run the py script, answer two questions, either shut port or re-auth an endpoint via ISE coa and move them into quarantine based on different authz results in ISE. The questions are:&lt;BR /&gt;1- Do you wish to terminate session or force re-auth?&lt;BR /&gt;2- Enter the endpoint MAC&lt;BR /&gt;Depending on user input the scipt runs different functions (Term_Sess or CoA_Reauth). It then parses the returned xml output to provide feedback to the IA user.&lt;/P&gt;&lt;P&gt;Where I am still working is the Sess_Update part. The goal here would be to provide the IA user with some sort of update that the endpoint session status was successful with actual verification of a vlan or ip move. Two tags I am working on targeting are:&lt;BR /&gt;&amp;lt;vlan&amp;gt;&lt;BR /&gt;&amp;lt;framed_ip_address&amp;gt;&lt;BR /&gt;This way the IA user can identify that a host has now moved to quarantine. The Sess_Update function needs work and is currently not working. However, when issuing a session update get request using curl I see returned xml output. The curl command used to identify the above tags I would like to reference is:&lt;BR /&gt;curl -k --include --user &amp;lt;USER/PASS&amp;gt; --request GET https://&amp;lt;ISE NODE&amp;gt;/admin/API/mnt/Session/MACAddress/XX:XX:XX:XX:XX:XX&lt;/P&gt;&lt;P&gt;See attached for script.&lt;BR /&gt;Thoughts? Any other ideas for endpoint update for IA user? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 18:44:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4007134#M454699</guid>
      <dc:creator>Mike.Cifelli</dc:creator>
      <dc:date>2020-01-06T18:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: ISE MNT APIs and Python</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4007138#M454700</link>
      <description>*Note: updated script to exit upon failed or unknown mac CoA result so that Sess_Update is not called. Thanks</description>
      <pubDate>Mon, 06 Jan 2020 18:49:18 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4007138#M454700</guid>
      <dc:creator>Mike.Cifelli</dc:creator>
      <dc:date>2020-01-06T18:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: ISE MNT APIs and Python</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4007770#M454701</link>
      <description>Seeking assistance on the easiest way in python to ensure that user raw input is a valid IP and in int/proper format.&lt;BR /&gt;&lt;BR /&gt;UPDATE:: I have the CoA_Reauth function and Sess_Update functions working now in tandem (ignore spacing from copy/paste):&lt;BR /&gt;def CoA_Reauth():&lt;BR /&gt;HW_ADDR, HOST_IP = Endpoint_Input()&lt;BR /&gt;API_DEVICE = "https://ISE MNT NODE/admin/API/mnt/CoA/Reauth/MNT NODE/" + HW_ADDR + "/0/"&lt;BR /&gt;API_ERS_USER = "&amp;lt;user&amp;gt;","&amp;lt;pass&amp;gt;"&lt;BR /&gt;&lt;BR /&gt;r = requests.get(url=API_DEVICE, auth=API_ERS_USER, verify=True)&lt;BR /&gt;&lt;BR /&gt;#print r.content #prints xml output from ISE; Aided in identifying unique tags to reference&lt;BR /&gt;tree = ET.fromstring(r.content)&lt;BR /&gt;if tree.findtext('results') == 'false':&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;print "ISE CoA Result: Failed"&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;&lt;BR /&gt;elif tree.findtext('results') == 'true':&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;print "ISE Change of Authorization Result: Successful"&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;else:&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;print "ISE CoA Error: Ensure you have the right MAC"&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;Sess_Update(HW_ADDR, HOST_IP)&lt;BR /&gt;&lt;BR /&gt;def Sess_Update(HW_ADDR, HOST_IP):&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;print "Pinging Endpoint old IP Address" #validates change of session&lt;BR /&gt;response = os.system("ping -c 4 " + HOST_IP)&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;&lt;BR /&gt;API_DEVICE = "https://ISE MNT NODE/admin/API/mnt/Session/MACAddress/" + HW_ADDR&lt;BR /&gt;API_ERS_USER = "&amp;lt;user&amp;gt;","&amp;lt;pass&amp;gt;"&lt;BR /&gt;&lt;BR /&gt;r = requests.get(url=API_DEVICE, auth=API_ERS_USER, verify=True)&lt;BR /&gt;print r&lt;BR /&gt;print "**************************************************************************"&lt;BR /&gt;&lt;BR /&gt;tree = ET.fromstring(r.content)&lt;BR /&gt;print "Endpoint is connected to SDA Switch:", tree.findtext('nas_ip_address')&lt;BR /&gt;#print "Endpoint Session Update Vlan:", tree.findtext('vlan') ###for some reason I dont get this xml tag in output&lt;BR /&gt;print "Endpoint new IP address is:", tree.findtext('framed_ip_address')&lt;BR /&gt;&lt;BR /&gt;IA user will provide mac, current IP, and desire for re-auth after moving AD object to quarantine sec group. CoA_Reauth func will trigger reauth, the Sess_Update will get session update to verify change in status and ping the old ip showing user good results. TIA!</description>
      <pubDate>Tue, 07 Jan 2020 18:43:35 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4007770#M454701</guid>
      <dc:creator>Mike.Cifelli</dc:creator>
      <dc:date>2020-01-07T18:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: ISE MNT APIs and Python</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4010920#M454740</link>
      <description>&lt;P&gt;I hope you already found the answer yourself.&lt;/P&gt;
&lt;P&gt;The net says,&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python" target="_blank"&gt;validate IP addresses&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/7629643/how-do-i-validate-the-format-of-a-mac-address" target="_blank"&gt;python - How do I validate the format of a MAC address? - Stack Overflow&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I am not using Python enough to be proficient on it.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 04:07:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4010920#M454740</guid>
      <dc:creator>hslai</dc:creator>
      <dc:date>2020-01-14T04:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: ISE MNT APIs and Python</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4011183#M454741</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/113005"&gt;@hslai&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes. Thank you for your response.&amp;nbsp; I have the script working the way I expect it to work, but I am working with TAC for a CoA issue at the moment.&amp;nbsp; For the IP check::&lt;/P&gt;
&lt;P&gt;import re&lt;/P&gt;
&lt;P&gt;....Skipping lines....&lt;/P&gt;
&lt;P&gt;regex = '''^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(&lt;BR /&gt;25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(&lt;BR /&gt;25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(&lt;BR /&gt;25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)'''&lt;/P&gt;
&lt;P&gt;IP_ADDR = raw_input("Enter IP Address: ")&lt;/P&gt;
&lt;P&gt;if (re.search(regex, IP_ADDR)):&lt;BR /&gt;print IP_ADDR&lt;BR /&gt;else:&lt;BR /&gt;print ("Invalid IP")&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:35:35 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4011183#M454741</guid>
      <dc:creator>Mike.Cifelli</dc:creator>
      <dc:date>2020-01-14T13:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: ISE MNT APIs and Python</title>
      <link>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4011639#M454742</link>
      <description>&lt;P&gt;Great to learn you are able to resolve it yourself. As CoA itself is separate and you are working with TAC, I will close this thread.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 03:43:40 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/ise-mnt-apis-and-python/m-p/4011639#M454742</guid>
      <dc:creator>hslai</dc:creator>
      <dc:date>2020-01-15T03:43:40Z</dc:date>
    </item>
  </channel>
</rss>

