Replicating the Zero repository
Prereqs
- Apache HTTP Server
- Zero command-line, we will refer to $zerohome as as the root of the zero cli installation
Setup Instructions
- If you used the zip to install the command-line instead of the installer, you may need to define a new module group. The default module group is set to experimental, which points to http://www.projectzero.org/repo/zero.repo.latest . To define a new module group, type
% $zerohome/zero modulegroup create $module.group.name $module.group.url
where $module.group.name is the name of the module group and $module.group.url is the URL of the remote repository that you want to copy, e.g. % $zerohome/zero modulegroup create myrepo https://www.projectzero.org/repo/zero.repo.M6
- To start using the new module group you have to switch to the new module group. The zero switch command can be used to switch the command line or a specific module. The command line's module group is used to detemine the module group of newly created applications. To switch the command line type
% $zerohome/zero switch $module.group.name
where $module.group.name is the name of the module group e.g. % $zerohome/zero switch myrepo
. To determine the modulegroup you can use the command % $zerohome/zero version
.
- Type
% $zerohome/zero modulegroup get all
which will download all of the modules from the remote repository onto the local machine in a repository located at $zerohome/zero-repository/$module.group.name
- Change the permission on the repository directory so it will be accessible to the public, e.g.
% chmod -R 755 $zerohome/zero-repository/$module.group.name/modules
- Open the apache config in an editor, which by default is located at /usr/local/apache2/conf/httpd.conf, to define the repository as an accessible directory with the Indexes option turned on, and restart apache when you are finished to load the new config. See below, where $zerohome and $module.group.name should be replaced appropriately with your information as defined in the above instructions, and $repo_uri is the URI of your new repository location:
Alias /$repo_uri /$zerohome/zero-repository/$module.group.name/modules
<Directory "$zerohome/zero-repository/$module.group.name/modules">
Options Indexes
</Directory>
Note: The configuration above is a minimum setup, you will probably want to have additional options on the Directory directive to make it more secure.
Test setup
- Test the repository by installing the CLI on a remote machine and defining a new module group
% $zerohome/zero modulegroup create $module.group.name $module.group.url
where $module.group.name is the name of the module group and $module.group.url is the URL of the remote repository that you just set up, e.g. % $zerohome/zero modulegroup create myrepo http://myhost/mynewrepo
. Again you need to switch to the new module group using % $zerohome/zero switch myrepo
and then type % $zerohome/zero modulegroup update
to download modules from the new repository.
Note: If you're testing from Windows, you may have a permission problem unless you use the following <Directory> setting, which replaces the one from above:
<Directory "$zerohome/zero-repository/$module.group.name/modules">
Options Indexes
Order allow,deny
Allow from all
</Directory>