вторник, 5 февраля 2013 г.

How to get list of rules UIDs on Check Point Firewall


To get a list of all rule UIDs on policy of specific firewall, you can parse "rulebases_5_0.fws" file on Security Management Servers $CPMDIR/conf/<FW object name> directory. Order of the rules in file is the same as in SmartDashboard, so for example we can print all rules with their UIDs.

[Expert@sc]# cd $CPMDIR/conf/cp-module
[Expert@sc]# cat rulebases_5_0.fws | grep -B1 ":ClassName (security_rule)" | grep :chkpf_uid | less -N

1 :chkpf_uid ("{CF55839B-B359-48A7-9332-94599D0ECAAE}")
2 :chkpf_uid ("{9D8F925F-5F9D-42FE-9DC4-D3A1266243AE}")
3 :chkpf_uid ("{5AA2BE44-BAC1-48AE-873B-97EC44B929D3}")
4 :chkpf_uid ("{2669F5D8-C81E-4DF6-84B2-DE183A6FB60B}")
5 :chkpf_uid ("{9DFA8ECB-FED5-4EE3-89F7-BECA862654CB}")
6 :chkpf_uid ("{16EDA0A0-3834-47C7-9432-C1237703BADC}")
7 :chkpf_uid ("{5C838142-DA5E-42B8-859C-18C1438AC93C}")
8 :chkpf_uid ("{ED6D17BF-4450-471A-9596-23C700F070D6}")
9 :chkpf_uid ("{9B13BD8C-4FFA-4112-96DF-19F9987A6110}")
10 :chkpf_uid ("{1D4C32E5-2D0B-477A-BF07-0604545C8A1E}")
11 :chkpf_uid ("{77858269-5BAD-4A43-B41F-2A413E38F60E}")
12 :chkpf_uid ("{B7E32257-1CA0-4B15-9A4C-EB07F954F3EF}")
13 :chkpf_uid ("{5F93F464-2572-40FC-B7FB-2D8C2A64A94C}")
14 :chkpf_uid ("{F2223AF3-2D9B-4B2A-ABB4-EDA6EB9533BA}")
15 :chkpf_uid ("{8CEFE7BC-B269-4CBB-AF35-001931A0ABAB}")
16 :chkpf_uid ("{12BD2012-A8B0-4412-B338-2F5918A32CE9}")
17 :chkpf_uid ("{CB54E28F-6553-4872-AA69-7EC91A010E4D}")
18 :chkpf_uid ("{8EC78F43-601E-4911-8AFE-CBB0A9474C9B}")
19 :chkpf_uid ("{40BCD8FD-B9EA-4A16-B7D7-F0CB6BBB2076}")
20 :chkpf_uid ("{1E674557-A156-46FD-A0C3-4D66665E5D59}")
21 :chkpf_uid ("{01925382-D16A-42A2-8466-CF938B2C20CB}")