Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit db188ae

Browse files
committed
Merge remote-tracking branch 'origin/topic/christian/conn-ip-proto'
* origin/topic/christian/conn-ip-proto: Documentation for conn.log's new ip_proto field.
2 parents c18ae0f + 87ae3ee commit db188ae

File tree

9 files changed

+99
-26
lines changed

9 files changed

+99
-26
lines changed

log-formats.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ We use the :program:`cat` command to show the contents of each log.
108108
#unset_field -
109109
#path conn
110110
#open 2020-06-05-14-48-32
111-
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto service duration orig_bytes resp_bytes conn_state local_orig local_resp missed_bytes history orig_pkts orig_ip_bytes resp_pkts resp_ip_bytes tunnel_parents
112-
#types time string addr port addr port enum string interval count count string bool bool count string count count count count set[string]
113-
1591367999.305988 CazOhH2qDUiJTWMCY 192.168.4.76 36844 192.168.4.1 53 udp dns 0.066852 62 141 SF - -0 Dd 2 118 2 197 -
114-
1591367999.430166 CLqEx41jYPOdfHF586 192.168.4.76 46378 31.3.245.133 80 tcp http 0.254115 77 295 SF - -0 ShADadFf 6 397 4 511 -
111+
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto service duration orig_bytes resp_bytes conn_state local_orig local_resp missed_bytes history orig_pkts orig_ip_bytes resp_pkts resp_ip_bytes tunnel_parents ip_proto
112+
#types time string addr port addr port enum string interval count count string bool bool count string count count count count set[string] count
113+
1591367999.305988 CazOhH2qDUiJTWMCY 192.168.4.76 36844 192.168.4.1 53 udp dns 0.066852 62 141 SF - -0 Dd 2 118 2 197 - 17
114+
1591367999.430166 CLqEx41jYPOdfHF586 192.168.4.76 46378 31.3.245.133 80 tcp http 0.254115 77 295 SF - -0 ShADadFf 6 397 4 511 - 6
115115
#close 2020-06-05-14-48-32
116116

117117
Next we look at Zeek’s :file:`dns.log`.
@@ -434,11 +434,17 @@ First we look at :file:`packet_filter.log`.
434434
::
435435

436436
{"ts":1591368442.854585,"node":"zeek","filter":"ip or not ip","init":true,"success":true}
437+
438+
Next we look at :file:`conn.log` and :file:`dns.log`:
439+
440+
.. code-block:: console
441+
437442
zeek@zeek:~/zeek-test/json$ cat conn.log
438-
{"ts":1591367999.305988,"uid":"CMdzit1AMNsmfAIiQc","id.orig_h":"192.168.4.76","id.orig_p":36844,"id.resp_h":"192.168.4.1","id.resp_p":53,"proto":"udp","service":"dns","duration":0.06685185432434082,"orig_bytes":62,"resp_bytes":141,"conn_state":"SF","missed_bytes":0,"history":"Dd","orig_pkts":2,"orig_ip_bytes":118,"resp_pkts":2,"resp_ip_bytes":197}
439-
{"ts":1591367999.430166,"uid":"C5bLoe2Mvxqhawzqqd","id.orig_h":"192.168.4.76","id.orig_p":46378,"id.resp_h":"31.3.245.133","id.resp_p":80,"proto":"tcp","service":"http","duration":0.25411510467529297,"orig_bytes":77,"resp_bytes":295,"conn_state":"SF","missed_bytes":0,"history":"ShADadFf","orig_pkts":6,"orig_ip_bytes":397,"resp_pkts":4,"resp_ip_bytes":511}
440443
441-
Next we look at :file:`dns.log`.
444+
::
445+
446+
{"ts":1591367999.305988,"uid":"CMdzit1AMNsmfAIiQc","id.orig_h":"192.168.4.76","id.orig_p":36844,"id.resp_h":"192.168.4.1","id.resp_p":53,"proto":"udp","service":"dns","duration":0.06685185432434082,"orig_bytes":62,"resp_bytes":141,"conn_state":"SF","missed_bytes":0,"history":"Dd","orig_pkts":2,"orig_ip_bytes":118,"resp_pkts":2,"resp_ip_bytes":197,"ip_proto":17}
447+
{"ts":1591367999.430166,"uid":"C5bLoe2Mvxqhawzqqd","id.orig_h":"192.168.4.76","id.orig_p":46378,"id.resp_h":"31.3.245.133","id.resp_p":80,"proto":"tcp","service":"http","duration":0.25411510467529297,"orig_bytes":77,"resp_bytes":295,"conn_state":"SF","missed_bytes":0,"history":"ShADadFf","orig_pkts":6,"orig_ip_bytes":397,"resp_pkts":4,"resp_ip_bytes":511,"ip_proto":6}
442448

