4. How-To: Create a Package Source¶
bro-pkg, by default, is configured to obtain packages from a single "package source", the Bro Packages Git Repository, which is hosted by and loosely curated by the Bro Team. However, users may configure bro-pkg to use other package sources: either ones they've set up themselves for organization purposes or those hosted by other third parties.
4.1. Package Source Setup¶
In order to set up such a package source, one simply has to create a git
repository and then add Package Index Files to it.
These files may be created at any path in the package source's git repository.
E.g. the Bro Packages Git Repository organizes package index files
hierarchically based on package author names such as
bob are usually GitHub
usernames or some unique way of identifying the organization/person that
maintains Bro packages. However, a source is free to use a flat organization
with a single, top-level
After creating a git repo for the package source and adding package index files to it, it's ready to be used by bro-pkg.
4.2. Package Index Files¶
bro-pkg.index are used to describe the Bro Packages found within the package source. They are simply a list of
git URLs pointing to the git repositories of packages. For example:
https://github.com/bro/foo https://github.com/bro/bar https://github.com/bro/baz
Local filesystem paths are also valid if the package source is only meant for your own private usage or testing.
4.3. Adding Packages¶
Adding packages is as simple as adding new Package Index Files or extending existing ones with new URLs and then commiting/pushing those changes to the package source git repository.
4.4. Removing Packages¶
Just remove the package's URL from the Package Index File that it's contained within.
Users that had previously installed the now-removed package may continue to use it and receive updates for it.
4.5. Aggregating Metadata¶
The maintainer/operator of a package source may choose to periodically aggregate
the metadata contained in its package's
bro-pkg.meta files. The
bro-pkg refresh is used to perform the task. For
$ bro-pkg refresh --aggregate --push --sources my_source
--push flag is helpful for setting up cron jobs to
automatically perform this task periodically, assuming you've set up your
git configuration to push changesets without interactive prompts. E.g.
to set up pushing to remote servers you could set up SSH public key
Aggregated metadata gets written to a file named
at the top-level of a package source and the list,
search, and info all may access
this file. Having access to the aggregated metadata in this way
is beneficial to all bro-pkg users because they then will not have
to crawl the set of packages listed in a source in order to obtain this metadata
as it will have already been pre-aggregated by the operator of the package