Compare commits

..
30 Commits
Author SHA1 Message Date
thakares 5f6bc455d4 Add installation guides, packaging scripts and release documentation 2026-06-18 14:40:59 +05:30
thakares 21b226b5a2 Update COMMERCIAL-LICENSE.md 2025-11-10 16:49:50 +05:30
thakares a6644d8bc4 Update dns_server.service 2025-06-04 15:16:36 +05:30
thakares e42c2c4ac2 Merge pull request #12 from thakares/updates
Updates
2025-05-26 23:51:09 +05:30
thakares bdaaeafff9 Merge pull request #11 from thakares/main
null
2025-05-26 23:50:31 +05:30
thakares 3a810d5b05 Delete nx9-dns-server 2025-05-26 23:48:58 +05:30
thakares 36ae0a859d Add files via upload 2025-05-26 23:38:44 +05:30
thakares 9ceadeeb87 Merge pull request #9 from thakares/main
Merge pull request #8 from thakares/updates
2025-05-26 22:44:09 +05:30
thakares 664c5288e0 Merge pull request #8 from thakares/updates
Merge pull request #7 from thakares/main
2025-05-26 22:43:06 +05:30
thakares f5f16997df Merge pull request #7 from thakares/main
Pull
2025-05-26 22:42:28 +05:30
thakares 76bc239f36 Delete Commercial-License-Agreement.pdf 2025-05-26 18:16:00 +05:30
thakares d5d8c7fb72 Add files via upload 2025-05-26 18:14:14 +05:30
thakares 321360cee3 Create COMMERCIAL-LICENSE.md 2025-05-26 18:13:50 +05:30
thakares bc6b0aeb29 Merge pull request #6 from thakares/updates
Updates
2025-05-25 11:52:29 +05:30
thakares 400df6c16e Merge pull request #5 from thakares/main
Update .deb/.rpm scripts
2025-05-25 11:51:56 +05:30
thakares a78beb92fe Add files via upload 2025-05-25 11:49:22 +05:30
thakares f7e8cb0969 Add files via upload 2025-05-25 11:45:47 +05:30
thakares b2cf04452f Merge pull request #4 from thakares/main
Updates
2025-05-24 23:21:57 +05:30
thakares 18b2c37dc0 Delete Docker directory 2025-05-24 23:15:20 +05:30
thakares 50b05d8dd2 Delete Cargo.lock 2025-05-24 23:14:33 +05:30
thakares ce1d265f1f Delete Algorithm-Flowchart.md 2025-05-24 23:14:13 +05:30
thakares 8271dc27dc Add files via upload 2025-05-24 23:13:55 +05:30
thakares b91a0ebcca Delete README.txt 2025-05-24 23:13:01 +05:30
thakares cb65b8c89b Delete Algorithm-Flowchart.md 2025-05-24 23:12:15 +05:30
thakares 26ffeb3092 Update Algorithm & Flowchart.md 2025-05-24 23:11:49 +05:30
thakares 6ab92cc966 Merge pull request #3 from thakares/updates
Updates
2025-05-24 23:09:09 +05:30
thakares 5f45d47f19 Delete target directory 2025-05-24 23:01:50 +05:30
thakares 4b9650e589 Delete .idea directory 2025-05-24 23:01:27 +05:30
thakares 2ac5b54a8b Delete Documents directory 2025-05-24 23:01:16 +05:30
thakares 23a597a952 Refactor: major codebase update and improvements 2025-05-24 22:43:39 +05:30
16 changed files with 564 additions and 1423 deletions

No files matched your search

