1. Quickstart Guide

1.1. Dependencies

Note that following the suggested Installation process via pip will automatically install dependencies for you.

1.2. Installation

Using the latest stable release on PyPI:

$ pip install zkg

Using the latest git development version:

$ pip install git+git://github.com/zeek/package-manager@master

1.3. Basic Configuration

After installing via pip, additional configuration is required. First, make sure that the zeek-config script that gets installed with zeek is in your PATH. Then, as the user you want to run zkg with, do:

$ zkg autoconfig

This automatically generates a config file with the following suggested settings that should work for most Zeek deployments:

  • script_dir: set to the location of Zeek's site scripts directory (e.g. <zeek_install_prefix>/share/zeek/site)
  • plugin_dir: set to the location of Zeek's default plugin directory (e.g. <zeek_install_prefix>/lib/zeek/plugins)
  • zeek_dist: set to the location of Zeek's source code. If you didn't build/install Zeek from source code, this field will not be set, but it's only needed if you plan on installing packages that have uncompiled Zeek plugins.

With those settings, the package manager will install Zeek scripts, Zeek plugins, and ZeekControl plugins into directories where zeek and zeekctl will, by default, look for them. ZeekControl clusters will also automatically distribute installed package scripts/plugins to all nodes.

Note

If your Zeek installation is owned by "root" and you intend to run zkg as a different user, then you should grant "write" access to the directories specified by script_dir and plugin_dir. E.g. you could do something like:

$ sudo chgrp $USER $(zeek-config --site_dir) $(zeek-config --plugin_dir)
$ sudo chmod g+rwX $(zeek-config --site_dir) $(zeek-config --plugin_dir)

The final step is to edit your site/local.zeek. If you want to have Zeek automatically load the scripts from all installed packages that are also marked as "loaded" add:

@load packages

If you prefer to manually pick the package scripts to load, you may instead add lines like @load <package_name>, where <package_name> is the shorthand name of the desired package.

If you want to further customize your configuration, see the Advanced Configuration section and also check here for a full explanation of config file options. Otherwise you're ready to use zkg.

1.4. Advanced Configuration

If you prefer to not use the suggested Basic Configuration settings for script_dir and plugin_dir, the default configuration will install all package scripts/plugins within ~/.zkg or you may change them to whatever location you prefer. These will be referred to as "non-standard" locations in the sense that vanilla configurations of either zeek or zeekctl will not detect scripts/plugins in those locations without additional configuration.

When using non-standard location, follow these steps to integrate with zeek and zeekctl:

  • To get command-line zeek to be aware of Zeek scripts/plugins in a non-standard location, make sure the zeek-config script (that gets installed along with zeek) is in your PATH and run:

    $ `zkg env`
    

    Note that this sets up the environment only for the current shell session.

  • To get zeekctl to be aware of scripts/plugins in a non-standard location, run:

    $ zkg config script_dir
    

    And set the SitePolicyPath option in zeekctl.cfg based on the output you see. Similarly, run:

    $ zkg config plugin_dir
    

    And set the SitePluginPath option in zeekctl.cfg based on the output you see.

1.5. Usage

Check the output of zkg --help for an explanation of all available functionality of the command-line tool.

1.5.1. Package Upgrades/Versioning

When installing packages, note that the install command, has a --version flag that may be used to install specific package versions which may either be git release tags or branch names. The way that zkg receives updates for a package depends on whether the package is first installed to track stable releases or a specific git branch. See the package upgrade process documentation to learn how zkg treats each situation.

1.5.2. Offline Usage

It's common to have limited network/internet access on the systems where Zeek is deployed. To accomodate those scenarios, zkg can be used as normally on a system that does have network access to create bundles of its package installation environment. Those bundles can then be transferred to the deployment systems via whatever means are appropriate (SSH, USB flash drive, etc).

For example, on the package management system you can do typical package management tasks, like install and update packages:

$ zkg install <package name>

Then, via the bundle command, create a bundle file which contains a snapshot of all currently installed packages:

$ zkg bundle zeek-packages.bundle

Then transfer zeek-packages.bundle to the Zeek deployment management host. For Zeek clusters using ZeekControl, this will be the system acting as the "manager" node. Then on that system (assuming it already as zkg installed and configured):

$ zkg unbundle zeek-packages.bundle

Finally, if you're using ZeekControl, and the unbundling process was successful, you need to deploy the changes to worker nodes:

$ zeekctl deploy