A modern, secure web interface for DNS lookups using the dig command. Perfect for self-hosting your own DNS lookup tool with a clean, responsive interface.
Features β’ Installation β’ Usage β’ Configuration β’ Security
- Multiple Record Types: Query 50+ DNS record types including A, AAAA, MX, CNAME, NS, PTR, SOA, TXT, CAA, HTTPS, SVCB, and more
- Batch Queries: Look up multiple hostnames in a single request
- Reverse DNS: Automatic PTR record lookups for IP addresses
- DNSSEC Support: Validate DNSSEC signatures with the
+dnssecoption
- 15+ Public Resolvers: Pre-configured popular DNS resolvers including:
- Google (8.8.8.8, 8.8.4.4)
- Cloudflare (1.1.1.1, 1.0.0.1)
- Quad9 (9.9.9.9, 149.112.112.112)
- OpenDNS, AdGuard, Yandex, and more
- Custom Nameservers: Add your own DNS servers
- Authoritative Queries: Query authoritative nameservers directly
- NIC/Registry Queries: Query TLD nameservers for domain information
- Parallel Queries: Query all resolvers simultaneously for comparison
- Modern Design: Clean, responsive interface that works on all devices
- Real-time AJAX: Asynchronous queries with live progress updates
- Syntax Highlighting: Colorized output for different DNS record types
- Clickable Results: Click on IPs or domains to add them to your query
- Dark Mode Ready: Easy on the eyes with proper color contrast
- URL/Email Parsing: Automatically extract domains from URLs and email addresses
- Query Options: Support for dig flags like
+short,+trace,+tcp,+noquestion - Share URLs: Generate shareable links for specific queries
- Command Display: See the exact dig command being executed
- Export Results: Copy commands or results with one click
- Keyboard Shortcuts:
Ctrl+Enter: Submit queryCtrl+L: Clear form
- PHP 8.3+ Compatible: Uses modern PHP features with type declarations
- Security First: Input sanitization, command escaping, no shell injection
- No Database Required: Simple file-based configuration
- Zero Dependencies: No composer packages or external libraries needed
- Progressive Enhancement: Works without JavaScript, enhanced with it
- Docker 20.10 or higher
- Docker Compose v2 or higher
- PHP 8.3 or higher with the following extensions:
json(for AJAX API)filter(for input validation)
- dig command (part of
bind-utilsordnsutilspackage) - Web server: Apache, Nginx, or any PHP-compatible server
- Modern browser: Chrome, Firefox, Safari, or Edge
-
Run the pre-built image:
docker run -d -p 8080:80 ghcr.io/lars/opensource-digwebinterface:latest
-
Or build and run locally:
# Clone the repository git clone https://github.com/Lars-/opensource-digwebinterface.git cd opensource-digwebinterface # Build the image docker build -t opensource-digwebinterface . # Run the container docker run -d -p 8080:80 opensource-digwebinterface
-
Access the interface:
http://localhost:8080
That's it! The single container includes both nginx and PHP, making deployment extremely simple.
-
Clone the repository:
git clone https://github.com/Lars-/opensource-digwebinterface.git cd opensource-digwebinterface -
Start the containers:
docker compose up -d
-
Access the interface:
http://localhost:8080 -
View logs (optional):
docker compose logs -f
-
Stop the containers:
docker compose down
- Single Container Option: Combined nginx + PHP image available on GitHub Container Registry
- Multi-Architecture: Supports both amd64 and arm64 platforms
- PHP 8.3 with FPM for optimal performance
- Nginx web server with optimized configuration
- Alpine Linux base for minimal image size (~100MB)
- dig command pre-installed and configured
- Volume mounts for easy development (compose only)
- Automatic permissions handling for cache directory
-
Clone the repository:
git clone https://github.com/Lars-/opensource-digwebinterface.git cd opensource-digwebinterface -
Start DDEV:
ddev start
-
Access the interface:
https://opensource-digwebinterface.ddev.site
-
Clone the repository:
git clone https://github.com/Lars-/opensource-digwebinterface.git cd opensource-digwebinterface -
Install dig command:
# Ubuntu/Debian sudo apt-get install dnsutils # CentOS/RHEL/Fedora sudo yum install bind-utils # macOS (using Homebrew) brew install bind
-
Configure your web server:
Apache (
.htaccessexample):<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^api/(.*)$ api/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [QSA,L] </IfModule>
Nginx configuration:
server { listen 80; server_name your-domain.com; root /path/to/opensource-digwebinterface; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location /api { try_files $uri $uri/ /api/query.php?$query_string; } location ~ \.php$ { fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
-
Set permissions:
chmod 755 cache/
- Enter a hostname (e.g.,
example.com) in the text area - Select a DNS record type (default: A)
- Choose a resolver or use the default
- Click "Dig!" or press
Ctrl+Enter
Multiple Hostnames:
google.com
cloudflare.com
github.com
Query All Resolvers:
- Select "All resolvers" to compare results across all configured DNS servers
Authoritative Lookup:
- Select "Authoritative" to query the domain's authoritative nameservers directly
Custom Nameservers:
8.8.8.8
1.1.1.1
9.9.9.9
URL/Email Conversion:
- Enable "Fix" to automatically extract domains:
https://example.com/pageβexample.comuser@example.comβexample.com
Edit config/config.php to customize:
return [
// Site branding
'site_name' => 'Your DNS Tool',
'site_description' => 'Custom description',
// dig command location (auto-detected in most cases)
'dig_path' => '/usr/bin/dig',
// Query timeout (seconds)
'default_timeout' => 5,
// Add custom resolvers
'resolvers' => [
'custom' => [
'name' => 'My DNS Server',
'servers' => ['192.168.1.1', '192.168.1.2']
],
// ... existing resolvers
],
// Limit simultaneous queries
'max_hostnames' => 10,
'max_nameservers' => 5,
];- Input Sanitization: All user inputs are validated and sanitized
- Command Injection Prevention: Uses
escapeshellarg()andescapeshellcmd() - No Direct Shell Access: Commands are built programmatically
- XSS Protection: All output is HTML-escaped
- CSRF Protection: Can be added via middleware
-
Restrict Access (if needed):
# .htaccess for IP restriction <RequireAll> Require ip 192.168.1.0/24 Require ip 10.0.0.0/8 </RequireAll>
-
Add Rate Limiting:
// In api/query.php session_start(); $requests = $_SESSION['requests'] ?? []; $requests = array_filter($requests, fn($t) => $t > time() - 60); if (count($requests) > 30) { http_response_code(429); die(json_encode(['error' => 'Too many requests'])); } $_SESSION['requests'] = [...$requests, time()];
-
Enable HTTPS:
# Force HTTPS redirect RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
-
Add Authentication (optional):
// Basic auth example $valid_users = ['user' => password_hash('password', PASSWORD_DEFAULT)]; // Add to index.php and api/query.php
The interface uses CSS custom properties for easy theming:
:root {
--primary: #0066cc;
--primary-hover: #0052a3;
--success: #00a651;
--danger: #d32f2f;
/* Modify these in main.css */
}Add new DNS record types in config/config.php:
'record_types' => [
'NEWTYPE' => 'NEWTYPE Description',
// ... existing types
],-
Port 8080 already in use:
# Change the port in docker-compose.yml ports: - "8081:80" # Use port 8081 instead
-
Permission denied errors:
# Rebuild with proper permissions docker compose down docker compose build --no-cache docker compose up -d -
dig command not working:
# Test dig inside container docker compose exec php dig google.com # Check dig path docker compose exec php which dig
-
Changes not reflecting:
# Restart services docker compose restart # Or rebuild if needed docker compose down docker compose up -d --build
# Start services
docker compose up -d
# Stop services
docker compose down
# View logs
docker compose logs -f
docker compose logs -f php # PHP logs only
docker compose logs -f nginx # Nginx logs only
# Execute commands in container
docker compose exec php sh # Shell access
docker compose exec php dig example.com # Run dig command
docker compose exec php php -v # Check PHP version
# Rebuild images
docker compose build
docker compose build --no-cache # Force rebuild
# Remove everything (including volumes)
docker compose down -vContributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PSR-12 coding standards
- Add PHPDoc comments for new methods
- Test with PHP 8.3+
- Ensure no security vulnerabilities
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with PHP and vanilla JavaScript
- Uses the powerful
digcommand from ISC BIND - Inspired by online DNS lookup tools
- Icon and emoji designs from OpenMoji
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Please report security issues privately
If you find this tool useful, consider buying me a coffee!
