Skip to content

Hyperglass

dhellstern edited this page Apr 17, 2022 · 5 revisions

[Deprecated]

Introduction

Hyperglass is a modern BGP Looking Glass written in Python, with a React frontend. It uses SSH to connect to supported routers and run commands to gain insight into the current BGP routing and forwarding tables.

Installation/Configuration

First, install python3-dev and python3-pip. Hyperglass comes as a PyPI package, but the UI depends on some JavaScript dependencies, and the backend uses Redis for caching. To install the JavaScript dependencies, run the following commands (they install NodeJS and Yarn, to be used during the Python package install).

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Then, apt update and apt install nodejs yarn redis-server. Then, run useradd -md /opt/hyperglass --system hyperglass to create a new unprivileged user to run Hyperglass. Run /opt/hyperglass/.local/bin/hyperglass setup as the new user to create the Hyperglass files in /etc/hyperglass/ (this folder must be precreated and permissions added for Hyperglass). Create a new file in this directory called hyperglass.yaml, containing the basic UI settings.

primary_asn: 4242421878
org_name: Champlain
site_title: AS4242421878 Looking Glass

Then, configure the router connection by creating the file devices.yaml, containing the settings needed to connect to a supported device. It may also be necessary to first create an SSH key to access the router, with ssh-keygen -t ed25519.

routers:
- name: fw-1
  address: 172.23.119.65
  network:
    name: main
    display_name: AS4242421878
  credential:
    username: lg
    key: /etc/hyperglass/id_ed25519
  port: 22
  nos: vyos
  vrfs: []

Lastly, run hyperglass build-ui to compile the frontend. If there is an error about yarn not having a --silent option, then run apt update and apt install yarn again to install the correct Yarn package. The UI build will take a while, and is resource-intensive, but should complete within a couple minutes. If this succeeds, change the ownership of /tmp/hyperglass/ and /tmp/hyperglass.log to the hyperglass user, or delete both to recreate them when Hyperglass is started by the correct user.

Create a new Systemd service in /etc/systemd/system/hyperglass.service to run Hyperglass with. The paths and service names below may differ on RHEL-based systems.

[Unit]
Description=hyperglass
After=network.target
Requires=redis-server

[Service]
User=hyperglass
Group=hyperglass
ExecStart=/usr/local/bin/hyperglass start

[Install]
WantedBy=multi-user.target

Run chown -R hyperglass:hyperglass /etc/hyperglass/ to give the hyperglass user access to the files it needs, including any SSH keys added to /etc/hyperglass/. Do the same for the file /tmp/hyperglass.log, or delete it to allow the file to be recreated by the correct user.

Reverse Proxy

Hyperglass runs on localhost for additional security, and must be reverse proxied to become externally accessible. Install nginx and create the file `

Clone this wiki locally