How to Include Line Breaks and Quotes in Descriptions using CLI Commands in PAN-OS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Include Line Breaks and Quotes in Descriptions using CLI Commands in PAN-OS

L0 Member

Hello,

I'm working with PAN-OS 10.2 and need to set descriptions for various objects like address objects, service objects, and security policies using CLI commands in the set format. I'm struggling to include strings that contain line breaks, single quotes ('), and double quotes ("). Could someone guide me on how to properly format these special characters within the descriptions?

Thank you in advance for your assistance!

4 REPLIES 4

Community Team Member

Hi @a-takamura ,

 

As far as I know this isn't implemented yet.

However, there's a past discussion on the topic where user @ThomasPaine used a workaround using a benign config stanza:

https://live.paloaltonetworks.com/t5/general-topics/comments-in-cli/td-p/176425

 

There's also an existing feature request where you can ask your local SE to have your voted added:

FR-ID: NSFR-I-26529

 

Kind regards,

-Kim.

 

 

LIVEcommunity team member, CISSP
Cheers,
Kiwi
Please help out other users and “Accept as Solution” if a post helps solve your problem !

Read more about how and why to accept solutions.

Cyber Elite
Cyber Elite

For a comment that contains quotes, you need to package the comment inside single quotes like so:

set address example description '"lazorz"'

but for line breaks i don't think you can do that from CLI at this time

 

Tom Piens
PANgurus - Strata specialist; config reviews, policy optimization

Thank you for the clarification regarding quotes. I understand that for descriptions with quotes, I should encapsulate them within single quotes as demonstrated.

However, regarding line breaks, I have another question. In the GUI, it's possible to include line breaks and other free-form text in descriptions for various objects. Is it indeed impossible to do this via the CLI? I assumed there might be escape sequences to handle this, but the following command results in an error:

set rulebase security rules Test-Policy description "This is a \"test policy\".\nThis is a 'new line'."

Could it be that there are no escape sequences available for this purpose in the CLI?

as far as i've found there are no escape characters

once you 'encapsulate' any characters inside the quotes is treated as cleartext

Tom Piens
PANgurus - Strata specialist; config reviews, policy optimization
  • 1182 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!