@@ -57,7 +57,7 @@ This document outlines the algorithm and flowchart for a DNS server implementati
---
## 📊 Flowchart
![Flowchart](flow-chart.png)
![Flowchart](Flow-Chart.png)
Below is the visual representation of the DNS query handling logic:
```
+75
View File
@@ -0,0 +1,75 @@
# Commercial License for nx9-dns-server
**Copyright © Sunil Purushottam Thakare**
All rights reserved.
**Contact:** [sunil@thakares.com](mailto:sunil@thakares.com)
**Organization:** Indivisual
---
The **nx9-dns-server** project is **dual-licensed** under the terms of the
**GNU General Public License v3.0 (GPL-3.0)** and this **Commercial License**.
This Commercial License grants organizations, developers, and integrators the right to use **nx9-dns-server** in proprietary, closed-source, or commercial software products **without being subject to the copyleft obligations of the GPL-3.0 license**.
---
## 📜 Grant of License
Subject to the terms and conditions of a signed agreement with Indivisual, the Licensee is granted a **non-exclusive**, **non-transferable**, and **non-sublicensable** license to:
- Use, modify, and distribute **nx9-dns-server** within proprietary or closed-source products.
- Integrate the software into commercial products **without the obligation to release derivative source code** under GPL.
- Optionally receive additional commercial benefits such as:
- Priority technical support
- Security patches and updates
- Custom feature development (as agreed in writing)
---
## ⚖️ Restrictions
Unless explicitly permitted in a separate signed agreement, this commercial license **does not grant**:
- Trademark rights to the name **nx9-dns-server**, **Indivisual**, or associated logos.
- Rights to sublicense or redistribute this commercial license to third parties.
- Rights to use or distribute third-party GPL components (if any) beyond their respective license terms.
---
## 🧾 Indemnity & Warranty
Unless otherwise covered by a separate written agreement:
- The software is provided **"as is"**, without warranties of any kind.
- Indivisual makes **no representations or warranties** of merchantability, fitness for a particular purpose, or non-infringement.
- A paid commercial agreement may optionally include:
- Limited warranty of performance
- SLA-backed support and maintenance
- Indemnification against IP or security claims
---
## 💼 Obtaining a Commercial License
To obtain a commercial license or inquire about enterprise use, please contact:
**Sunil Purushottam Thakare**
📧 [sunil@thakares.com](mailto:sunil@thakares.com)
🏢 Organization: **Indivisual**
A tailored commercial license agreement will be provided based on the intended use case, integration scope, and distribution model.
---
## 🔄 Dual Licensing Notice
By default, **nx9-dns-server** is distributed under the **GNU General Public License v3.0 (GPL-3.0)**.
Users who wish to use it under the GPL must comply fully with its terms, including source disclosure and reciprocal licensing.
This **Commercial License** is an **alternative**, not an addition, to the GPL — providing a separate path for organizations wishing to integrate **nx9-dns-server** into proprietary systems without the GPL’s copyleft requirements.
---
**© 2025 Sunil Purushottam Thakare — All Rights Reserved**
_“Freedom for open projects, flexibility for commercial ones.”_
Generated
-1340
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
-57
View File
@@ -1,57 +0,0 @@
# Build stage
FROM rust:1.72-slim-bookworm AS builder
# Install necessary build dependencies
RUN apt-get update && apt-get install -y \
musl-tools \
build-essential \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Add support for cross-compilation to Alpine
RUN rustup target add x86_64-unknown-linux-musl
# Create a new empty project
WORKDIR /app
COPY . .
# Build the project with musl target
RUN cargo build --target x86_64-unknown-linux-musl --release
# Runtime stage
FROM alpine:3.18
# Install runtime dependencies
RUN apk --no-cache add ca-certificates sqlite tzdata
# Create a non-root user for running the application
RUN addgroup -S dns && adduser -S dnsuser -G dns
# Create necessary directories
RUN mkdir -p /var/nx9-dns-server /var/log/nx9-dns-server /etc/nx9-dns-server
RUN chown -R dnsuser:dns /var/nx9-dns-server /var/log/nx9-dns-server /etc/nx9-dns-server
# Copy the compiled binary
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/dns_server /usr/local/bin/
RUN chmod +x /usr/local/bin/dns_server
# Copy configuration files
COPY --from=builder /app/conf/dns_records.sql /etc/nx9-dns-server/
COPY --from=builder /app/conf/dns.db.sample /etc/nx9-dns-server/
# Expose DNS ports
EXPOSE 53/udp 53/tcp
# Expose Web UI port
EXPOSE 8080/tcp
# Expose API port
EXPOSE 8081/tcp
# Set working directory
WORKDIR /var/nx9-dns-server
# Switch to non-root user
USER dnsuser
# Command to run the application
CMD ["/usr/local/bin/dns_server"]
-24
View File
@@ -1,24 +0,0 @@
version: '3.8'
services:
dns:
image: nx9-dns-server:latest
container_name: nx9-dns
ports:
- "53:53/udp"
- "53:53/tcp"
- "8080:8080"
- "8081:8081"
volumes:
- ./data/dns.db:/var/nx9-dns-server/dns.db
- ./keys:/etc/nx9-dns-server/keys
- ./logs:/var/log/nx9-dns-server
environment:
- DNS_BIND=0.0.0.0:53
- DNS_DB_PATH=/var/nx9-dns-server/dns.db
- DNSSEC_KEY_FILE=/etc/nx9-dns-server/keys/Kanydomain.tld.key
- DNS_FORWARDERS=8.8.8.8:53,1.1.1.1:53
- DNS_NS_RECORDS=ns1.anydomain.tld.,ns2.anydomain.tld.
- WEB_UI_BIND=0.0.0.0:8080
- API_BIND=0.0.0.0:8081
restart: unless-stopped
+138
View File
@@ -0,0 +1,138 @@
# NX9 DNS Server Installation Guide
## Installation Methods
The NX9 DNS Server provides three flexible installation methods:
### 1. Direct Installation Script
The `install.sh` script provides a customizable installation process:
```bash
# Default installation to /usr/local
./install.sh
# Custom installation prefix
./install.sh --prefix=/opt/nx9-dns
```
#### Features:
- Configurable installation prefix
- Automatic service setup
- Documentation and man page installation
- Proper permission handling
### 2. Debian Package Installation
For Debian-based systems (Ubuntu, Debian, etc.):
```bash
# Build the package
./build-deb.sh
# Install the generated package
sudo dpkg -i nx9-dns-server-*.deb
```
#### Package Features:
- Proper dependency management
- System user creation
- Systemd service integration
- Configuration file management
- Clean uninstallation support
### 3. RPM Package Installation
For RPM-based systems (RHEL, CentOS, Fedora):
```bash
# Build the package
./build-rpm.sh
# Install the generated package
sudo rpm -i nx9-dns-server-*.rpm
```
#### Package Features:
- Automatic dependency resolution
- System service management
- Standard RPM filesystem hierarchy
- Built-in upgrade support
## Directory Structure
The installation creates the following directory structure:
```
${PREFIX}/
├── bin/
│ └── nx9-dns-server
├── lib/
│ └── nx9-dns-server/
├── etc/
│ └── nx9-dns-server/
│ └── nx9-dns-server.conf
├── share/
│ ├── doc/
│ │ └── nx9-dns-server/
│ │ ├── README.md
│ │ └── LICENSE
│ └── man/
│ └── man1/
│ └── nx9-dns-server.1.gz
└── var/
└── lib/
└── nx9-dns-server/
└── dns.db
```
## System Integration
### Service Management
After installation, the server runs as a systemd service:
```bash
# Start the service
sudo systemctl start nx9-dns-server
# Enable auto-start at boot
sudo systemctl enable nx9-dns-server
# Check service status
sudo systemctl status nx9-dns-server
```
### Security Features
- Dedicated system user (`nx9-dns`)
- Proper file permissions
- Confined service execution
### Configuration
- Main configuration: `/etc/nx9-dns-server/nx9-dns-server.conf`
- Database location: `/var/lib/nx9-dns-server/dns.db`
- DNSSEC key file: `/etc/nx9-dns-server/dnssec.key`
## Uninstallation
### Using Installation Script
```bash
# If installed with install.sh, manually remove files from prefix
sudo rm -rf ${PREFIX}/{bin,lib,etc,share}/nx9-dns-server
```
### Package-based Removal
```bash
# Debian systems
sudo apt remove nx9-dns-server
# RPM systems
sudo rpm -e nx9-dns-server
```
## Notes
- All installation methods require root/sudo privileges
- The installation preserves existing configuration files
- Service user is created automatically
- Logs are integrated with systemd journal
This installation system follows standard Unix filesystem hierarchy and packaging conventions, making it suitable for both development and production environments.
+110
View File
@@ -0,0 +1,110 @@
#!/bin/bash
# Check for required tools
if ! command -v dpkg-deb &> /dev/null; then
echo "dpkg-deb is required but not installed. Please install dpkg-dev package."
exit 1
fi
# Package information
PACKAGE="nx9-dns-server"
VERSION=$(grep '^version =' Cargo.toml | cut -d '"' -f2)
ARCH=$(dpkg --print-architecture)
MAINTAINER="Sunil Purushottam Thakare"
DESCRIPTION="High-performance DNS server with DNSSEC support"
# Create package directory structure
PKGDIR="$PACKAGE-$VERSION"
mkdir -p "$PKGDIR/DEBIAN"
mkdir -p "$PKGDIR/usr/local/bin"
mkdir -p "$PKGDIR/etc/nx9-dns-server"
mkdir -p "$PKGDIR/usr/lib/systemd/system"
mkdir -p "$PKGDIR/var/lib/nx9-dns-server"
mkdir -p "$PKGDIR/usr/share/doc/$PACKAGE"
# Build the project
cargo build --release
# Create control file
cat > "$PKGDIR/DEBIAN/control" << EOF
Package: $PACKAGE
Version: $VERSION
Architecture: $ARCH
Maintainer: $MAINTAINER
Depends: libc6 (>= 2.17), adduser
Section: net
Priority: optional
Homepage: https://github.com/yourusername/nx9-dns-server
Description: $DESCRIPTION
NX9 DNS Server is a high-performance DNS server implementation
with full DNSSEC support. It provides both authoritative and
recursive DNS services with modern features like cache management
and metrics export.
EOF
# Create postinst script
cat > "$PKGDIR/DEBIAN/postinst" << EOF
#!/bin/sh
set -e
# Create nx9-dns user if it doesn't exist
if ! getent passwd nx9-dns > /dev/null; then
adduser --system --group --no-create-home --home /nonexistent nx9-dns
fi
# Set permissions
chown -R nx9-dns:nx9-dns /var/lib/nx9-dns-server
chmod 755 /var/lib/nx9-dns-server
# Enable and start service
if [ -x "/bin/systemctl" ]; then
systemctl daemon-reload
systemctl enable nx9-dns-server.service || true
systemctl start nx9-dns-server.service || true
fi
EOF
# Create prerm script
cat > "$PKGDIR/DEBIAN/prerm" << EOF
#!/bin/sh
set -e
if [ -x "/bin/systemctl" ]; then
systemctl stop nx9-dns-server.service || true
systemctl disable nx9-dns-server.service || true
fi
EOF
# Set permissions for maintainer scripts
chmod 755 "$PKGDIR/DEBIAN/postinst"
chmod 755 "$PKGDIR/DEBIAN/prerm"
# Copy files
cp target/release/nx9-dns-server "$PKGDIR/usr/local/bin/"
cp config/nx9-dns-server.conf "$PKGDIR/etc/nx9-dns-server/" 2>/dev/null || echo "No config file found, skipping..."
cp README.md LICENSE "$PKGDIR/usr/share/doc/$PACKAGE/" 2>/dev/null || echo "No documentation files found, skipping..."
# Create systemd service file
cat > "$PKGDIR/usr/lib/systemd/system/nx9-dns-server.service" << EOF
[Unit]
Description=NX9 DNS Server
After=network.target
[Service]
ExecStart=/usr/local/bin/nx9-dns-server
Environment=DNS_DB_PATH=/var/lib/nx9-dns-server/dns.db
Environment=DNSSEC_KEY_FILE=/etc/nx9-dns-server/dnssec.key
Restart=always
User=nx9-dns
[Install]
WantedBy=multi-user.target
EOF
# Build the package
dpkg-deb --build "$PKGDIR"
# Cleanup
rm -rf "$PKGDIR"
echo "Debian package created: ${PKGDIR}.deb"
+115
View File
@@ -0,0 +1,115 @@
#!/bin/bash
# Check for required tools
if ! command -v rpmbuild &> /dev/null; then
echo "rpmbuild is required but not installed. Please install rpm-build package."
exit 1
fi
# Package information
NAME="nx9-dns-server"
VERSION=$(grep '^version =' Cargo.toml | cut -d '"' -f2)
RELEASE="1"
# Create RPM build directory structure
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# Create the spec file
cat > ~/rpmbuild/SPECS/$NAME.spec << EOF
Name: $NAME
Version: $VERSION
Release: $RELEASE%{?dist}
Summary: High-performance DNS server with DNSSEC support
License: MIT
URL: https://github.com/yourusername/nx9-dns-server
BuildRequires: cargo, gcc
Requires: systemd
%description
NX9 DNS Server is a high-performance DNS server implementation
with full DNSSEC support. It provides both authoritative and
recursive DNS services with modern features like cache management
and metrics export.
%prep
%setup -q -c -T
cp -r %{_sourcedir}/* .
%build
cargo build --release
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/local/bin
mkdir -p %{buildroot}/etc/nx9-dns-server
mkdir -p %{buildroot}/usr/lib/systemd/system
mkdir -p %{buildroot}/var/lib/nx9-dns-server
mkdir -p %{buildroot}/usr/share/doc/%{name}
# Install binary
install -m 755 target/release/nx9-dns-server %{buildroot}/usr/local/bin/
# Install config
install -m 644 config/nx9-dns-server.conf %{buildroot}/etc/nx9-dns-server/ || :
# Install docs
install -m 644 README.md LICENSE %{buildroot}/usr/share/doc/%{name}/ || :
# Install systemd service
cat > %{buildroot}/usr/lib/systemd/system/nx9-dns-server.service << 'EOL'
[Unit]
Description=NX9 DNS Server
After=network.target
[Service]
ExecStart=/usr/local/bin/nx9-dns-server
Environment=DNS_DB_PATH=/var/lib/nx9-dns-server/dns.db
Environment=DNSSEC_KEY_FILE=/etc/nx9-dns-server/dnssec.key
Restart=always
User=nx9-dns
[Install]
WantedBy=multi-user.target
EOL
%pre
# Create nx9-dns user if it doesn't exist
if ! getent passwd nx9-dns > /dev/null; then
useradd -r -s /sbin/nologin nx9-dns
fi
%post
%systemd_post nx9-dns-server.service
chown -R nx9-dns:nx9-dns /var/lib/nx9-dns-server
chmod 755 /var/lib/nx9-dns-server
%preun
%systemd_preun nx9-dns-server.service
%postun
%systemd_postun_with_restart nx9-dns-server.service
%files
%attr(755,root,root) /usr/local/bin/nx9-dns-server
%dir %attr(755,nx9-dns,nx9-dns) /var/lib/nx9-dns-server
%dir %attr(755,root,root) /etc/nx9-dns-server
%config(noreplace) /etc/nx9-dns-server/nx9-dns-server.conf
/usr/lib/systemd/system/nx9-dns-server.service
%doc /usr/share/doc/%{name}/*
%changelog
* $(date '+%a %b %d %Y') $USER <$USER@$(hostname)> - $VERSION-$RELEASE
- Initial RPM release
EOF
# Create source tarball
mkdir -p ~/rpmbuild/SOURCES/$NAME-$VERSION
cp -r * ~/rpmbuild/SOURCES/$NAME-$VERSION/
cd ~/rpmbuild/SOURCES
tar czf $NAME-$VERSION.tar.gz $NAME-$VERSION
rm -rf $NAME-$VERSION
# Build the RPM
rpmbuild -ba ~/rpmbuild/SPECS/$NAME.spec
echo "RPM package created in ~/rpmbuild/RPMS/"
Regular → Executable
View File
File mode changed.
Regular → Executable
View File
File mode changed.
+4 -1
View File
@@ -6,8 +6,11 @@ After=network.target
User=dnsuser
Group=dnsuser
WorkingDirectory=/var/nx9-dns-server
ExecStart=/var/dns-server/nx9-dns_server # Run directly, skip wrapper
ExecStart=/var/dns-server/nx9-dns_server
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
Restart=always
Environment=DNS_BIND=0.0.0.0:53
Environment=DNS_ENABLE_IPV6=1
Environment=DNS_MAX_PACKET_SIZE=4096
Regular → Executable
View File
File mode changed.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

+82
View File
@@ -0,0 +1,82 @@
#!/bin/bash
# Default installation prefix
PREFIX=${PREFIX:-/usr/local}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--prefix=*)
PREFIX="${1#*=}"
shift
;;
--help)
echo "Usage: $0 [--prefix=/installation/path]"
echo "Default prefix is /usr/local"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Build the project
echo "Building nx9-dns-server..."
cargo build --release
# Create necessary directories
echo "Creating directories in $PREFIX..."
sudo mkdir -p "$PREFIX/bin"
sudo mkdir -p "$PREFIX/lib/nx9-dns-server"
sudo mkdir -p "$PREFIX/etc/nx9-dns-server"
sudo mkdir -p "$PREFIX/share/doc/nx9-dns-server"
sudo mkdir -p "$PREFIX/share/man/man1"
# Install binary
echo "Installing binary..."
sudo install -m 755 target/release/nx9-dns-server "$PREFIX/bin/"
# Install configuration
echo "Installing configuration files..."
sudo install -m 644 config/nx9-dns-server.conf "$PREFIX/etc/nx9-dns-server/" 2>/dev/null || echo "No config file found, skipping..."
# Install documentation
echo "Installing documentation..."
sudo install -m 644 README.md "$PREFIX/share/doc/nx9-dns-server/" 2>/dev/null || echo "No README found, skipping..."
sudo install -m 644 LICENSE "$PREFIX/share/doc/nx9-dns-server/" 2>/dev/null || echo "No LICENSE found, skipping..."
# Install man page if it exists
if [ -f doc/nx9-dns-server.1 ]; then
echo "Installing man page..."
sudo install -m 644 doc/nx9-dns-server.1 "$PREFIX/share/man/man1/"
sudo gzip -f "$PREFIX/share/man/man1/nx9-dns-server.1"
fi
# Create systemd service file
echo "Creating systemd service file..."
cat > nx9-dns-server.service << EOF
[Unit]
Description=NX9 DNS Server
After=network.target
[Service]
ExecStart=$PREFIX/bin/nx9-dns-server
Environment=DNS_DB_PATH=/var/lib/nx9-dns-server/dns.db
Environment=DNSSEC_KEY_FILE=/etc/nx9-dns-server/dnssec.key
Restart=always
User=nx9-dns
[Install]
WantedBy=multi-user.target
EOF
sudo install -m 644 nx9-dns-server.service /lib/systemd/system/
rm nx9-dns-server.service
echo "Installation completed successfully!"
echo "To start the service:"
echo "1. Create nx9-dns user: sudo useradd -r -s /bin/false nx9-dns"
echo "2. Enable the service: sudo systemctl enable nx9-dns-server"
echo "3. Start the service: sudo systemctl start nx9-dns-server"
+39
View File
@@ -0,0 +1,39 @@
<img src="https://r2cdn.perplexity.ai/pplx-full-logo-primary-dark%402x.png" class="logo" width="120"/>
# Okay write a short draft
Absolutely! Here’s a **short draft** for your GitHub release announcement, tailored for your **nx9-dns-server** project:
---
## nx9-dns-server v1.0.0 Release
**We’re excited to announce the first stable release of nx9-dns-server!**
**Highlights:**
- **Authoritative DNS server** for any domain
- **Supports major DNS record types** (A, AAAA, MX, NS, SOA, PTR, TXT, CNAME)
- **DNSSEC support** for secure DNS responses
- **High-performance networking** with Tokio
- **SQLite-based DNS record management**
- **Easy Docker deployment**
- **Comprehensive logging and diagnostics**
**How to get started:**
See the [README](https://github.com/thakares/nx9-dns-server) for installation and usage instructions.
**Download:**
- **Linux binary:** [Download here](https://github.com/thakares/nx9-dns-server/releases/download/v1.0.0/dns_server)
- **Docker image:** [Available on GitHub Container Registry](https://github.com/thakares/nx9-dns-server/pkgs/container/nx9-dns-server)
---
**Thank you for your support!**
We welcome your feedback and contributions! 🚀
---
Let me know if you want this in a different format or need to add more details!