備忘録/にわかエンジニアが好きなように書く

個人的にとりあえず仕組みを知るためにとりあえず動くまで構築や動作をみただけの単なる操作ログです。個人用の備忘録となり、最新の導入手順は個別に確認してください。 ※変な内容や間違いを書いているなどありましたらコメントやご指摘いただけると幸いです。

paloalto セキュリティポリシによるFirstPacketの処理について

概要

下記のようなPing(ICMP)を許可したセキュリティポリシ(Service:Any / application:icmp,ping)でどのようなファーストパケットがデバイスを通過するのかを確認する。

f:id:pocket01:20200808234200p:plain

admin@PA02a# show rulebase security rules Test_Trust_Untrust_01
Test_Trust_Untrust_01 {
to Untrust;
from Trust;
source host_172.16.100.200;
destination host_172.16.1.100;
source-user any;
category any;
application [ icmp ping];
service any;
hip-profiles any;
action allow;
log-setting Syslog_Profile1;
}

環境

構成

f:id:pocket01:20200808235110p:plain

使用環境

サーバ : CentOS7(使用Tool : hping3 , curl)

WebServer : Windows10 , Wireshark , 適用なWebServer

確認方法

サーバから hping(Synフラグを付ける)による疎通確認を行い、Webサーバでパケットキャプチャーを実施する。

・受信したパケットと応答したパケットをキャプチャ結果により確認する。

・Paloaltoのトラフィックログにより該当したポリシログを確認する。

 

hpingはオプション指定により実行している。

実行コマンド:hping3 -I ens192 -c 5 -S -p 80 172.16.1.100

 -I  : 出力インターフェース指定

 -c : 実施回数

    -S : Synフラグを付与

 -p : 宛先ポート番号

 

結果

セキュリティポリシ(Service:Any / application:icmp,ping)の場合、宛先ポート番号は不問となって、Applicationが判別できないSynパケットは透過させるような動きとなっていると思われる。

また、Paloaltoのナレッジベースにも似たような記載があるので仕様なのかな。

https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000ClV0CAK

--

Because the application is not known when the SYN packet is received the application portion of the security policies can not be applied. As a result, the security policy lookup is performed against the 6 tuples of the session, source and destination IP and port, ingress interface (actually zone) and protocol. The first policy, which matches these 6 tuples, will be used to allow the SYN and any additional packets that traverse the firewall before the application is identified.

--

実施1:Windowsファイアウォール有効時

結果からサーバからのSynパケットがポリシを経由してWindowsサーバへ届いていることが分かる。

ログからアプリケーションも incomplete で判別できていない。

※windowsサーバはファイアウォール機能により応答はしていない

●hping結果 

[root@Server001 ~]# hping3 -I ens192 -c 5 -S -p 80 172.16.1.100
HPING 172.16.1.100 (ens192 172.16.1.100): S set, 40 headers + 0 data bytes

--- 172.16.1.100 hping statistic ---
5 packets transmitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms
[root@Server001 ~]#

 ●キャプチャー結果

f:id:pocket01:20200809003103p:plain

●トラフィックログ

f:id:pocket01:20200809003323p:plain

f:id:pocket01:20200809005615p:plain

実施2:Windowsファイアウォール無効時

結果からサーバからのSynパケットがポリシを経由してWindowsサーバへ届いて、Windowsサーバから応答していることがが分かる。

ログからアプリケーションも incomplete で判別できていない。

終了時はサーバから(hpingの動作による)RSTパケットもポリシを経由して、Windows側で受信している。

●hping結果 

[root@Server001 ~]# hping3 -I ens192 -c 5 -S -p 80 172.16.1.100
HPING 172.16.1.100 (ens192 172.16.1.100): S set, 40 headers + 0 data bytes
len=46 ip=172.16.1.100 ttl=126 DF id=29486 sport=80 flags=SA seq=0 win=65392 rtt=1.7 ms
len=46 ip=172.16.1.100 ttl=127 DF id=29487 sport=80 flags=SA seq=1 win=65392 rtt=1.5 ms
len=46 ip=172.16.1.100 ttl=127 DF id=29488 sport=80 flags=SA seq=2 win=65392 rtt=1.4 ms
len=46 ip=172.16.1.100 ttl=127 DF id=29489 sport=80 flags=SA seq=3 win=65392 rtt=1.3 ms
len=46 ip=172.16.1.100 ttl=127 DF id=29490 sport=80 flags=SA seq=4 win=65392 rtt=2.1 ms

--- 172.16.1.100 hping statistic ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 1.3/1.6/2.1 ms
[root@Server001 ~]#

 ●キャプチャー結果

f:id:pocket01:20200809005729p:plain

●トラフィックログ

f:id:pocket01:20200809005252p:plain

f:id:pocket01:20200809005658p:plain

 

実施3:Ping (Windowsファイアウォール:無効)

結果からサーバからのPingパケットがポリシを経由してWindowsサーバへ届いて、Windowsサーバから正常に応答していることがが分かる。

ログからアプリケーションも Ping として判別できている。

●ping結果 

[root@Server001 ~]# ping 172.16.1.100
PING 172.16.1.100 (172.16.1.100) 56(84) bytes of data.
64 bytes from 172.16.1.100: icmp_seq=1 ttl=126 time=1.20 ms
64 bytes from 172.16.1.100: icmp_seq=2 ttl=127 time=1.32 ms
64 bytes from 172.16.1.100: icmp_seq=3 ttl=127 time=1.40 ms
64 bytes from 172.16.1.100: icmp_seq=4 ttl=127 time=1.31 ms
64 bytes from 172.16.1.100: icmp_seq=5 ttl=127 time=1.38 ms
^C
--- 172.16.1.100 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 1.202/1.324/1.404/0.077 ms
[root@Server001 ~]#

 ●キャプチャー結果

f:id:pocket01:20200809013552p:plain

●トラフィックログ

f:id:pocket01:20200809013310p:plain

f:id:pocket01:20200809014217p:plain