<?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: PAN CLI: Verifying Service Object Existence and Adding New Service Objects in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/pan-cli-verifying-service-object-existence-and-adding-new/m-p/152965#M50527</link>
    <description>&lt;P&gt;so I'll indirectly answer this question and hopefully this will rock your world.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# show&lt;/PRE&gt;&lt;P&gt;will display the candidate configuration, but by default, it's in XML format. so _outside_ of configure mode (for some reason), run the following command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;set cli config-output-format set&lt;/PRE&gt;&lt;P&gt;that will set the show output to set commands. now when you run show in configure mode, you will see each entry in a clear, easy to use CLI syntax. You can actually use the service parameter to see just the services.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@PA-220# show service
set service service-https-mgmt protocol tcp port 4443
set service service-ssh protocol tcp port 22
set service service-plex protocol tcp port 32400&lt;/PRE&gt;&lt;P&gt;not only does this show you all the custom services (note the predefined service-http and service-https are not displayed), but it gives you the exact syntax to add additional ones via the CLI. If you have a lot of services, you can also supplement the command with | match &amp;lt;filter&amp;gt; at the end so it shows only matching service objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@PA-220# show service | match "tcp port 22"
set service service-ssh protocol tcp port 22&lt;/PRE&gt;&lt;P&gt;so to answer your questions, if you create a service object with the same name as an existing one, it will let you and just overwrite the existing object's values. if you create a new service object with a different name but the same protocol/port, it also well let you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my sage advice is to keep it simple and develop an administrative policy so that service objects are simply named for their protocol/port, such as tcp_22. using app names like I have before helps read better, but unless I also plan to have a service-sftp object, I'm just going to create a lot of unncessary 'duplicate' objects.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2017 01:51:58 GMT</pubDate>
    <dc:creator>bradk14</dc:creator>
    <dc:date>2017-04-18T01:51:58Z</dc:date>
    <item>
      <title>PAN CLI: Verifying Service Object Existence and Adding New Service Objects</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/pan-cli-verifying-service-object-existence-and-adding-new/m-p/152949#M50524</link>
      <description>&lt;P&gt;I am starting to&amp;nbsp;do more work via the CLI such as security rules. How can I check if a service object already exists using the CLI? And if it does not exist how do I add the service object to I can use it in my security rule?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to add a service object and the name already exists will the PAN warn me and not all that to be input?&lt;/P&gt;&lt;P&gt;What if the protocol and port are already represented by another service object name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 00:18:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/pan-cli-verifying-service-object-existence-and-adding-new/m-p/152949#M50524</guid>
      <dc:creator>palomed</dc:creator>
      <dc:date>2017-04-18T00:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: PAN CLI: Verifying Service Object Existence and Adding New Service Objects</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/pan-cli-verifying-service-object-existence-and-adding-new/m-p/152965#M50527</link>
      <description>&lt;P&gt;so I'll indirectly answer this question and hopefully this will rock your world.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# show&lt;/PRE&gt;&lt;P&gt;will display the candidate configuration, but by default, it's in XML format. so _outside_ of configure mode (for some reason), run the following command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;set cli config-output-format set&lt;/PRE&gt;&lt;P&gt;that will set the show output to set commands. now when you run show in configure mode, you will see each entry in a clear, easy to use CLI syntax. You can actually use the service parameter to see just the services.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@PA-220# show service
set service service-https-mgmt protocol tcp port 4443
set service service-ssh protocol tcp port 22
set service service-plex protocol tcp port 32400&lt;/PRE&gt;&lt;P&gt;not only does this show you all the custom services (note the predefined service-http and service-https are not displayed), but it gives you the exact syntax to add additional ones via the CLI. If you have a lot of services, you can also supplement the command with | match &amp;lt;filter&amp;gt; at the end so it shows only matching service objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;admin@PA-220# show service | match "tcp port 22"
set service service-ssh protocol tcp port 22&lt;/PRE&gt;&lt;P&gt;so to answer your questions, if you create a service object with the same name as an existing one, it will let you and just overwrite the existing object's values. if you create a new service object with a different name but the same protocol/port, it also well let you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my sage advice is to keep it simple and develop an administrative policy so that service objects are simply named for their protocol/port, such as tcp_22. using app names like I have before helps read better, but unless I also plan to have a service-sftp object, I'm just going to create a lot of unncessary 'duplicate' objects.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 01:51:58 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/pan-cli-verifying-service-object-existence-and-adding-new/m-p/152965#M50527</guid>
      <dc:creator>bradk14</dc:creator>
      <dc:date>2017-04-18T01:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: PAN CLI: Verifying Service Object Existence and Adding New Service Obje</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/pan-cli-verifying-service-object-existence-and-adding-new/m-p/353148#M87284</link>
      <description>&lt;P&gt;Simple way to check service-groups or services&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;type configure&lt;/P&gt;&lt;P&gt;show service-group (name of the group)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 21:39:21 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/pan-cli-verifying-service-object-existence-and-adding-new/m-p/353148#M87284</guid>
      <dc:creator>Faraz_Iqbal</dc:creator>
      <dc:date>2020-09-30T21:39:21Z</dc:date>
    </item>
  </channel>
</rss>