443449
.. code-block:: console
444450

logs/conn.rst

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ stored traffic. We use the :program:`jq` utility to review the contents.
3434
3535
::
3636

37-
{"ts":1591367999.305988,"uid":"CMdzit1AMNsmfAIiQc","id.orig_h":"192.168.4.76","id.orig_p":36844,"id.resp_h":"192.168.4.1","id.resp_p":53,"proto":"udp","service":"dns","duration":0.06685185432434082,"orig_bytes":62,"resp_bytes":141,"conn_state":"SF","missed_bytes":0,"history":"Dd","orig_pkts":2,"orig_ip_bytes":118,"resp_pkts":2,"resp_ip_bytes":197}
37+
{"ts":1591367999.305988,"uid":"CMdzit1AMNsmfAIiQc","id.orig_h":"192.168.4.76","id.orig_p":36844,"id.resp_h":"192.168.4.1","id.resp_p":53,"proto":"udp","service":"dns","duration":0.06685185432434082,"orig_bytes":62,"resp_bytes":141,"conn_state":"SF","missed_bytes":0,"history":"Dd","orig_pkts":2,"orig_ip_bytes":118,"resp_pkts":2,"resp_ip_bytes":197,"ip_proto":17}
3838

39-
{"ts":1591367999.430166,"uid":"C5bLoe2Mvxqhawzqqd","id.orig_h":"192.168.4.76","id.orig_p":46378,"id.resp_h":"31.3.245.133","id.resp_p":80,"proto":"tcp","service":"http","duration":0.25411510467529297,"orig_bytes":77,"resp_bytes":295,"conn_state":"SF","missed_bytes":0,"history":"ShADadFf","orig_pkts":6,"orig_ip_bytes":397,"resp_pkts":4,"resp_ip_bytes":511}
39+
{"ts":1591367999.430166,"uid":"C5bLoe2Mvxqhawzqqd","id.orig_h":"192.168.4.76","id.orig_p":46378,"id.resp_h":"31.3.245.133","id.resp_p":80,"proto":"tcp","service":"http","duration":0.25411510467529297,"orig_bytes":77,"resp_bytes":295,"conn_state":"SF","missed_bytes":0,"history":"ShADadFf","orig_pkts":6,"orig_ip_bytes":397,"resp_pkts":4,"resp_ip_bytes":511,"ip_proto":6}
4040

4141
Alternatively, we could see each field printed on its own line:
4242

@@ -64,7 +64,8 @@ Alternatively, we could see each field printed on its own line:
6464
"orig_pkts": 2,
6565
"orig_ip_bytes": 118,
6666
"resp_pkts": 2,
67-
"resp_ip_bytes": 197
67+
"resp_ip_bytes": 197,
68+
"ip_proto": 17
6869
}
6970
{
7071
"ts": 1591367999.430166,
@@ -84,7 +85,8 @@ Alternatively, we could see each field printed on its own line:
8485
"orig_pkts": 6,
8586
"orig_ip_bytes": 397,
8687
"resp_pkts": 4,
87-
"resp_ip_bytes": 511
88+
"resp_ip_bytes": 511,
89+
"ip_proto": 6
8890
}
8991

9092
What an analyst derives from any log is a function of the questions that he or
@@ -119,7 +121,8 @@ the following:
119121
"orig_pkts": 6,
120122
"orig_ip_bytes": 397,
121123
"resp_pkts": 4,
122-
"resp_ip_bytes": 511
124+
"resp_ip_bytes": 511,
125+
"ip_proto": 6
123126
}
124127

125128
For the second log, ``192.168.4.76`` talked to ``31.3.245.133``.
@@ -264,6 +267,10 @@ In the highlighted output, we see that :program:`tshark` notes 77 bytes of data
264267
carried by TCP from ``192.168.4.76``. I highlighted what that data was,
265268
beginning with a GET request.
266269

270+
The ``orig_pkts`` and ``resp_pkts`` fields report the number of IP packets
271+
transferred in the respective directions. The ``orig_ip_bytes`` and
272+
``resp_ip_bytes`` indicate the total IP packet-level byte counts, respectively.
273+
267274
Another way to look at this TCP segment is to dump the hex contents using a
268275
different :program:`tshark` option, as shown below.
269276

