Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LookingGlass

A user-friendly PHP looking glass that lets visitors run network diagnostics (host, mtr, ping, traceroute, and IPv6 variants) on your server through a web UI.

Current version: 1.0.0 (PHP 8.1+, Bootstrap 5, CSRF protection, multi-node)

Author: Aria Jahangiri Far

Features

  • Automated install via configure.sh
  • IPv4 and IPv6 commands
  • Live streamed command output
  • Light / dark themes
  • Per-IP rate limiting (SQLite)
  • CSRF-protected command endpoint (POST)
  • Multiple nodes — add remote LookingGlass servers and run tests from them

Requirements

  • PHP 8.1+ with PDO SQLite and cURL (required for remote nodes)
  • Linux host with host, mtr, ping/ping6, traceroute
  • Apache (with AllowOverride) or Nginx + PHP-FPM

Install

  1. Place files in your web root.

  2. Copy config:

    cp LookingGlass/Config.example.php LookingGlass/Config.php

    Edit values (especially $adminPassword and $apiKey), or run:

    cd LookingGlass
    bash configure.sh
  3. Ensure Apache/Nginx denies HTTP access to /LookingGlass.

Multi-node setup

Use multiple LookingGlass installs (for example one per PoP). Visitors choose a Node in the test form; this server runs the command locally or proxies it to a remote peer.

1. Prepare each server

  1. Install LookingGlass on every server that should run tests (same codebase and PHP requirements).
  2. On every server, edit LookingGlass/Config.php:
    • Set $adminPassword to a strong password (used only on the server where you manage the node list).
    • Set $apiKey to a long random secret. The same $apiKey must be configured on all peers.
  3. Ensure PHP cURL is enabled on the server that will proxy to remotes (usually your main / hub instance).
  4. Prefer HTTPS for every LookingGlass URL.

Example secrets in Config.php:

$adminPassword = 'your-strong-admin-password';
$apiKey = 'a-long-random-shared-secret';

2. Add a local node (this server)

  1. Open https://your-main-lg.example.com/admin.php.
  2. Log in with $adminPassword.
  3. Under Add node, fill in:
    • Name — display name, e.g. Tehran
    • Location — optional label, e.g. IR-THR
    • Base URL — leave empty so tests run on this server
  4. Click Add node.

A default Local node is created automatically if none exist; you can rename it or add another local-style entry with an empty URL.

3. Add a remote node

  1. Confirm LookingGlass is working on the remote host, e.g. https://lg-fra.example.com.
  2. On that remote host, set the same $apiKey as on the hub in LookingGlass/Config.php.
  3. On the hub, open /admin.php again and add a node:
    • Name — e.g. Frankfurt
    • Location — e.g. DE-FRA
    • Base URL — LookingGlass site root only, no trailing slash and not pointing at ajax.php
      Correct: https://lg-fra.example.com
      Wrong: https://lg-fra.example.com/ or https://lg-fra.example.com/ajax.php
  4. Click Add node.
  5. On the public Looking Glass page, select the new node and run a test (e.g. ping to 1.1.1.1).

If the remote is unreachable, check firewall/DNS, matching $apiKey, and that cURL can reach the remote URL from the hub.

4. Edit or remove nodes

In /admin.php (while logged in):

  • Change name, location, or URL, then click Save.
  • Click × to delete a node (if you remove all nodes, a default local node is recreated).

5. How visitors use nodes

  1. Open the main Looking Glass page.
  2. Enter a host or IP.
  3. Choose a Node from the dropdown.
  4. Choose a command and click Run Test.

Local nodes execute on this server. Remote nodes are called by this server using $apiKey (visitors never see the key).

Checklist

Item Hub Each remote
LookingGlass installed Yes Yes
Same $apiKey Yes Yes
$adminPassword set Yes (to manage list) Optional
Node URL empty Local tests —
Node URL = peer root — Listed on hub
PHP cURL Required for remotes Recommended

Security notes

  • Change $adminPassword and $apiKey from the defaults before going public
  • Set a non-zero $rateLimit in production
  • Keep /LookingGlass (config, SQLite, nodes.json, scripts) blocked from the web
  • Run behind HTTPS; monitor for abuse

Apache

.htaccess disables indexes, blocks private LookingGlass files, and turns off gzip for *.test downloads. Enable AllowOverride.

Nginx

Use or adapt LookingGlass/lookingglass-http.nginx.conf.

License

MIT — see LICENCE.

About

A user-friendly PHP looking glass that lets visitors run network diagnostics (host, mtr, ping, traceroute, and IPv6 variants) on your server through a web UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages