Tutorials

From
Jump to navigation Jump to search

Setting up a new RADAR instance

RADAR runs on Python 3.6+ and can be installed using the python package manager, pip.

Download

The program can be downloaded here. The program is distributed as a python wheel, a file that contains all the sources.

Installation

Once the wheel has been downloaded, the program can be installed using the following command:

pip install <name_of_the_wheel>

Pip will install all the dependencies of RADAR and add the program to the python path.

It is recommended to install RADAR in a virtual environment.

Key and Certificates

RADAR uses a public-key infrastrucure. An appropriate key can be generated using openSSL:

openssl ecparam -name secp384r1 -genkey | openssl ec -out client/private/node.key.pem
chmod 400 client/private/node.key.pem

This key should be kept absolutely private, and backed up in a safe place.

This key then has to be certified by the administrator of the network. You must generate a Certificate Signing Request (CSR) using the following command:

openssl req -config openssl.cnf -new -key node.key.pem -out node.csr.pem

You should ask the network administrator for the detail of the information that OpenSSL will ask you to enter.

The CSR file generatd by the above command should then be transmitted to the network administrator, who will sign it and send you back to files:

  • the certificate (node.cert.pem),
  • the certificate chain (ca-chain.cert.pem).

Configuration

The configuration of the program is done through a single configuration file. This file is passed to the program using the '-c' mandatory parameter.

Example configuration:

root_path = /home/radar/files              
temp_path = /home/radar/temp
database_location = /home/radar/db.sqlite
cert = /home/radar/node.cert.pem
key = /home/radar/node.key.pem
chain = /home/radar/ca-chain.cert.pem
plugin_location = /home/radar/plugins
ip = 0.0.0.0
tcp_port = 4444
udp_port = 4445
api_ip = 0.0.0.0
api_port = 8080
update_frequency = 60
allocated_space = 5000000000

['generic_plugin']
generic_conf = 42

The configuration for the main program lives in the first part of the file. The following aspects of the program can be configured:

  • root_path: this is the place where the files will be stored. RADAR creates two sub-directories (local_files and foreign_files). The former is monitored for files to add to the network, and the latter is used to store files sent by the other nodes.
  • temp_path: this directory will be used to store temporary files.
  • database_location: the location of the application SQLite database.
  • cert, key, chain: the certificate, key, and certificate chain.
  • plugin_location: the directory where the plugins are located.
  • ip: the IP address that the program will listen on.
  • tcp_port, udp_port: the ports that the program will use for file transfer and message exchange. These ports must ba visible to the rest of the instances of the network.
  • api_ip, api_port: the ip and port that RADAR's REST API will serve on.
  • update_frequency: the number of update messages that the instance will emit, per hour.
  • allocated_space: the maximum space that the node will use to store foreign files. As of version 1.0, this limit is not strongly enforced but the other nodes will try not to break this limit.

Plugins

The plugins must be placed in the directory specified in the configuration file ('plugin_location').

Running the program

Once it has been installed, the program can be run with:

python -m radar --config <config_file>

Once again, it is recommended to run RADAR inside a virtual environment.

RADAR accepts several arguments:

  • --plugins, -p: enable plugin support.
  • --verbose, -v: run in verbose mode.