Enterprise-grade domain validation and aggregation pipeline for TrustPositif/Komdigi blocklists. High-performance · Standards-compliant · Cross-platform · ShellCheck Certified
TrustPositif Validator is a production-ready Bash/Shell script that processes and exports domain blocklists from TrustPositif/Komdigi and configurable public sources. It validates every domain against the official IANA Root Zone Database and RFC standards (1034, 1035, 1123, 3490, 5890), producing a deterministic, DNS/RPZ-ready output file optimized for automated deployments at scale.
| Feature | Detail |
|---|---|
| Multi-Source Input | Aggregates from TRUSTPOSITIF_URLS array — easily extensible |
| IANA TLD Validation | Validates every domain against the live IANA Root Zone Database |
| RFC Compliance | RFC 1034, RFC 1035, RFC 1123, RFC 3490, RFC 5890 + IDN/Punycode |
| Advanced Sanitization | Automated removal of non-domain metadata and invalid URI structures |
| Parallel Processing | GNU Parallel with adaptive core/chunk auto-tuning |
| AWK Auto-Fallback | mawk → gawk → awk with functional validation |
| Atomic Output | Temporary staging file + rename pattern with explicit permissions |
| Cross-Platform | Debian/Ubuntu, RHEL/CentOS/Fedora, Alpine, Arch, macOS, FreeBSD |
| Auto Dependency Install | Detects apt/dnf/yum/zypper/apk and installs missing tools |
| ShellCheck Certified | Verified warning-free on ShellCheck v0.11+ test suites |
You can run or download TrustPositif Validator using any of the following methods:
# Option 1: Direct execution via curl
bash <(curl -fsSL https://raw.githubusercontent.com/alsyundawy/TrustPositif-Validator/main/trustpositif-validator.sh)
# Option 2: Direct execution via wget
bash <(wget -qO- https://raw.githubusercontent.com/alsyundawy/TrustPositif-Validator/main/trustpositif-validator.sh)
# Option 3: Download and run locally
curl -fsSL -o trustpositif-validator.sh https://raw.githubusercontent.com/alsyundawy/TrustPositif-Validator/main/trustpositif-validator.sh
chmod +x trustpositif-validator.sh
bash trustpositif-validator.sh
# Option 4: Clone repository
git clone https://github.com/alsyundawy/TrustPositif-Validator.git
cd TrustPositif-Validator
chmod +x trustpositif-validator.sh
bash trustpositif-validator.sh
bash trustpositif-validator.sh # Normal run
bash trustpositif-validator.sh --help # Full documentation
bash trustpositif-validator.sh --version # Show version
bash trustpositif-validator.sh --force-cleanup # Clean up leftover temp files
# Process only subdomains' parent domain (aggressive mode)
CUT_SUBDOMAINS=1 bash trustpositif-validator.sh
# Override parallelism and chunk size
NUM_CORES=8 CHUNK_SIZE=28000 bash trustpositif-validator.sh
# Override sort buffer (useful on memory-constrained systems)
SORT_BUFFER=256M bash trustpositif-validator.sh
# Override output directory
OUTPUT_DIR=/data/blocklists bash trustpositif-validator.sh
# Disable SSL bypass (enforce strict TLS verification)
CURL_INSECURE=0 bash trustpositif-validator.sh
# Force a specific AWK engine
AWK_CMD=/usr/bin/mawk bash trustpositif-validator.sh
/var/www/html/trustpositif/domain-trustpositif_valid.txtThe script automatically checks for and installs missing dependencies where supported. You can also pre-install required packages using your system package manager:
# Debian / Ubuntu / Linux Mint
sudo apt update && sudo apt install -y bash curl wget mawk gawk parallel coreutils procps findutils grep
# RHEL / CentOS Stream / Fedora / AlmaLinux / Rocky Linux
sudo dnf install -y bash curl wget gawk parallel coreutils procps-ng findutils grep
# Alpine Linux
sudo apk add --no-cache bash curl wget mawk gawk parallel coreutils procps findutils grep
# Arch Linux / Manjaro
sudo pacman -Sy --noconfirm bash curl wget gawk parallel coreutils procps-ng findutils grep
# openSUSE / SLES
sudo zypper --non-interactive install bash curl wget gawk parallel coreutils procps findutils grep
# macOS (Homebrew)
brew install bash gawk parallel coreutils wget curl
# FreeBSD
pkg install -y bash curl wget gawk p5-parallel coreutils findutils gnugrep gsed
The script dynamically auto-tunes parameters according to detected system resources:
| Parameter | Auto-tuning Logic | Manual Override |
|---|---|---|
NUM_CORES |
Based on nproc (clamped 4–32), throttled on low RAM systems |
NUM_CORES=8 |
CHUNK_SIZE |
20000 + (NUM_CORES × 1000), clamped 1000–50000 |
CHUNK_SIZE=30000 |
SORT_BUFFER |
Adaptive scaling: 128M / 256M / 512M / 1G / 2G based on memory | SORT_BUFFER=512M |
AWK_CMD |
Auto-detected: mawk → gawk → awk with runtime verification |
AWK_CMD=/usr/bin/gawk |
CURL_INSECURE |
Defaults to 1 (bypass SSL for legacy endpoints); set 0 for strict TLS |
CURL_INSECURE=0 |
Edit the TRUSTPOSITIF_URLS array at the top of the script:
TRUSTPOSITIF_URLS=(
"https://trustpositif.komdigi.go.id/assets/db/domains_isp"
"https://example.com/custom-blocklist.txt"
)
┌─────────────────────────────────────────────────┐
│ TrustPositif Validator │
├──────────────┬──────────────────────────────────┤
│ Phase 1 │ Download TLD IANA + all sources │
│ Phase 2 │ Split into adaptive chunks │
│ Phase 3 │ Parallel AWK validation (RFC) │
│ Phase 4 │ Sort + global deduplication │
│ Phase 5 │ Atomic write to output file │
│ Phase 6 │ Cleanup all temp files via trap │
└──────────────┴──────────────────────────────────┘
The script adheres to strict logging standards: [>] [PROSES] for active operations, [i] [INFO] for runtime parameters, [OK] [BERHASIL] for completed steps, [!] [PERINGATAN] for non-fatal issues, and [X] [ERROR] for fatal conditions.
Run the following automated verification suite:
# 1. Syntax check
bash -n trustpositif-validator.sh
# 2. ShellCheck static analysis
shellcheck trustpositif-validator.sh
# 3. Test CLI interface
bash trustpositif-validator.sh --version
bash trustpositif-validator.sh --help
bash trustpositif-validator.sh --force-cleanup
# 4. Dry run with custom output
OUTPUT_DIR=/tmp/test_trustpositif bash trustpositif-validator.sh
set -Eeuo pipefail and IFS=$'\n\t'.EXIT, INT, and TERM.mktemp -d with private permissions (0700) to prevent CWD pollution and symlink exploits.OUTPUT_DIR to guarantee atomic replacement across filesystems.0644 read permissions on final output for web and DNS services.Benchmark measurements conducted on reference environment (8 cores, 16 GB RAM, NVMe SSD, 1 Gbps network):
| Phase | Duration |
|---|---|
| Download | 10–15 seconds |
| Parallel AWK Processing | 30–60 seconds (1.5M domains) |
| Sort + Deduplication | 5–15 seconds |
| Cleanup | < 1 second |
| Total Runtime | ~1–1.5 minutes |
| Throughput | ~35,000–45,000 domains/second |
| Memory Usage | ~100 MB |
| Problem | Root Cause | Solution |
|---|---|---|
| Script hangs or aborts | Stale temp locks | Run bash trustpositif-validator.sh --force-cleanup |
| Missing binary | Uninstalled tool | Run sudo apt install -y curl mawk gawk parallel coreutils |
| Download failure | Network/DNS timeout | Check internet connection; the script automatically retries up to 5 times |
| Out of memory | Small RAM environment | Set CHUNK_SIZE=5000 or increase swap space |
| Permission denied | Restrictive folder access | Ensure the user has write access to OUTPUT_DIR |
Community contributions and feedback are welcome:
git checkout -b feature/improvement).shellcheck with zero warnings and adhere to strict error handling standards.git commit -m 'feat: optimize memory allocation').git push origin feature/improvement) and open a Pull Request.chmod 644): Menetapkan permission 0644 pada file output akhir agar terbaca oleh DNS server (BIND/Unbound/Pi-hole) dan Web server (Nginx/Apache).\r di awal record AWK chunk parser untuk mencegah kegagalan regex pada blocklist berformat Windows/DOS.@, *, |, . pada input mentah.force_cleanup: Mengoptimalkan pemindaian temporary directory agar tidak melakukan scanning ganda pada /tmp.||, *, leading dots, serta suffix AdGuard (^, $options).OUTPUT_DIR sebelum mv.Distributed under the MIT License. See LICENSE for details.
Copyright (c) 2024–2026 Harry Dertin Sutisna Alsyundawy
Created and maintained by Harry Dertin Sutisna Alsyundawy:
Support project development: