<?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 CIsco ASA REST API HELP in Network Security</title>
    <link>https://community.cisco.com/t5/network-security/cisco-asa-rest-api-help/m-p/3308314#M1064673</link>
    <description>&lt;P&gt;Hi, everybody.&lt;/P&gt;
&lt;P&gt;I'm trying to perform sync of ACL configuration from one ASA to another.&lt;/P&gt;
&lt;P&gt;Both devices have the same version of OS and REST-API&lt;/P&gt;
&lt;P&gt;On source ASA I have this ACL:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rest_api_1.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/6020i918FBF2F794EE9BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="rest_api_1.png" alt="rest_api_1.png" /&gt;&lt;/span&gt;First two rules I remove from screenshot &lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;since they are not relevant to my question&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Using REST API, I get ACEs from ACL and trying to create them on target device.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;To do that i'm using python.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;And when I trying to POST (using REST API) third rule (see screenshot above) on target device&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;url = 'https://192.168.1.1/api/objects/extendedacls/Anyconnect/aces'&lt;BR /&gt;rule_json = {'kind':'object#ExtendedACE','ruleLogging':{'logStatus':'Default','logInterval':300},'isAccessRule':False,'destinationAddress': {'kind':'IPv4Address','value':'10.12.73.10'},'remarks':[],'destinationService':{'kind':'TcpUdpService','value':'tcp-udp/domain'},'permit': True,'active': True,'position': 3,'sourceAddress': {'kind':'objectRef#NetworkObj','objectId':'net-10.12.201.0_24'}}&lt;BR /&gt;requests.post(url, data=json.dumps(rule_json), headers=self.HEADERS, auth=self.cred, verify=self.verify_cert, timeout=self.timeout)&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;I getting this error&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;[
{'code': '', 
'details': "\naccess-list Anyconnect line 3 extended permit tcp-udp object net-10.12.201.0_24 host 10.12.73.10 eq domain \n\nERROR: % Invalid input detected at '^' marker.\n", 
'level': u'Error'}
]&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;So, as I understand - when ASA receive REST API POST REQUEST: behind the scenes executed CLI command, but in this case there is error because you can not use "tcp-udp" protocol in ACE statement.&lt;/P&gt;
&lt;P&gt;So, my question is: is this bug or feature?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Feb 2020 15:06:18 GMT</pubDate>
    <dc:creator>Denis Orlov</dc:creator>
    <dc:date>2020-02-21T15:06:18Z</dc:date>
    <item>
      <title>CIsco ASA REST API HELP</title>
      <link>https://community.cisco.com/t5/network-security/cisco-asa-rest-api-help/m-p/3308314#M1064673</link>
      <description>&lt;P&gt;Hi, everybody.&lt;/P&gt;
&lt;P&gt;I'm trying to perform sync of ACL configuration from one ASA to another.&lt;/P&gt;
&lt;P&gt;Both devices have the same version of OS and REST-API&lt;/P&gt;
&lt;P&gt;On source ASA I have this ACL:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rest_api_1.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/6020i918FBF2F794EE9BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="rest_api_1.png" alt="rest_api_1.png" /&gt;&lt;/span&gt;First two rules I remove from screenshot &lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;since they are not relevant to my question&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Using REST API, I get ACEs from ACL and trying to create them on target device.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;To do that i'm using python.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;And when I trying to POST (using REST API) third rule (see screenshot above) on target device&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;url = 'https://192.168.1.1/api/objects/extendedacls/Anyconnect/aces'&lt;BR /&gt;rule_json = {'kind':'object#ExtendedACE','ruleLogging':{'logStatus':'Default','logInterval':300},'isAccessRule':False,'destinationAddress': {'kind':'IPv4Address','value':'10.12.73.10'},'remarks':[],'destinationService':{'kind':'TcpUdpService','value':'tcp-udp/domain'},'permit': True,'active': True,'position': 3,'sourceAddress': {'kind':'objectRef#NetworkObj','objectId':'net-10.12.201.0_24'}}&lt;BR /&gt;requests.post(url, data=json.dumps(rule_json), headers=self.HEADERS, auth=self.cred, verify=self.verify_cert, timeout=self.timeout)&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;I getting this error&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;[
{'code': '', 
'details': "\naccess-list Anyconnect line 3 extended permit tcp-udp object net-10.12.201.0_24 host 10.12.73.10 eq domain \n\nERROR: % Invalid input detected at '^' marker.\n", 
'level': u'Error'}
]&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;So, as I understand - when ASA receive REST API POST REQUEST: behind the scenes executed CLI command, but in this case there is error because you can not use "tcp-udp" protocol in ACE statement.&lt;/P&gt;
&lt;P&gt;So, my question is: is this bug or feature?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 15:06:18 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/cisco-asa-rest-api-help/m-p/3308314#M1064673</guid>
      <dc:creator>Denis Orlov</dc:creator>
      <dc:date>2020-02-21T15:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: CIsco ASA REST API HELP</title>
      <link>https://community.cisco.com/t5/network-security/cisco-asa-rest-api-help/m-p/3308788#M1064674</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;ADDITIONAL INFORMATION FOR QUESTION&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1) When I get ACE using REST API (via Python) JSON-structure of ACE looks like following way:&lt;/P&gt;
&lt;PRE&gt;{&lt;BR /&gt;'sourceService': {'kind': 'NetworkProtocol', 'value': 'tcp-udp'},&lt;BR /&gt;'kind': 'object#ExtendedACE',&lt;BR /&gt;'objectId': '2143418028',&lt;BR /&gt;'ruleLogging': {'logStatus': 'Default', 'logInterval': 300},&lt;BR /&gt;'isAccessRule': False,&lt;BR /&gt;'destinationAddress': {u'kind': u'IPv4Address', u'value': u'10.12.73.10'},&lt;BR /&gt;'remarks': [],&lt;BR /&gt;'destinationService': {u'kind': u'TcpUdpService', u'value': u'tcp-udp/domain'},&lt;BR /&gt;'permit': True,&lt;BR /&gt;'active': True,&lt;BR /&gt;'position': 3,&lt;BR /&gt;'sourceAddress': {u'kind': u'objectRef#NetworkObj', u'objectId': u'net-10.12.201.0_24'},&lt;BR /&gt;'selfLink': u'https://192.168.51.254/api/objects/extendedacls/Anyconnect/aces/2143418028'&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;2) After some manipulations I prepare following JSON-structure for POSTing to another device:&lt;/P&gt;
&lt;PRE&gt;{
'sourceService': {'kind': 'NetworkProtocol', 'value': 'tcp-udp'},&lt;BR /&gt;'destinationAddress': {'kind': 'IPv4Address', 'value': '10.12.73.10'},
'destinationService': {'kind': 'TcpUdpService', 'value': 'tcp-udp/domain'},&lt;BR /&gt;'ruleLogging': {'logStatus': 'Default', 'logInterval': 100},
'permit': True,
'remarks': [],
'position': 3,
'sourceAddress': {'kind': 'objectRef#NetworkObj', 'objectId': 'net-10.12.201.0_24'},
'active': True
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;3) After posting JSON-structure to destination device, I'm getting following error:&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;'code': '',&lt;/P&gt;
&lt;P&gt;'details': "\naccess-list Anyconnect line 1 extended permit tcp-udp object net-10.12.201.0_24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^host 10.12.73.10 eq domain \n\nERROR: % Invalid input detected at '^' marker.\n",&lt;/P&gt;
&lt;P&gt;'level': 'Error'&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;4) After some research I also understand following.&lt;/P&gt;
&lt;P&gt;If I use this JSON-structure to create ACE in ACL&lt;/P&gt;
&lt;PRE&gt;{
              "sourceAddress": {
                "kind":"objectRef#NetworkObj",
                "objectId":"net-10.12.201.0_24"
              },
              "destinationAddress": {
                "kind":"IPv4Address",
                "value":"10.12.73.10"
              },        
              "destinationService": {
                "kind":"TcpUdpService",
                "value":"&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;tcp/domain&lt;/FONT&gt;&lt;/STRONG&gt;"
              },
             "ruleLogging": {
                "logStatus": "Default",
                "logInterval": 100
              },
              "remarks": [],
              "permit": True,
              "active": True,
              "position": 3,
            }&lt;/PRE&gt;
&lt;P&gt;POST request using Python is successfull and in sh running-config there is following ACE&lt;/P&gt;
&lt;PRE&gt;access-list Anyconnect extended permit &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;tcp&lt;/STRONG&gt;&lt;/FONT&gt; object net-10.12.201.0_24 host 10.12.73.10 eq domain&lt;/PRE&gt;
&lt;P&gt;If I use this JSON-structure to crete ACE in ACL&lt;/P&gt;
&lt;PRE&gt;{
              "sourceAddress": {
                "kind":"objectRef#NetworkObj",
                "objectId":"net-10.12.201.0_24"
              },
              "destinationAddress": {
                "kind":"IPv4Address",
                "value":"10.12.73.10"
              },        
              "destinationService": {
                "kind":"TcpUdpService",
                "value":"&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;udp/domain&lt;/STRONG&gt;&lt;/FONT&gt;"
              },
             "ruleLogging": {
                "logStatus": "Default",
                "logInterval": 100
              },
              "remarks": [],
              "permit": True,
              "active": True,
              "position": 3,
            }&lt;/PRE&gt;
&lt;P&gt;POST request using Python is successfull too and in sh running-config there is following ACE&lt;/P&gt;
&lt;PRE&gt;access-list Anyconnect extended permit &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;udp&lt;/STRONG&gt;&lt;/FONT&gt; object net-10.12.201.0_24 host 10.12.73.10 eq domain&lt;/PRE&gt;
&lt;P&gt;But if I trying to POST following JSON-structure&lt;/P&gt;
&lt;PRE&gt;{
              "sourceAddress": {
                "kind":"objectRef#NetworkObj",
                "objectId":"net-10.12.201.0_24"
              },
              "destinationAddress": {
                "kind":"IPv4Address",
                "value":"10.12.73.10"
              },        
              "destinationService": {
                "kind":"TcpUdpService",
                "value":"&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;tcp-udp/domain&lt;/FONT&gt;&lt;/STRONG&gt;"
              },
             "ruleLogging": {
                "logStatus": "Default",
                "logInterval": 100
              },
              "remarks": [],
              "permit": True,
              "active": True,
              "position": 3,
            }&lt;/PRE&gt;
&lt;P&gt;I'm getting error as I wrote earlier.&lt;/P&gt;
&lt;P&gt;Based on error detail message, that I receive when performing POST request:&lt;/P&gt;
&lt;PRE&gt;access-list Anyconnect line 1 extended permit &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;tcp-udp&lt;/STRONG&gt;&lt;/FONT&gt; object net-10.12.201.0_24 host 10.12.73.10 eq domain \n\nERROR: % Invalid input detected at '^' marker.\n&lt;/PRE&gt;
&lt;P&gt;I can say, that internal REST API logic &lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;erroneously&lt;/SPAN&gt;&lt;/SPAN&gt; trying to use "tcp-udp" as protocol number while creating ACE. And such behavior lead to error.&lt;/P&gt;
&lt;P&gt;But I expect that in confuguration I will get this ACE&lt;/P&gt;
&lt;PRE&gt;access-list Abyconnect extended permit &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;object-group TCPUDP&lt;/FONT&gt;&lt;/STRONG&gt; object net-10.12.201.0_24 host 10.12.73.10 eq domain &lt;/PRE&gt;
&lt;P&gt;Actually object-group TCPUDP normally created automatically when you create ACE with tcp/udp destination service in ASDM.&lt;/P&gt;
&lt;P&gt;Based on this information I making conclusion that something is wrong in Cisco ASA REST API.&lt;/P&gt;
&lt;P&gt;May be there is some trick in adding ACE with tcp-udp destination service, but there is no corresponding information in official documantation &lt;A title="ASA REST API DOCUMENTATION" href="https://www.cisco.com/c/dam/en/us/td/docs/security/asa/api/asapedia_rest_api_132.pdf" target="_self"&gt;https://www.cisco.com/c/dam/en/us/td/docs/security/asa/api/asapedia_rest_api_132.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please, can somebody clarify this problem?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 11:27:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-security/cisco-asa-rest-api-help/m-p/3308788#M1064674</guid>
      <dc:creator>Denis Orlov</dc:creator>
      <dc:date>2018-01-10T11:27:20Z</dc:date>
    </item>
  </channel>
</rss>

