This application is a simple API that interfaces with the ExaBGP service.
Each time this app receives a new command, it forwards the command to ExaBGP via stdout. The registered ExaBGP service monitors the stdout of this API application.
Install the package using pip:
pip install exabgp-processAlternative installation methods:
# Using uv
uv pip install exabgp-process
# Using Poetry (create a new project first)
poetry new my-exabgp-project
cd my-exabgp-project
poetry add exabgp-processAfter installation, generate the configuration file:
exabgp-process --generate-config > process.confOpen process.conf and configure according to your needs:
For RabbitMQ (recommended for production):
[api]
type = rabbitmqDon't forged to set you rabbitmq host, username, password etc.
For HTTP (development/testing only - no security layer):
[api]
type = httpYou can then configure the server IP and PORT if you need.
Ensure the log directory exists and is writable by the ExaBGP process:
# Create the log directory specified in your config
sudo mkdir -p /var/log/myapp
sudo chown exabgp:exabgp /var/log/myapp # Adjust user/group as neededCopy the configuration file to the appropriate location:
sudo mv process.conf /etc/exabgp/process.confThe application searches for configuration files in the following locations (in order):
api.conf(current directory)process.conf(current directory)/etc/exabgp_process/process.conf/etc/exabgp/process.conf/usr/local/etc/exabgp_process/process.conf
Add the following to your ExaBGP configuration file:
process flowspec {
run /usr/local/bin/exabgp-process;
encoder json;
}
Note: The exact path to exabgp-process may vary depending on your installation. You can find it using:
which exabgp-processYou can run the process directly for testing:
exabgp-processThe application expects JSON messages with the following structure:
{
"author": "username",
"source": "application_name",
"command": "announce route 192.0.2.1/32 next-hop 192.0.2.254"
}author: For logging purposes (who initiated the command)source: For logging purposes (which application sent the command)command: The actual ExaBGP command to execute
When using RabbitMQ, ensure your RabbitMQ server is running and accessible with the credentials specified in your configuration file.
Security Warning: The HTTP version has no authentication or encryption. Only use it for development/testing, and restrict access to localhost only. It also uses only Flask development server, that is also not recomended for production usage.
For development and testing, the HTTP version is available. However, please note that this web app lacks any security layer. Therefore, it's recommended to:
- Restrict access to localhost only
- Use RabbitMQ for production environments
- Never expose the HTTP API to public networks
For more information, refer to the ExaBGP documentation.
If exabgp-process command is not found after installation:
# Verify installation
pip show exabgp-process
# Find the executable
which exabgp-process
# If using a virtual environment, make sure it's activated
source venv/bin/activateEnsure the log directory has proper permissions:
sudo chown -R <exabgp-user>:<exabgp-group> /var/log/myapp- Verify RabbitMQ is running:
sudo systemctl status rabbitmq-server - Check credentials and vhost configuration
- Ensure the queue exists or the user has permissions to create it
- 1.0.4 - Fixed template for config file
- 1.0.3 - New format of message from server - JSON with keys:
author,source,command. Author and source are for logging purposes, command is sent to the process - 1.0.2 - Switch to pyproject.toml for better description
See LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.