<?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 Re: Cisco ISE ON VPN with python integration in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/cisco-ise-on-vpn-with-python-integration/m-p/4396734#M567063</link>
    <description>&lt;P&gt;Hi Mike&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am try to&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;create internal&amp;nbsp;&amp;nbsp;users with my Python script for Cisco ISE This is my code I&amp;nbsp;&amp;nbsp;created&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#!/usr/bin/python&lt;BR /&gt;import http.client&lt;BR /&gt;import base64&lt;BR /&gt;import ssl&lt;BR /&gt;import sys&lt;BR /&gt;import os&lt;BR /&gt;argv = sys.argv[1]&lt;BR /&gt;print ("The name of the script: ", sys.argv[0])&lt;BR /&gt;print ("The argument are: ", argv)&lt;BR /&gt;#parameters&lt;/P&gt;&lt;P&gt;Id = sys.argv[4] # "B100"&lt;BR /&gt;userName = sys.argv[5] # "Robert"&lt;BR /&gt;firstName = sys.argv[6] # "Robert"&lt;BR /&gt;lastName = sys.argv[7] # "Mensah"&lt;BR /&gt;password = sys.argv[8] # "Password1"&lt;BR /&gt;emailAddress = sys.argv[9] # "rmensah@cisco.com&lt;BR /&gt;expiryDate = sys.argv[11] # “12/26/2020”&lt;BR /&gt;identityGroups = sys.argv[10] # “identityGroups”&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# host and authentication credentials&lt;BR /&gt;host = sys.argv[1] # "192.198”.1.1&lt;BR /&gt;user = sys.argv[2] # “ers-admin”&lt;BR /&gt;password = sys.argv[3] # “admin20!”&lt;/P&gt;&lt;P&gt;conn = http.client.HTTPSConnection("{}:9060".format(host), context=ssl.SSLContext(ssl.PROTOCOL_TLS))&lt;/P&gt;&lt;P&gt;creds = str.encode(':'.join((user, password)))&lt;BR /&gt;encodedAuth = bytes.decode(base64.b64encode(creds))&lt;/P&gt;&lt;P&gt;req_body_json = """{{&lt;/P&gt;&lt;P&gt;\"InternalUser"\ : {&lt;/P&gt;&lt;P&gt;"id" : "\{}\",&lt;/P&gt;&lt;P&gt;"userName" : "\{}\",&lt;/P&gt;&lt;P&gt;"description" : "\{}\",&lt;/P&gt;&lt;P&gt;"enabled" : true,&lt;/P&gt;&lt;P&gt;"email" : "\{}\",&lt;/P&gt;&lt;P&gt;"password" : "\{}\",&lt;/P&gt;&lt;P&gt;"firstName" : "\{}\",&lt;/P&gt;&lt;P&gt;"lastName" : "\{}\",&lt;/P&gt;&lt;P&gt;"changePassword" : true,&lt;/P&gt;&lt;P&gt;"identityGroups" : "\{}\",&lt;/P&gt;&lt;P&gt;"expiryDateEnabled" : false,&lt;/P&gt;&lt;P&gt;"expiryDate" : "\{}\",&lt;/P&gt;&lt;P&gt;"enablePassword" : "enablePassword",&lt;/P&gt;&lt;P&gt;"customAttributes" : {&lt;/P&gt;&lt;P&gt;"key1" : "value1",&lt;/P&gt;&lt;P&gt;"key2" : "value3"&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;"passwordIDStore" : "Internal Users"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}}&lt;BR /&gt;}}""".format(Id,UserNname,firstName,lastName,emailAddress,password,identityGroups,expiryDate)&lt;BR /&gt;headers = {&lt;BR /&gt;'accept': "application/json",&lt;BR /&gt;'content-type': "application/json",&lt;BR /&gt;'authorization': " ".join(("Basic",encodedAuth)),&lt;BR /&gt;'cache-control': "no-cache",&lt;BR /&gt;}&lt;BR /&gt;conn.request("POST", "/ers/config/internaluser/", headers=headers, body=req_body_json)&lt;BR /&gt;&lt;BR /&gt;es = conn.getresponse()&lt;BR /&gt;data = res.read()&lt;/P&gt;&lt;P&gt;print("Status: {}".format(res.status))&lt;BR /&gt;print("Header:\n{}".format(res.headers))&lt;BR /&gt;print("Body:\n{}".format(data.decode("utf-8")))&lt;BR /&gt;print (req_req_json)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this error while&amp;nbsp; executing the above code&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\ghibuser\Desktop\ISEInternalUserTest.py", line 38, in &amp;lt;module&amp;gt;&lt;BR /&gt;req_body_json = """{{&lt;BR /&gt;IndexError: Replacement index 7 out of range for positional args tuple&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any support will be welcomed&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 May 2021 10:27:36 GMT</pubDate>
    <dc:creator>RichardAcolatse8417</dc:creator>
    <dc:date>2021-05-03T10:27:36Z</dc:date>
    <item>
      <title>Cisco ISE ON VPN with python integration</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-on-vpn-with-python-integration/m-p/4395331#M566965</link>
      <description>&lt;P&gt;I want to how i can connect to a Cisco ISE on VPN network with a&amp;nbsp; python API script&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 10:23:05 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-on-vpn-with-python-integration/m-p/4395331#M566965</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-04-29T10:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE ON VPN with python integration</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-on-vpn-with-python-integration/m-p/4395388#M566974</link>
      <description>&lt;P&gt;Please see/use the following resources as they will provide great examples:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.cisco.com/t5/security-documents/ise-ers-api-examples/ta-p/3622623" target="_blank"&gt;ISE ERS API Examples - Cisco Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Online ISE SDK -&amp;nbsp;&lt;SPAN&gt;https://&amp;lt;ISE-ADMIN-NODE&amp;gt;:9060/ers/sdk&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.cisco.com/c/en/us/td/docs/security/ise/2-4/api_ref_guide/api_ref_book/ise_api_ref_ers1.html" target="_blank"&gt;Cisco Identity Services Engine API Reference Guide, Release 2.x - Introduction to External RESTful Services API [Cisco Identity Services Engine] - Cisco&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 11:55:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-on-vpn-with-python-integration/m-p/4395388#M566974</guid>
      <dc:creator>Mike.Cifelli</dc:creator>
      <dc:date>2021-04-29T11:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cisco ISE ON VPN with python integration</title>
      <link>https://community.cisco.com/t5/network-access-control/cisco-ise-on-vpn-with-python-integration/m-p/4396734#M567063</link>
      <description>&lt;P&gt;Hi Mike&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am try to&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;create internal&amp;nbsp;&amp;nbsp;users with my Python script for Cisco ISE This is my code I&amp;nbsp;&amp;nbsp;created&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#!/usr/bin/python&lt;BR /&gt;import http.client&lt;BR /&gt;import base64&lt;BR /&gt;import ssl&lt;BR /&gt;import sys&lt;BR /&gt;import os&lt;BR /&gt;argv = sys.argv[1]&lt;BR /&gt;print ("The name of the script: ", sys.argv[0])&lt;BR /&gt;print ("The argument are: ", argv)&lt;BR /&gt;#parameters&lt;/P&gt;&lt;P&gt;Id = sys.argv[4] # "B100"&lt;BR /&gt;userName = sys.argv[5] # "Robert"&lt;BR /&gt;firstName = sys.argv[6] # "Robert"&lt;BR /&gt;lastName = sys.argv[7] # "Mensah"&lt;BR /&gt;password = sys.argv[8] # "Password1"&lt;BR /&gt;emailAddress = sys.argv[9] # "rmensah@cisco.com&lt;BR /&gt;expiryDate = sys.argv[11] # “12/26/2020”&lt;BR /&gt;identityGroups = sys.argv[10] # “identityGroups”&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# host and authentication credentials&lt;BR /&gt;host = sys.argv[1] # "192.198”.1.1&lt;BR /&gt;user = sys.argv[2] # “ers-admin”&lt;BR /&gt;password = sys.argv[3] # “admin20!”&lt;/P&gt;&lt;P&gt;conn = http.client.HTTPSConnection("{}:9060".format(host), context=ssl.SSLContext(ssl.PROTOCOL_TLS))&lt;/P&gt;&lt;P&gt;creds = str.encode(':'.join((user, password)))&lt;BR /&gt;encodedAuth = bytes.decode(base64.b64encode(creds))&lt;/P&gt;&lt;P&gt;req_body_json = """{{&lt;/P&gt;&lt;P&gt;\"InternalUser"\ : {&lt;/P&gt;&lt;P&gt;"id" : "\{}\",&lt;/P&gt;&lt;P&gt;"userName" : "\{}\",&lt;/P&gt;&lt;P&gt;"description" : "\{}\",&lt;/P&gt;&lt;P&gt;"enabled" : true,&lt;/P&gt;&lt;P&gt;"email" : "\{}\",&lt;/P&gt;&lt;P&gt;"password" : "\{}\",&lt;/P&gt;&lt;P&gt;"firstName" : "\{}\",&lt;/P&gt;&lt;P&gt;"lastName" : "\{}\",&lt;/P&gt;&lt;P&gt;"changePassword" : true,&lt;/P&gt;&lt;P&gt;"identityGroups" : "\{}\",&lt;/P&gt;&lt;P&gt;"expiryDateEnabled" : false,&lt;/P&gt;&lt;P&gt;"expiryDate" : "\{}\",&lt;/P&gt;&lt;P&gt;"enablePassword" : "enablePassword",&lt;/P&gt;&lt;P&gt;"customAttributes" : {&lt;/P&gt;&lt;P&gt;"key1" : "value1",&lt;/P&gt;&lt;P&gt;"key2" : "value3"&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;"passwordIDStore" : "Internal Users"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}}&lt;BR /&gt;}}""".format(Id,UserNname,firstName,lastName,emailAddress,password,identityGroups,expiryDate)&lt;BR /&gt;headers = {&lt;BR /&gt;'accept': "application/json",&lt;BR /&gt;'content-type': "application/json",&lt;BR /&gt;'authorization': " ".join(("Basic",encodedAuth)),&lt;BR /&gt;'cache-control': "no-cache",&lt;BR /&gt;}&lt;BR /&gt;conn.request("POST", "/ers/config/internaluser/", headers=headers, body=req_body_json)&lt;BR /&gt;&lt;BR /&gt;es = conn.getresponse()&lt;BR /&gt;data = res.read()&lt;/P&gt;&lt;P&gt;print("Status: {}".format(res.status))&lt;BR /&gt;print("Header:\n{}".format(res.headers))&lt;BR /&gt;print("Body:\n{}".format(data.decode("utf-8")))&lt;BR /&gt;print (req_req_json)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this error while&amp;nbsp; executing the above code&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\ghibuser\Desktop\ISEInternalUserTest.py", line 38, in &amp;lt;module&amp;gt;&lt;BR /&gt;req_body_json = """{{&lt;BR /&gt;IndexError: Replacement index 7 out of range for positional args tuple&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any support will be welcomed&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 10:27:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/cisco-ise-on-vpn-with-python-integration/m-p/4396734#M567063</guid>
      <dc:creator>RichardAcolatse8417</dc:creator>
      <dc:date>2021-05-03T10:27:36Z</dc:date>
    </item>
  </channel>
</rss>

