Forum Discussion

HisMorty's avatar
HisMorty
Icon for Nimbostratus rankNimbostratus
May 11, 2023

How to get plain text conditions and actions from each rule in policy?

I try rest api, but i get json not plain text, anybody know how to get plain text conditions and actions rules in policy how it look like in GUI. Tmsh gave json too. if anybody have idea, please write

2 Replies

  • Hello,

    While you referring as "plain text" you mean ... ?
    I'm asking because of the tmsh gives it as config lines as stored in bigip.conf file which is not JSON, it is "plain text".

     

    tmsh list ltm policy Stop_Nimda 
    ltm policy StopNimda{
        controls { forwarding }
        description "This policy blocks the Nimda worm."
        last-modified 2016-03-02:11:46:00
        requires { http }
        rules {
            ClobberNimda {
                actions {
                    0 {
                        forward
                        reset
                    }
                }
                conditions {
                    0 {
                        http-uri
                        query-string
                        values { root.exe admin.dll cmd.exe }
                    }
                }
            }
        }
        status published
        strategy first-match
    }

     If you need to remove "{" and "}" characters in the output, use same command with appending at the end of

    •  | sed -e 's,{\|},,g'

    If you also need to get rid of those blank lines in the output, append below too

    •   | sed -e '/^ *$/d'

    Hope this helps

    • HisMorty's avatar
      HisMorty
      Icon for Nimbostratus rankNimbostratus

      i meant i need this plaintext. Cause text by tmsh not good readable