{"id":11262,"date":"2022-01-07T20:17:10","date_gmt":"2022-01-07T17:17:10","guid":{"rendered":"https:\/\/kifarunix.com\/?p=11262"},"modified":"2024-03-14T19:14:38","modified_gmt":"2024-03-14T16:14:38","slug":"install-zeek-on-debian-11","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-zeek-on-debian-11\/","title":{"rendered":"Install Zeek on Debian 11"},"content":{"rendered":"\n
Follow through this tutorial to learn how to install Zeek on Debian 11. Zeek<\/a>, formerly Bro IDS, is the world’s leading passive open source network security monitoring tool. Zeek is not an active security device, like a firewall or intrusion prevention system. Rather, Zeek sits on a “sensor\u201d, a hardware, software, virtual, or cloud platform that quietly and unobtrusively observes network traffic. Zeek interprets what it sees and creates compact, high-fidelity transaction logs, file content, and fully customized output, suitable for manual review on disk or in a more analyst-friendly tool like a security and information event management (SIEM) system<\/em>.<\/p>\n\n\n\n Zeek can be installed by building it from the source code<\/a> or by directly via the Zeek APT repositories<\/a>.<\/p>\n\n\n\n In this tutorial, we will install Zeek via the APT repositories.<\/p>\n\n\n\n To install Zeek on Debian from the Zeek APT repositories;<\/p>\n\n\n\n Next, run system update;<\/p>\n\n\n\n Zeek 4.1.1 is the current stable release<\/a> as of this writing, confirm the same by running the command below;<\/p>\n\n\n\n You can then install Zeek by running the command below;<\/p>\n\n\n\n During the installation, you maybe prompted for some Postfix settings and if so, choose Internet Site and enter your system FQDN.<\/p>\n\n\n\n By default, Zeek is installed under To begin the configuration with, add Zeek binaries path to PATH;<\/p>\n\n\n\n Next, you need to tell Zeek which networks should be considered local to the monitored environment. This can be specified in the The default networks defined are 10.0.0.0\/8, 172.16.0.0\/16, 192.168.0.0\/16<\/strong>.<\/p>\n\n\n\n So, in our case, 192.168.58.0\/24<\/strong> is our local network.<\/p>\n\n\n\n Hence;<\/p>\n\n\n\n Save the file and exit once you made your network configuration changes.<\/p>\n\n\n\n Zeek can be run in standalone mode or in a clustered setup. It runs in standalone mode by default.<\/p>\n\n\n\n To define whether to run in a clustered or standalone setup, you need to edit the According to Zeek quickstart guide, using the standalone \/ single process mode of Zeek is not suitable for setups with significant amounts of traffic. In these cases one will almost certainly want to make use of a Zeek cluster, even on a single system<\/em>.<\/p>\n\n\n\n Therefore, we will see how to setup Zeek cluster. You can have a look at Zeek cluster architecture<\/a>.<\/p>\n\n\n\n The default Zeek node configuration is like;<\/p>\n\n\n\n Since we are running a single node Zeek Cluster in this setup, comment out the Zeek standalone configuration, section under So what are these components;<\/p>\n\n\n\n So below is our single node Zeek cluster configuration setup;<\/p>\n\n\n\n Next, you need to review the global ZeekControl configuration file, Most of the default values in configuration files should suffice. The only change you might want to make or update here is the recipient address for all emails sent out by Zeek and ZeekControl, if you have any set. The default value is root@localhost.<\/p>\n\n\n\n Before you can install and start Zeek, you need to validate the configuration file;<\/p>\n\n\n\n If there are no issues with the configuration, then you can install the configuration by running the command below;<\/p>\n\n\n\n Once you have installed the Zeek configuration, you can start it using the command;<\/p>\n\n\n\n You can combine the install and start commands using the deploy command. i.e, instead of running You can check the status of Zeek instance by executing;<\/p>\n\n\n\n Other zeek control\/management commands are described on the zeekctl help page;<\/p>\n\n\n\n Zeek will start analyzing traffic according to a default policy and write the log results in Some logs that are worth explicit mention:<\/em><\/p>\n\n\n\n Sample conn.log<\/strong> logs;<\/p>\n\n\n\n The fields and types are;<\/p>\n\n\n\n You can check processes running on each node by executing;<\/p>\n\n\n\n For example, to check processes on Zeek manager node;<\/p>\n\n\n\n And that brings us to the end of our tutorial on how to install Zeek on Debian.<\/p>\n\n\n\n In our next tutorials, we will learn how to analyze network traffic with Zeek.<\/p>\n\n\n\n Installing Zee<\/a>k<\/a><\/p>\n\n\n\n Install and Configure AIDE on Debian 10<\/a><\/p>\n\n\n\n Install ModSecurity 3 with Apache in a Docker Container<\/a><\/p>\n\n\n\nInstalling Zeek on Debian 11<\/h2>\n\n\n\n
Install Zeek on Debian<\/h3>\n\n\n\n
\n
apt update && apt install curl gnupg2 -y<\/code><\/pre>\n\n\n\n
echo 'deb http:\/\/download.opensuse.org\/repositories\/security:\/zeek\/Debian_11\/ \/' > \/etc\/apt\/sources.list.d\/zeek.list<\/code><\/pre>\n\n\n\n
curl -fsSL https:\/\/download.opensuse.org\/repositories\/security:zeek\/Debian_11\/Release.key | gpg --dearmor > \/etc\/apt\/trusted.gpg.d\/security_zeek.gpg<\/code><\/pre>\n\n\n\n
\n
apt update<\/code><\/pre>\n\n\n\n
apt-cache policy zeek<\/code><\/pre>\n\n\n\n
zeek:\n Installed: (none)\n Candidate: 4.1.1-0\n Version table:\n 4.1.1-0 500\n 500 http:\/\/download.opensuse.org\/repositories\/security:\/zeek\/Debian_11 Packages<\/code><\/pre>\n\n\n\n
apt install zeek -y<\/code><\/pre>\n\n\n\n
Configuring Zeek on Debian 11<\/h3>\n\n\n\n
Configure the Run-Time Environment<\/h4>\n\n\n\n
\/opt\/zeek<\/strong><\/code>.<\/p>\n\n\n\n
echo \"export PATH=$PATH:\/opt\/zeek\/bin\" > \/etc\/profile.d\/zeek.sh<\/code><\/pre>\n\n\n\n
source \/etc\/profile.d\/zeek.sh<\/code><\/pre>\n\n\n\n
Define the Local Networks<\/h4>\n\n\n\n
\/opt\/zeek\/etc\/networks.cfg<\/strong><\/code> configuration file.<\/p>\n\n\n\n
cat \/opt\/zeek\/etc\/networks.cfg<\/code><\/pre>\n\n\n\n
# List of local networks in CIDR notation, optionally followed by a\n# descriptive tag.\n# For example, \"10.0.0.0\/8\" or \"fe80::\/64\" are valid prefixes.\n\n10.0.0.0\/8 Private IP space\n172.16.0.0\/12 Private IP space\n192.168.0.0\/16 Private IP space\n<\/code><\/pre>\n\n\n\n
vim \/opt\/zeek\/etc\/networks.cfg<\/code><\/pre>\n\n\n\n
# List of local networks in CIDR notation, optionally followed by a\n# descriptive tag.\n# For example, \"10.0.0.0\/8\" or \"fe80::\/64\" are valid prefixes.\n\n#10.0.0.0\/8 Private IP space\n#172.16.0.0\/12 Private IP space\n#192.168.0.0\/16 Private IP space\n192.168.58.0\/24 Kifarunix-demo IP space<\/strong>\n<\/code><\/pre>\n\n\n\n
Define Zeek Running Mode<\/h4>\n\n\n\n
\/opt\/zeek\/etc\/node.cfg<\/strong><\/code> configuration file.<\/p>\n\n\n\n
\n
cat \/opt\/zeek\/etc\/node.cfg<\/code><\/pre>\n\n\n\n
# Example ZeekControl node configuration.\n#\n# This example has a standalone node ready to go except for possibly changing\n# the sniffing interface.\n\n# This is a complete standalone configuration. Most likely you will\n# only need to change the interface.\n[zeek]\ntype=standalone\nhost=localhost\ninterface=eth0\n\n## Below is an example clustered configuration. If you use this,\n## remove the [zeek] node above.\n\n#[logger-1]\n#type=logger\n#host=localhost\n#\n#[manager]\n#type=manager\n#host=localhost\n#\n#[proxy-1]\n#type=proxy\n#host=localhost\n#\n#[worker-1]\n#type=worker\n#host=localhost\n#interface=eth0\n#\n#[worker-2]\n#type=worker\n#host=localhost\n#interface=eth0\n<\/code><\/pre>\n\n\n\n
[zeek]<\/strong><\/code> and define host address for your Zeek
logger<\/strong><\/code>,
manager<\/strong><\/code>,
proxy<\/strong><\/code> and
worker<\/strong><\/code>.<\/p>\n\n\n\n
\n
cat \/opt\/zeek\/etc\/node.cfg<\/code><\/pre>\n\n\n\n
# Example ZeekControl node configuration.\n#\n# This example has a standalone node ready to go except for possibly changing\n# the sniffing interface.\n\n# This is a complete standalone configuration. Most likely you will\n# only need to change the interface.\n#[zeek]\n#type=standalone\n#host=localhost\n#interface=eth0\n\n## Below is an example clustered configuration. If you use this,\n## remove the [zeek] node above.\n\n[kifarunix-demo-zeek-logger]\ntype=logger\nhost=192.168.58.22\n#\n[kifarunix-demo-zeek-manager]\ntype=manager\nhost=192.168.58.22\n#\n[kifarunix-demo-zeek-proxy]\ntype=proxy\nhost=192.168.58.22\n#\n[kifarunix-demo-zeek-worker]\ntype=worker\nhost=192.168.58.22\ninterface=enp0s8\n#\n[kifarunix-demo-worker-lo]\ntype=worker\nhost=localhost\ninterface=lo\n<\/code><\/pre>\n\n\n\n
Review Global ZeekControl configuration file<\/h4>\n\n\n\n
\/opt\/zeek\/etc\/zeekctl.cfg<\/strong><\/code>.<\/p>\n\n\n\n
Validate Zeek Configuration<\/h4>\n\n\n\n
zeekctl check<\/code><\/pre>\n\n\n\n
Hint: Run the zeekctl \"deploy\" command to get started.\nkifarunix-demo-zeek-logger scripts are ok.\nkifarunix-demo-zeek-manager scripts are ok.\nkifarunix-demo-zeek-proxy scripts are ok.\nkifarunix-demo-zeek-worker scripts are ok.\nkifarunix-demo-worker-lo scripts are ok.\n<\/code><\/pre>\n\n\n\n
Installing Zeek configurations<\/h4>\n\n\n\n
zeekctl install<\/code><\/pre>\n\n\n\n
Running Zeek<\/h4>\n\n\n\n
zeekctl start<\/code><\/pre>\n\n\n\n
zeekctl install<\/code> and then
zeekctl start<\/code>, you can combine the two using the command;<\/p>\n\n\n\n
zeekctl deploy<\/code><\/pre>\n\n\n\n
Check the status of Zeek Instance<\/h4>\n\n\n\n
zeekctl status<\/code><\/pre>\n\n\n\n
Name Type Host Status Pid Started\nkifarunix-demo-zeek-logger logger 192.168.59.16 running 17911 17 May 03:52:41\nkifarunix-demo-zeek-manager manager 192.168.59.16 running 17962 17 May 03:52:43\nkifarunix-demo-zeek-proxy proxy 192.168.59.16 running 18011 17 May 03:52:45\nkifarunix-demo-zeek-worker worker 192.168.59.16 running 18081 17 May 03:52:48\nkifarunix-demo-worker-lo worker localhost running 18082 17 May 03:52:48\n<\/code><\/pre>\n\n\n\n
Other ZeekControl commands<\/h4>\n\n\n\n
zeekctl help<\/code><\/pre>\n\n\n\n
\nZeekControl Version 2.3.0-5\n\n capstats [
Checking Zeek Logs<\/h4>\n\n\n\n
\/opt\/zeek\/logs\/current<\/strong><\/code> directory.<\/p>\n\n\n\n
ls -1 \/opt\/zeek\/logs\/current\/<\/code><\/pre>\n\n\n\n
broker.log\ncapture_loss.log\ncluster.log\nconn.log\ndhcp.log\nknown_services.log\nloaded_scripts.log\nnotice.log\npacket_filter.log\nreporter.log\nstats.log\nstderr.log\nstdout.log\nweird.log\n<\/code><\/pre>\n\n\n\n
\n
conn.log<\/strong><\/code>: Contains an entry for every connection seen on the wire, with basic properties such as time and duration, originator and responder IP addresses, services and ports, payload size, and much more. This log provides a comprehensive record of the network\u2019s activity.<\/em><\/li>\n\n\n\n
notice.log<\/strong><\/code>: Identifies specific activity that Zeek recognizes as potentially interesting, odd, or bad. Such activity is called a \u201cnotice\u201d.<\/em><\/li>\n\n\n\n
known_services.log<\/strong><\/code>: This log file contains the services detected on the local network and are known to be actively used by the clients on the network. It helps in enumerating what all services are observed on a local network and if they all are intentional and known to the network administrator.<\/em><\/li>\n\n\n\n
weird.log<\/strong><\/code>: Contains unusual or exceptional activity that can indicate malformed connections, traffic that doesn\u2019t conform to a particular protocol, malfunctioning or misconfigured hardware\/services, or even an attacker attempting to avoid\/confuse a sensor.<\/em><\/li>\n\n\n\n
(protocol).log<\/code><\/em><\/strong> such as (dns.log, dhcp.log, http.log, snmp.log): contains information for packets found in each respective protocol. <\/li>\n<\/ul>\n\n\n\n
tail \/opt\/zeek\/logs\/current\/conn.log<\/code><\/pre>\n\n\n\n
\n1641574281.587589\tCm5WfA3pJ25s3bbZn1\t192.168.58.22\t47763\t192.168.58.22\t48316\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574281.587662\tC5Wrln2Yh1Y5PhXZO4\t192.168.58.22\t47763\t192.168.58.22\t48318\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574284.454002\tCxnN0kz7NeFf9g5ra\t192.168.58.22\t35434\t192.168.58.22\t47761\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574284.936654\tCh0ywkpEgDkDI4hqk\t192.168.58.22\t35432\t192.168.58.22\t47761\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574287.708293\tC2qOcl1vMaYxUaDcU3\t192.168.58.22\t47761\t192.168.58.22\t35426\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574287.708323\tCgSooa1flTATHu6N8g\t192.168.58.22\t47761\t192.168.58.22\t35428\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574289.602766\tC96gMg3RQgvsbGmp55\t192.168.58.22\t47762\t192.168.58.22\t46776\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574289.602842\tCWOj3w2erhdPzHG0d8\t192.168.58.22\t47762\t192.168.58.22\t46786\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574289.602914\tCzBzwA4ITDK3ctjVNc\t192.168.58.22\t47762\t192.168.58.22\t46788\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\t-\n1641574289.942467\tCqoqDG3Bhuq7hrLeed\t192.168.58.22\t35432\t192.168.58.22\t47761\ttcp\t-\t-\t-\t-\tOTH\tT\tT\t0\tCc\t00\t0\t0\n<\/code><\/pre>\n\n\n\n
\n#fields\tts\tuid\tid.orig_h\tid.orig_p\tid.resp_h\tid.resp_p\tproto\tservice\tduration\torig_bytes\tresp_bytes\tconn_state\tlocal_orig\tlocal_resp\tmissed_bytes\thistory\torig_pkts\torig_ip_bytes\tresp_pkts\tresp_ip_bytes\ttunnel_parents\n#types\ttime\tstring\taddr\tport\taddr\tport\tenum\tstring\tinterval\tcount\tcount\tstring\tbool\tbool\tcount\tstring\tcount\tcount\tcount\tcount\tset[string]\n<\/code><\/pre>\n\n\n\n
Checking Zeek Node Processes<\/h4>\n\n\n\n
zeekctl ps.zeek <node><\/code><\/pre>\n\n\n\n
zeekctl ps.zeek kifarunix-demo-zeek-manager <\/pre>\n\n\n\n
\n USER PID PPID %CPU %MEM VSZ RSS TT S STARTED TIME COMMAND\n>>> 192.168.58.22\n (-) root 783 777 0.1 10.2 824476 102352 ? S 19:21:56 00:00:02 zeek\n (+) root 833 827 0.0 10.1 720236 101692 ? S 19:21:58 00:00:01 zeek\n (-) root 882 876 0.0 9.9 717956 99360 ? S 19:22:00 00:00:01 zeek\n (-) root 954 944 0.3 23.3 849108 233028 ? S 19:22:03 00:00:06 zeek\n (-) root 955 942 0.1 23.1 849696 231068 ? S 19:22:03 00:00:02 zeek\n<\/code><\/pre>\n\n\n\n
Reference<\/h3>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n