move docs to github for simplicity, cleanup a bunch of templates, prep for init release

This commit is contained in:
Micky 2024-12-25 21:22:33 +11:00
parent acb7cff1e4
commit fe24094f86
17 changed files with 92 additions and 405 deletions

10
.gitignore vendored
View File

@ -1,14 +1,6 @@
# Config files # Config files
instance/ instance/*
docker-compose.yml
# Static files
app/static/images/**
!app/static/images/
!app/static/images/default-logo-dark.svg
!app/static/images/default-logo-light.svg
!app/static/images/default-favicon.svg
# Python # Python
app/__pycache__/ app/__pycache__/

View File

@ -1,14 +0,0 @@
version: 2
build:
os: ubuntu-24.04
tools:
python: "3.11"
nodejs: "20"
sphinx:
configuration: docs/conf.py
python:
install:
- requirements: docs/requirements.txt

100
README.md
View File

@ -1,46 +1,84 @@
# Looking Glass Network Management # photonglass
A modern, distributed looking glass application that provides network insight for network operators.
A modern web-based looking glass application that provides infrastructure monitoring and administration capabilities for network professionals. Built with Flask and Vue.js, this platform delivers real-time network analysis through an intuitive browser-based interface.
## Features ## Features
-**Multi-Device Support**: Connect to multiple devices from one single interface.
-**Easy Deployment**: Extremely easy to deploy and scale with multiple devices.
- 🌐 **Multi-Location Support**: Monitor network performance across different geographical locations
- 🔍 **Network Diagnostics**: Execute common network commands (ping, traceroute, MTR)
- 🎨 **Modern UI**: Clean, responsive interface with dark/light mode support
- 🔒 **Secure Command Execution**: Built-in input validation and command sanitization
- ⚡ **Real-Time Updates**: WebSocket-based live data streaming
- 📱 **Responsive Design**: Optimized for both desktop and mobile devices
- 🎯 **BGP Community Lookup**: Advanced BGP routing information
- 🔄 **Docker Support**: Easy deployment with containerization
## Quick Start ## Setup (Docker)
1. Clone repository
- `git clone https://github.com/AliMickey/photonglass.git`
2. Create an instance folder to store your config and logos
- `cd photonglass`
- `mkdir instance`
- `mkdir instance/images`
3. Create config files and upload logos (follow config template below)
4. Edit `docker-compose.yml` if required (images path is commented out by default)
4. Build and deploy the container
- `docker compose up -d --build`
5. View the app at `http://IP_ADDRESS:5000`, recommend using a reverse proxy (traefik) for production use.
See our [installation guide](https://looking-glass.readthedocs.io/en/latest/installation.html) for detailed setup instructions.
## Documentation
Full documentation is available at [looking-glass.readthedocs.io](https://looking-glass.readthedocs.io/).
Key documentation sections:
- [Installation Guide](https://looking-glass.readthedocs.io/en/latest/installation.html)
- [Configuration Options](https://looking-glass.readthedocs.io/en/latest/configuration.html)
- [Usage Guide](https://looking-glass.readthedocs.io/en/latest/usage.html)
- [API Documentation](https://looking-glass.readthedocs.io/en/latest/api.html)
## Configuration ## Configuration
### instance/config.yaml
```
header:
title: "photonglass"
logo_href: "#"
The application uses YAML configuration files for customization: footer:
text: "photonglass"
peeringdb_href: "https://www.peeringdb.com"
github_href: "https://github.com/alimickey"
- `instance/config.yaml`: Core application settings ```
- `instance/commands.yaml`: Network command definitions
- `instance/devices.yaml`: Network device configurations
See the [configuration documentation](https://looking-glass.readthedocs.io/en/latest/configuration.html) for detailed options. ### instance/commands.yaml
```
- id: "ping"
display_name: "Ping"
format: "ping -{ip_version} -c 4 {target}"
description: "Test network connectivity"
field:
type: "text"
placeholder: "Enter IP address or hostname"
## Contributing - id: "traceroute"
display_name: "Traceroute"
format: "traceroute -{ip_version} {target}"
description: "Trace network path to destination"
field:
type: "text"
placeholder: "Enter IP address or hostname"
Contributions are welcome! Please read our [contributing guidelines](https://looking-glass.readthedocs.io/en/latest/contributing.html) before submitting pull requests. - id: "mtr"
display_name: "MTR"
format: "mtr -{ip_version} -r {target}"
description: "Trace network path with stats"
field:
type: "text"
placeholder: "Enter IP address or hostname"
```
## License ### instance/devices.yaml
```
- id: "unique-sydney"
display_name: "Sydney"
subtext: "Equinix SY3"
country_code: "AU"
type: "linux"
host: "IP_ADDRESS"
port: PORT
username: "USERNAME"
password: "PASSWORD"
commands:
- ping
- traceroute
- mtr
```
This project is licensed under the MIT License - see the LICENSE file for details.
## Attribution
This project was inspired by hyperglass after having difficulty deploying it. This project is not meant as a 1:1 replacement with hyperglass and as such is kept simple by design. At time of release only linux servers were tested as a target device, the same device library as hyperglass is used (netmiko) so compatibility with more devices should not be an issue, just be aware it is untested.

View File

Before

Width:  |  Height:  |  Size: 755 B

After

Width:  |  Height:  |  Size: 755 B

View File

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

View File

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

View File

@ -5,7 +5,7 @@ const app = Vue.createApp({
selectedDevice: '', selectedDevice: '',
selectedCommand: '', selectedCommand: '',
targetIp: '', targetIp: '',
selectedIpVersion: 'IPv4', // Default to IPv4 selectedIpVersion: 'IPv4',
isLoading: false, isLoading: false,
commandResult: '', commandResult: '',
devices: window.initialData?.devices || [], devices: window.initialData?.devices || [],

View File

@ -3,9 +3,9 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="icon" type="image/svg+xml" href="{{ config.site.favicon }}"/> <link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='images/favicon.svg') }}"/>
<link rel="apple-touch-icon" href="{{ config.site.favicon }}"/> <link rel="apple-touch-icon" href="{{ url_for('static', filename='images/favicon.svg') }}"/>
<title>{{ config.site.title }}</title> <title>{{ config.header.title }}</title>
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script> <script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<link href="{{ url_for('static', filename='css/styles.css') }}" rel="stylesheet"/> <link href="{{ url_for('static', filename='css/styles.css') }}" rel="stylesheet"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@6.11.0/css/flag-icons.min.css"/> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@6.11.0/css/flag-icons.min.css"/>
@ -30,9 +30,9 @@
<div id="app" class="min-h-screen flex flex-col"> <div id="app" class="min-h-screen flex flex-col">
<div class="flex-grow w-full max-w-7xl px-4 mx-auto"> <div class="flex-grow w-full max-w-7xl px-4 mx-auto">
<div class="mt-8 mb-12 flex justify-center items-center"> <div class="mt-8 mb-12 flex justify-center items-center">
<a href="{{ config.logo.href }}" target="_blank" class="inline-block"> <a href="{{ config.header.logo_href }}" target="_blank" class="inline-block">
<img src="{{ config.logo.light }}" alt="Logo" class="h-12 w-auto dark:hidden"/> <img src="{{ url_for('static', filename='images/logo-light.svg') }}" alt="Logo" class="h-12 w-auto dark:hidden"/>
<img src="{{ config.logo.dark }}" alt="Logo" class="h-12 w-auto hidden dark:block"/> <img src="{{ url_for('static', filename='images/logo-dark.svg') }}" alt="Logo" class="h-12 w-auto hidden dark:block"/>
</a> </a>
</div> </div>

View File

@ -20,12 +20,12 @@
</button> </button>
<!-- PeeringDB Link --> <!-- PeeringDB Link -->
<a href="{{ config.footer.external_links.peeringdb }}" target="_blank" rel="noopener noreferrer" class="text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200"> <a href="{{ config.footer.peeringdb_href }}" target="_blank" rel="noopener noreferrer" class="text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200">
PeeringDB PeeringDB
</a> </a>
<!-- GitHub Link --> <!-- GitHub Link -->
<a href="{{ config.footer.external_links.github }}" target="_blank" rel="noopener noreferrer" class="text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800"> <a href="{{ config.footer.github_href }}" target="_blank" rel="noopener noreferrer" class="text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 24 24">
<path fill="currentColor" d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/> <path fill="currentColor" d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg> </svg>
@ -90,24 +90,7 @@
</button> </button>
</div> </div>
<div class="prose dark:prose-invert max-w-none"> <div class="prose dark:prose-invert max-w-none">
<p> <p>By using this Looking Glass service, you agree to use the service responsibly and not for any malicious purposes, not attempt to overload or disrupt the service, respect the privacy and security measures in place.</p>
By using this Looking Glass service, you agree
to:
</p>
<ul>
<li>
Use the service responsibly and not for any
malicious purposes
</li>
<li>
Not attempt to overload or disrupt the
service
</li>
<li>
Respect the privacy and security measures in
place
</li>
</ul>
</div> </div>
</div> </div>
</div> </div>

View File

@ -145,7 +145,6 @@
<!-- Results --> <!-- Results -->
<div v-if="commandResult" class="mb-8 max-w-6xl mx-auto"> <div v-if="commandResult" class="mb-8 max-w-6xl mx-auto">
<h2 class="text-gray-400 text-sm mb-4">Results</h2>
<pre class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-4 text-gray-800 dark:text-gray-300 font-mono text-sm overflow-x-auto whitespace-pre break-words">${commandResult}</pre> <pre class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-4 text-gray-800 dark:text-gray-300 font-mono text-sm overflow-x-auto whitespace-pre break-words">${commandResult}</pre>
</div> </div>
</div> </div>

View File

@ -16,6 +16,7 @@ def index():
devices = load_yaml('devices') devices = load_yaml('devices')
commands = load_yaml('commands') commands = load_yaml('commands')
# Remove sensitive data before passing to Jinja as additional security measure
for device in devices: for device in devices:
device.pop('username', None) device.pop('username', None)
device.pop('password', None) device.pop('password', None)
@ -25,6 +26,7 @@ def index():
return render_template('index.html', config=config, devices=devices, commands=commands) return render_template('index.html', config=config, devices=devices, commands=commands)
# Route to handle command execution requests
@bp.route('/execute', methods=['POST']) @bp.route('/execute', methods=['POST'])
@exception_handler @exception_handler
def execute(): def execute():

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
services:
photonglass:
container_name: photonglass
restart: unless-stopped
build: .
ports:
- 5000:5000
volumes:
- ./instance:/instance
# - ./instance/images:/app/static/images

View File

@ -1,44 +0,0 @@
# Configuration file for the Sphinx documentation builder.
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# Project information
project = 'photonglass'
copyright = '2024, photonglass'
author = 'AliMickey'
release = '1.0.0'
# General configuration
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx_rtd_theme',
'sphinx.ext.intersphinx',
'myst_parser'
]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# HTML output options
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_title = 'Looking Glass Documentation'
# Intersphinx configuration
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'flask': ('https://flask.palletsprojects.com/en/2.3.x/', None),
}
# autodoc configuration
autodoc_default_options = {
'members': True,
'member-order': 'bysource',
'special-members': '__init__',
'undoc-members': True,
'exclude-members': '__weakref__'
}

View File

@ -1,161 +0,0 @@
Configuration
============
This section details all configuration options available in the Looking Glass application.
Core Configuration (config.yaml)
------------------------------
The ``instance/config.yaml`` file contains core application settings and UI customization options.
Site Settings
~~~~~~~~~~~~
.. code-block:: yaml
site:
title: "photonglass" # Application title displayed in browser
favicon: "/static/images/default-favicon.svg" # Site favicon path
Logo Configuration
~~~~~~~~~~~~~~~~
.. code-block:: yaml
logo:
dark: "/static/images/default-logo-dark.svg" # Logo for dark mode
light: "/static/images/default-logo-light.svg" # Logo for light mode
Footer Settings
~~~~~~~~~~~~~
.. code-block:: yaml
footer:
text: "photonglass" # Footer text
external_links: # External links in footer
peeringdb: "https://www.peeringdb.com"
github: "https://github.com/AliMickey/photonglass" # For credit, remove if you want :)
Network Commands (commands.yaml)
-----------------------------
The ``instance/commands.yaml`` file defines available network diagnostic commands and their parameters.
Command Definition Format
~~~~~~~~~~~~~~~~~~~~~~~
Each command is defined with the following structure:
.. code-block:: yaml
- id: "command_id" # Unique identifier for the command
display_name: "Command Name" # Display name in the UI
format: "command {target}" # Command format with placeholders
description: "Description" # Command description
field: # Input field configuration
type: "text" # Input field type
placeholder: "Enter..." # Placeholder text
Available Commands
~~~~~~~~~~~~~~~~
Ping Command
^^^^^^^^^^^
.. code-block:: yaml
- id: "ping"
display_name: "Ping"
format: "ping -c 4 {target}"
description: "Test network connectivity"
field:
type: "text"
placeholder: "Enter IP address or hostname"
Traceroute Command
^^^^^^^^^^^^^^^^^
.. code-block:: yaml
- id: "traceroute"
display_name: "Traceroute"
format: "traceroute {target}"
description: "Trace network path to destination"
field:
type: "text"
placeholder: "Enter IP address or hostname"
MTR Command
^^^^^^^^^^
.. code-block:: yaml
- id: "mtr"
display_name: "MTR"
format: "mtr -r {target}"
description: "My Traceroute - Network diagnostic tool"
field:
type: "text"
placeholder: "Enter IP address or hostname"
Network Devices (devices.yaml)
---------------------------
The ``instance/devices.yaml`` file contains network device configurations and access control settings.
Device Configuration Format
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
- id: "device_id" # Unique device identifier
name: "Device Name" # Display name
type: "router/switch" # Device type
location: "Location Name" # Physical location
host: "192.168.1.1" # Management IP address
port: 22 # SSH port
credentials: # Access credentials
username: "admin"
key_file: "/path/to/key" # SSH key file path
commands: # List of allowed commands
- "ping"
- "traceroute"
Security Recommendations
---------------------
1. Credentials and Secrets
- Never commit sensitive information to version control
- Use environment variables for secrets
- Regularly rotate credentials
2. Network Access
- Implement strict ACLs for command targets
- Use allowlists for permitted networks
- Rate limit command execution
3. Authentication
- Enable HTTPS in production
- Implement user authentication if needed
- Use strong password policies
4. Monitoring
- Enable logging for all command executions
- Monitor system resources
- Set up alerts for suspicious activities
For more information about security best practices, refer to the :doc:`security` section.
Custom Commands
~~~~~~~~~~~~~
To add custom network commands:
1. Add command definition to ``commands.yaml``
2. Implement command validation if needed
3. Update the UI help documentation
4. Test the command execution
Refer to the :doc:`development` section for more details about extending the application.

View File

@ -1,41 +0,0 @@
Welcome to Looking Glass Documentation
====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
introduction
installation
configuration
usage
api
development
contributing
changelog
Introduction
-----------
Looking Glass is a modern web application for Internet Service Providers (ISPs) that provides network command execution capabilities. It allows network operators and customers to perform various network diagnostic commands in a secure and controlled manner.
Quick Start
----------
Check out the :doc:`installation` guide to get started with Looking Glass.
Features
--------
* Modern web interface built with Flask and TailwindCSS
* Secure command execution with input validation
* Support for multiple network diagnostic commands:
* Ping
* Traceroute
* MTR
* Configurable command permissions and validation rules
* Easy to deploy and maintain
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,73 +0,0 @@
Installation
===========
This guide covers Docker deployment options for photonglass.
Requirements
-----------
* Docker and Docker Compose
* Network access to target devices
Deployment
---------------
1. Clone the repository::
git clone <repository-url>
cd looking-glass
2. Configure the application::
cp instance/config.yaml.example instance/config.yaml
cp instance/commands.yaml.example instance/commands.yaml
cp instance/devices.yaml.example instance/devices.yaml
3. Build and start the containers::
docker compose up -d
This will:
- Build the application image
- Start the web application container
- Initialize the TailwindCSS build process
4. Access the application at ``http://localhost:5000``
Configuration Files
-----------------
The application uses three main configuration files:
1. ``instance/config.yaml``
- Core application settings
- UI customization
- Logging configuration
2. ``instance/commands.yaml``
- Network diagnostic commands
- Command parameters and validation rules
- Output formatting options
3. ``instance/devices.yaml``
- Network device definitions
- Authentication credentials
- Access control rules
See the :doc:`configuration` section for detailed configuration options.
Security Considerations
---------------------
1. Always change default credentials
2. Use strong passwords for database and application access
3. Configure appropriate network access controls
4. Regularly update dependencies
5. Monitor application logs for security events
Next Steps
---------
After installation, refer to:
- :doc:`configuration` for detailed setup options
- :doc:`usage` for operation instructions
- :doc:`api` for API documentation

View File

@ -1,4 +0,0 @@
sphinx
sphinx-rtd-theme
sphinx-autodoc-typehints
myst-parser