vulnersCom / zabbix-threat-control

Zabbix vulnerability assessment plugin
GNU General Public License v3.0
210 stars 59 forks source link

:bangbang: Updated Zabbix Threat Control to version 2.0 :bangbang:

šŸ’„ Update breaks the plugin's normal operation!
To make it work, please read the Update instructions.
And there's live-chat in Telegram, for technical support use our Telegram live-chat: @ztcsupport


Zabbix Threat Control

Šžur plugin transforms your Zabbix monitoring system into vulnerability, risk and security managment system for your infrastructure.

What the plugin does

It provides Zabbix with information about vulnerabilities existing in your entire infrastructure and suggests easily applicable remediation plans.

Information is displayed in Zabbix in the following format:

Security bulletins and packages information includes:

Sometimes it is impossible to update all packages on all servers to a version that fixes existing vulnerabilities. The proposed representation permits you to selectively update servers or packages.

This approach allows one to fix vulnerabilities using different strategies:

This can be done directly from Zabbix (using its standard functionality) either on the administrator command or automatically.

How the plugin works

Requirements

On zabbix-server host:

On all the servers that require a vulnerability scan:

Installation

RHEL, CentOS and other RPM-based

rpm -Uhv https://repo.vulners.com/redhat/vulners-repo.rpm

On zabbix-server host:

yum install zabbix-threat-control-main zabbix-threat-control-host

On all the servers that require a vulnerability scan:

yum install zabbix-threat-control-host

Debian and other debian-based

wget https://repo.vulners.com/vulners-repo-py3.deb
dpkg -i vulners-repo-py3.deb

On zabbix-server host:

apt-get update && apt-get install zabbix-threat-control-main zabbix-threat-control-host

On all the servers that require a vulnerability scan:

apt-get update && apt-get install zabbix-threat-control-host

From source

On zabbix-server host:

git clone https://github.com/vulnersCom/zabbix-threat-control.git
mkdir -p /opt/monitoring/zabbix-threat-control
cp -R zabbix-threat-control/os-report /opt/monitoring/
cp zabbix-threat-control/*.py /opt/monitoring/zabbix-threat-control/
cp zabbix-threat-control/*.conf /opt/monitoring/zabbix-threat-control/
chown -R zabbix:zabbix /opt/monitoring/
chmod 640 /opt/monitoring/zabbix-threat-control/*.conf
touch /var/log/zabbix-threat-control.log
chown zabbix:zabbix /var/log/zabbix-threat-control.log
chmod 664 /var/log/zabbix-threat-control.log

On all the servers that require a vulnerability scan:

git clone https://github.com/vulnersCom/zabbix-threat-control.git
mkdir -p /opt/monitoring/
cp -R zabbix-threat-control/os-report /opt/monitoring/
chown -R zabbix:zabbix /opt/monitoring/os-report

Configuration

The configuration file is located here: /opt/monitoring/zabbix-threat-control/ztc.conf

Vulners credentials

To use Vulners API you need an api-key. To get it follow the steps bellow:

Now you need to add the Vulners api-key into your configuration file (parameter VulnersApiKey).

VulnersApiKey = RGB9YPJG7CFAXP35PMDVYFFJPGZ9ZIRO1VGO9K9269B0K86K6XQQQR32O6007NUK

Zabbix credentials

In order to connect to Zabbix you need to specify the following in the configuration file:

Here is an example of a valid config file:

ZabbixApiUser = yourlogin
ZabbixApiPassword = yourpassword
ZabbixFrontUrl = https://zabbixfront.yourdomain.com

ZabbixServerFQDN = zabbixserver.yourdomain.com
ZabbixServerPort = 10051

Zabbix entity

  1. To create all the necessary objects in Zabbix, run the prepare.py script with parameters.
    /opt/monitoring/zabbix-threat-control/prepare.py -uvtd
    It will verify that zabbix-agent and zabbix-get utilities are configured correctly and create the following objects using Zabbix API:
    • A template used to collect data from servers.
    • Zabbix hosts for obtaining data on vulnerabilities.
    • An action to run the command fixes the vulnerability.
    • A dashboard for displaying results.
  2. While using the Zabbix web interface, it is necessary to link the "Vulners OS-Report" template with the hosts that you are doing a vulnerabilities scan on.

Servers that require a vulnerability scan

Zabbix-agent must be able to execute remote commands. For this, change the parameters in the zabbix-agent configuration file /etc/zabbix/zabbix_agentd.conf:

EnableRemoteCommands=1
LogRemoteCommands=1

Zabbix-agent must be able to update packages as root. For this, add a line to the file /etc/sudoers:

zabbix ALL=(ALL) NOPASSWD: /usr/bin/yum -y update *
zabbix ALL=(ALL) NOPASSWD: /usr/bin/apt-get --assume-yes install --only-upgrade *

Execution

The above scripts are run once a day. The start-up time is selected randomly during the installation and does not change during operation.

Usage

It will be ready soon...