<?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: 'Create internal user' Python script in Network Access Control</title>
    <link>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4405462#M567384</link>
    <description>&lt;P&gt;You are most likely using an untrusted, self-signed certificate on your ISE node and the Python SSL library does not like that. Also you seem to be explicitly trying to use &lt;FONT face="courier new,courier"&gt;ssl.PROTOCOL_TLSv1&lt;/FONT&gt; and perhaps your ISE node has TLS 1.0 disabled for security reasons? I don't know why you want to specifically use TLS 1.0 in your script but make sure you have enabled it:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/120757i832E3B92A2AE9725/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 May 2021 14:39:41 GMT</pubDate>
    <dc:creator>thomas</dc:creator>
    <dc:date>2021-05-19T14:39:41Z</dc:date>
    <item>
      <title>'Create internal user' Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4405349#M567378</link>
      <description>&lt;P&gt;Hi Everyone&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;would like to create internal&amp;nbsp; users using Python script.&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;I have installed 3.9.2 Python and saved the .py file and run the execution using ERS SDK guide for ISE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I got this error while run the code through&amp;nbsp; command line&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1123)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/usr/bin/env python&lt;/P&gt;&lt;P&gt;import http.client&lt;BR /&gt;import base64&lt;BR /&gt;import ssl&lt;BR /&gt;import sys&lt;BR /&gt;import urllib3&lt;BR /&gt;urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;/P&gt;&lt;P&gt;#parameters&lt;BR /&gt;name = sys.argv[4] # "chris"&lt;BR /&gt;first = sys.argv[5] # "Chris"&lt;BR /&gt;last = sys.argv[6] # "Colombus"&lt;BR /&gt;passwd = sys.argv[7] # "Password1"&lt;BR /&gt;email = sys.argv[8] # "chris@gh.com"&lt;BR /&gt;expiry_date = sys.argv[9] # "2021-12-30"&lt;/P&gt;&lt;P&gt;# host and authentication credentials&lt;BR /&gt;host = sys.argv[1] # "192.168.31.15"&lt;BR /&gt;user = sys.argv[2] # "ersad"&lt;BR /&gt;password = sys.argv[3] # "oFlPRrne1"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;conn = http.client.HTTPSConnection("{}:9060".format(host), context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))&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;BR /&gt;"InternalUser" : {{&lt;BR /&gt;"name" : "{}",&lt;BR /&gt;"enabled" : true,&lt;BR /&gt;"email" : "{}",&lt;BR /&gt;"password" : "{}",&lt;BR /&gt;"firstName" : "{}",&lt;BR /&gt;"lastName" : "{}",&lt;BR /&gt;"changePassword" : true,&lt;BR /&gt;"expiryDateEnabled" : true,&lt;BR /&gt;"expiryDate" : "{}",&lt;BR /&gt;"enablePassword" : "{}",&lt;BR /&gt;"customAttributes" : {{&lt;BR /&gt;}},&lt;BR /&gt;"passwordIDStore" : "Internal Users"&lt;BR /&gt;}}&lt;BR /&gt;}}&lt;BR /&gt;""".format(name,email,passwd,first,last,expiry_date,passwd)&lt;/P&gt;&lt;P&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;/P&gt;&lt;P&gt;conn.request("POST", "/ers/config/internaluser/", headers=headers, body=req_body_json)&lt;/P&gt;&lt;P&gt;res = 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;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would appreciated&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 11:38:22 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4405349#M567378</guid>
      <dc:creator>Richie20</dc:creator>
      <dc:date>2021-05-19T11:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: 'Create internal user' Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4405462#M567384</link>
      <description>&lt;P&gt;You are most likely using an untrusted, self-signed certificate on your ISE node and the Python SSL library does not like that. Also you seem to be explicitly trying to use &lt;FONT face="courier new,courier"&gt;ssl.PROTOCOL_TLSv1&lt;/FONT&gt; and perhaps your ISE node has TLS 1.0 disabled for security reasons? I don't know why you want to specifically use TLS 1.0 in your script but make sure you have enabled it:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/120757i832E3B92A2AE9725/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 14:39:41 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4405462#M567384</guid>
      <dc:creator>thomas</dc:creator>
      <dc:date>2021-05-19T14:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: 'Create internal user' Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4405494#M567386</link>
      <description>&lt;P&gt;the TLS 1.0 is already enabled in the ISE node but I still get the same error as&amp;nbsp; well&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 13:25:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4405494#M567386</guid>
      <dc:creator>Richie20</dc:creator>
      <dc:date>2021-05-20T13:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: 'Create internal user' Python script</title>
      <link>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4406519#M567455</link>
      <description>&lt;P&gt;&lt;SPAN&gt;the TLS 1.0 is already enabled in the ISE node but I still get the same error as&amp;nbsp; well&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help is welcomed &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 10:20:04 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-access-control/create-internal-user-python-script/m-p/4406519#M567455</guid>
      <dc:creator>Richie20</dc:creator>
      <dc:date>2021-05-21T10:20:04Z</dc:date>
    </item>
  </channel>
</rss>