@@ -339,7 +346,8 @@ reference.
339346
"orig_pkts": 2,
340347
"orig_ip_bytes": 118,
341348
"resp_pkts": 2,
342-
"resp_ip_bytes": 197
349+
"resp_ip_bytes": 197,
350+
"ip_proto": 17
343351
}
344352

345353
For the first entry, ``192.168.4.76`` talked to ``192.168.4.1``.
@@ -370,6 +378,52 @@ the conversations as “normal establishment and termination” of the
370378
Similarly, the ``history`` field is simply ``Dd``, indicating that each party
371379
to the conversation sent data to the other.
372380

381+
The ``ip_proto`` Field
382+
======================
383+
384+
.. versionadded:: 7.1
385+
386+
The numeric ``ip_proto`` field reports the `IP protocol number
387+
<https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml>`_ of
388+
the connection. It relates to the ``proto`` field, but while the former
389+
represents a :zeek:type:`transport_proto` value that exclusively covers
390+
*transport* protocols Zeek knows how to parse (and ties into Zeek's
391+
:zeek:type:`port` type), the ``ip_proto`` field is always present, including for
392+
non-transport IP packet flows such as IGMP or OSPF. For example, an OSPF flow
393+
might look as follows:
394+
395+
::
396+
397+
{
398+
"ts": 1098361214.420459,
399+
"uid": "C9EV8R4fN8bfSj08f",
400+
"id.orig_h": "192.168.170.2",
401+
"id.orig_p": 0,
402+
"id.resp_h": "224.0.0.6",
403+
"id.resp_p": 0,
404+
"proto": "unknown_transport",
405+
"duration": 6.437546968460083,
406+
"orig_bytes": 0,
407+
"resp_bytes": 0,
408+
"conn_state": "OTH",
409+
"local_orig": true,
410+
"local_resp": false,
411+
"missed_bytes": 0,
412+
"orig_pkts": 4,
413+
"orig_ip_bytes": 768,
414+
"resp_pkts": 0,
415+
"resp_ip_bytes": 0,
416+
"ip_proto": 89
417+
}
418+
419+
You can adapt this feature in several ways. Load the
420+
:doc:`/scripts/policy/protocols/conn/ip-proto-name-logging.zeek` policy script
421+
to add an ``ip_proto_name`` column with a string version of the ``ip_proto``
422+
value. Also, you may disable the whole feature by loading the
423+
:doc:`/scripts/policy/protocols/conn/disable-unknown-ip-proto-support.zeek`
424+
script, returning conn.log to its pre-7.1 state. Zeek's :ref:`logging framework
425+
<framework-logging>` supports additional customizations.
426+
373427
The ``uid`` and Other Fields
374428
============================
375429

logs/dhcp.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ source IP address, sending its search to the local network for a DHCP server.
346346
"orig_ip_bytes": 1323,
347347
"resp_pkts": 0,
348348
"resp_ip_bytes": 0,
349-
"sensorname": "so16-enp0s8"
349+
"ip_proto": 17
350350
}
351351

352352
Notice that Zeek has tracked 4 “orig packets” here, which does not strictly
@@ -384,7 +384,7 @@ client, and ``192.168.4.1``, the DHCP server.
384384
"orig_ip_bytes": 0,
385385
"resp_pkts": 2,
386386
"resp_ip_bytes": 660,
387-
"sensorname": "so16-enp0s8"
387+
"ip_proto": 17
388388
}
389389

390390
Here the count of 2 ``resp_pkts`` is correct.

logs/dpd.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ Here is the :file:`conn.log` that Zeek generated for this activity:
248248
"orig_pkts": 6,
249249
"orig_ip_bytes": 776,
250250
"resp_pkts": 5,
251-
"resp_ip_bytes": 675
251+
"resp_ip_bytes": 675,
252+
"ip_proto": 6
252253
}
253254

254255
The :file:`conn.log` entry is fairly normal.

logs/ftp.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ for easier viewing.
6363
"orig_ip_bytes": 1232,
6464
"resp_pkts": 17,
6565
"resp_ip_bytes": 1343,
66+
"ip_proto": 6,
6667
"community_id": "1:lEESxqaSVYqFZvWNb4OccTa9sTs="
6768
}
6869
{
@@ -296,6 +297,7 @@ IP addresses too.
296297
"orig_ip_bytes": 216,
297298
"resp_pkts": 4,
298299
"resp_ip_bytes": 290,
300+
"ip_proto": 6,
299301
"community_id": "1:DNwvGR6Ots6pISvsdXBUIaG8y3Q="
300302
}
301303

logs/irc.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ Zeek generated the following :file:`conn.log` entry for the example traffic.
118118
"orig_pkts": 41,
119119
"orig_ip_bytes": 1963,
120120
"resp_pkts": 185,
121-
"resp_ip_bytes": 246742
121+
"resp_ip_bytes": 246742,
122+
"ip_proto": 6
122123
}
123124

124125
We see that Zeek correctly identified this traffic as IRC. We can expect to see

logs/pe.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Starting with :file:`conn.log`
1414
==============================
1515

1616
This example starts with the :file:`conn.log`. It’s not strictly necessary to
17-
explain the :file:`pe.log`, although I wanted to include a very recent example
17+
explain the :file:`pe.log`, although I wanted to include a recent example
1818
of a modern application conducting activities via HTTP.
1919

2020
.. literal-emph::
@@ -40,6 +40,7 @@ of a modern application conducting activities via HTTP.
4040
"orig_ip_bytes": 29041,
4141
"resp_pkts": 1367,
4242
"resp_ip_bytes": 2030409,
43+
"ip_proto": 6
4344
}
4445

4546
This example shows a host, ``192.168.4.152``, conducting a HTTP session with

logs/smb.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ traffic.
118118
"orig_pkts": 78,
119119
"orig_ip_bytes": 19403,
120120
"resp_pkts": 77,
121-
"resp_ip_bytes": 16812
121+
"resp_ip_bytes": 16812,
122+
"ip_proto": 6
122123
}
123124

124125
We see that ``192.168.10.31`` initiated a connection to ``192.168.10.10``. The
@@ -376,7 +377,8 @@ The :file:`conn.log` has two entries:
376377
"orig_pkts": 66,
377378
"orig_ip_bytes": 816703,
378379
"resp_pkts": 91,
379-
"resp_ip_bytes": 15309
380+
"resp_ip_bytes": 15309,
381+
"ip_proto": 6
380382
}
381383
{
382384
"ts": 1507565425.183882,
@@ -392,7 +394,8 @@ The :file:`conn.log` has two entries:
392394
"orig_pkts": 1,
393395
"orig_ip_bytes": 207,
394396
"resp_pkts": 0,
395-
"resp_ip_bytes": 0
397+
"resp_ip_bytes": 0,
398+
"ip_proto": 17
396399
}
397400

398401
The first entry shows a connection initiated by ``192.168.10.31`` to
@@ -790,7 +793,8 @@ The :file:`conn.log` for this case has only one entry:
790793
"orig_pkts": 74,
791794
"orig_ip_bytes": 8734,
792795
"resp_pkts": 575,
793-
"resp_ip_bytes": 835740
796+
"resp_ip_bytes": 835740,
797+
"ip_proto": 6
794798
}
795799

796800
We see the same pattern: ``192.168.10.31`` initiated a connection to
@@ -1028,7 +1032,8 @@ Looking at the :file:`conn.log`, we see one entry:
10281032
"orig_pkts": 11,
10291033
"orig_ip_bytes": 1595,
10301034
"resp_pkts": 9,
1031-
"resp_ip_bytes": 1397
1035+
"resp_ip_bytes": 1397,
1036+
"ip_proto": 6
10321037
}
10331038

10341039
We see ``192.168.10.31`` initiated a connection to ``192.168.10.30``, port 445

logs/tunnel.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ The :file:`conn.log` for this traffic contains the following:
146146
"orig_pkts": 1,
147147
"orig_ip_bytes": 89,
148148
"resp_pkts": 1,
149-
"resp_ip_bytes": 137
149+
"resp_ip_bytes": 137,
150+
"ip_proto": 17
150151
}
151152

152153
This first :file:`conn.log` entry addresses frames 2 and 3 in the original packet
@@ -172,7 +173,8 @@ shortly.
172173
"orig_pkts": 1,
173174
"orig_ip_bytes": 89,
174175
"resp_pkts": 0,
175-
"resp_ip_bytes": 0
176+
"resp_ip_bytes": 0,
177+
"ip_proto": 17
176178
}
177179

178180
This second :file:`conn.log` entry refers to frame 1 in the packet capture.
@@ -196,7 +198,8 @@ Note the ``uid`` field. It will appear again shortly as well.
196198
"resp_ip_bytes": 0,
197199
"tunnel_parents": [
198200
**"CO9T0A3FPac5ig4hud"**
199-
]
201+
],
202+
"ip_proto": 1
200203
}
201204

202205
Here Zeek has created a new :file:`conn.log` entry for the ICMPv6 traffic

0 commit comments

Comments
 (0)