Skip to main content
hklb
Visitor III
December 30, 2015
Question

[TCL] how to show on ADOM policy

  • December 30, 2015
  • 8 replies
  • 7444 views

Hi,

 

I search how to do a "show" in the ADOM policy package. Is there a way to do that ?

 

#!

proc do_db {package cmd} { puts [exec_ondb "/adom/LAB_LBA/pkg/$package" "$cmd\n" "# "] } do_db "default" " show firewall policy "

 

-> output :

DEBUG INFO: TCL command exec_ondb: target = /adom/LAB_LBA/pkg/default #

the goal is to show all policy in a policy package.. Thanks in advance for your help !

 

Lucas

 

    8 replies

    ag_FTNT
    Staff
    Staff
    January 5, 2016

    Hi Lucas,

     

    So I'm not sure running a "show" script would work like that from the FMG, but you can view all policies of a particular ADOM and policy package using the example syntax below:

     

    exec fmpolicy print-adom-package root 887 181 all

     

    Where "root" would be your desired ADOM

    Where "887" would be the ID assigned to you policy package

    Where "181" would be firewall policy

    You can use "all" to specify all policies of that type in your selected policy package or you can select an individual policy ID.

     

    You can type a "?" at the four last entries to help you select your desired entries as well.

     

    Best regards,

     

    Alan

    hklb
    hklbAuthor
    Visitor III
    January 6, 2016

    Hi Alan,

     

    Thanks for your response, but it's look like the "execute ..." doesn't work in TCL script : DEBUG INFO: TCL command exec_ondb: target = /adom/LAB_LBA/pkg/default > execute fmpolicy print-adom-package LAB_LBA 887 181 all Failed to commit to DB, reason(> execute fmpolicy print-adom-package LAB_LBA 887 181 all ) ERROR INFO: __exec_ondb: Cannot execute the command in tcl script.

     

     

     

     

    Lucas

    ag_FTNT
    Staff
    Staff
    January 6, 2016

    Hi Lucas,

     

    Sorry for the confusion, looks like I forgot to add that command would be run in the command line of FortiManager not in a script.

     

    When you get to the command line, the ID of your policy package might be different than 887.  So executing command "execute fmpolicy print-adom-package LAB_LBA ?" would give you the policy package ID number you seek. The rest (181 all) should be the same.

     

    Regards,

    Alan

    Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
    Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.