{"id":4760,"date":"2020-08-19T07:38:49","date_gmt":"2020-08-19T07:38:49","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=4760"},"modified":"2020-08-19T07:38:49","modified_gmt":"2020-08-19T07:38:49","slug":"fortigate-logging","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/fortigate-logging","title":{"rendered":"Fortigate Logging"},"content":{"rendered":"<h4>Flow Trace<\/h4><p>Now I will show a flow trace from my computer to\u00a0<code>4.2.2.2<\/code><\/p><pre>diagnose debug reset \r\ndiagnose debug flow filter saddr 10.22.22.122 \r\ndiagnose debug flow filter daddr 10.100.1.1 \r\ndiagnose debug flow show function-name enable\r\ndiagnose debug enable \r\ndiagnose debug flow trace start 100\u00a0\u00a0#display the next 100 packets, after that, disable the flow: \r\n\r\n<em>When complete, you can disable manually with<\/em>\r\n\r\ndiagnose debug disable<\/pre><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4416 jetpack-lazy-image jetpack-lazy-image--handled img-responsive\" src=\"https:\/\/i1.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-14-48.png?resize=876%2C280&amp;ssl=1\" sizes=\"auto, (max-width: 600px) 99vw, (max-width: 900px) 98vw, 876px\" srcset=\"https:\/\/i1.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-14-48.png?w=900&amp;ssl=1 900w, https:\/\/i1.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-14-48.png?resize=300%2C96&amp;ssl=1 300w, https:\/\/i1.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-14-48.png?resize=768%2C246&amp;ssl=1 768w, https:\/\/i1.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-14-48.png?resize=400%2C128&amp;ssl=1 400w\" alt=\"2020-04-23_12-14-48\" width=\"876\" height=\"280\" data-recalc-dims=\"1\" data-lazy-loaded=\"1\" \/><\/p><p>&nbsp;<\/p><p>The output, it will show you what interface the connection came in on, because of the <code>function-name enable<\/code>\u00a0you will see NAT, Routing, etc, IPS, offloading to NPU and SPUs, etc.<\/p><h4>Sessions<\/h4><p>You can also see the sessions using the following commands<\/p><pre>diagnose sys session filter clear\r\ndiagnose sys session filter dst 4.2.2.2\r\ndiagnose sys session filter dport 53\r\ndiagnose sys session list\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #show the session table with the filter just set<\/pre><p>Use the filter that work for you from a\u00a0<code>source<\/code>\u00a0or\u00a0<code>destination<\/code>\u00a0as well as ports<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4417 jetpack-lazy-image jetpack-lazy-image--handled img-responsive\" src=\"https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-22-53.png?resize=876%2C302&amp;ssl=1\" sizes=\"auto, (max-width: 600px) 99vw, (max-width: 900px) 98vw, 876px\" srcset=\"https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-22-53.png?w=900&amp;ssl=1 900w, https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-22-53.png?resize=300%2C103&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-22-53.png?resize=768%2C265&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-22-53.png?resize=400%2C138&amp;ssl=1 400w\" alt=\"2020-04-23_12-22-53\" width=\"876\" height=\"302\" data-recalc-dims=\"1\" data-lazy-loaded=\"1\" \/><\/p><p>&nbsp;<\/p><p>With this filter, you can clear the sessions based on the filter you created by issuing the\u00a0<code>diagnose sys session clear<\/code>\u00a0NOTE: Without the filter in place, you will clear ALL sessions on the FortiGate.\u00a0 It is always a good habit to run\u00a0<code>diag sys session filter ?<\/code>\u00a0to list the filter you have configured.<\/p><h4>Packet Capture<\/h4><p>You can either use the GUI or the CLI to run packet captures.<\/p><pre>diagnose sniffer packet any 'host 8.8.8.8' 4 4 l \r\ndiagnose sniffer packet any 'host 8.8.8.8 and dst port 53' 4 10 a \r\ndiagnose sniffer packet wan1 'dst port (80 or 443)' 2 50 l \r\n\r\n<\/pre><p>The verbosity is controlled by the following:<\/p><pre>verbose:\r\n1: print header of packets\r\n2: print header and data from ip of packets\r\n3: print header and data from ethernet of packets (if available)\r\n4: print header of packets with interface name\r\n5: print header and data from ip of packets with interface name\r\n6: print header and data from ethernet of packets (if available) with intf name\r\ncount: number of packets\r\ntime-format:<\/pre><pre>a: UTC time\r\nl: local time<\/pre><p>You can use the GUI by going to\u00a0<code>Network<\/code>\u00a0then\u00a0<code>Packet Capture<\/code>\u00a0then\u00a0<code>Create<\/code> .\u00a0<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4418 jetpack-lazy-image jetpack-lazy-image--handled img-responsive\" src=\"https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-36-04.png?resize=876%2C461&amp;ssl=1\" sizes=\"auto, (max-width: 600px) 99vw, (max-width: 900px) 98vw, 876px\" srcset=\"https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-36-04.png?w=912&amp;ssl=1 912w, https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-36-04.png?resize=300%2C158&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-36-04.png?resize=768%2C404&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.infosecmonkey.com\/wp-content\/uploads\/2020\/04\/2020-04-23_12-36-04.png?resize=400%2C211&amp;ssl=1 400w\" alt=\"2020-04-23_12-36-04\" width=\"876\" height=\"461\" data-recalc-dims=\"1\" data-lazy-loaded=\"1\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>Flow TraceNow I will show a flow trace from my computer to\u00a04.2.2.2diagnose debug reset diagnose debug flow filter saddr 10.22.22.122 diagnose debug flow filter daddr 10.100.1.1 diagnose [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4760","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=4760"}],"version-history":[{"count":2,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4760\/revisions"}],"predecessor-version":[{"id":4762,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/4760\/revisions\/4762"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=4760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=4760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=4760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}