block_multiple_domains
Block multiple domains simultaneously on OPNSense firewalls using a straightforward input of domain lists. Enhances network security by restricting unwanted access with minimal configuration.
Instructions
Block multiple domains at once
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Optional description for the blocks | |
| domains | Yes | List of domains to block |
Implementation Reference
- The main handler function for blocking multiple domains. It loops through each domain, attempts to block it using the blockDomain method, and categorizes them into blocked and failed lists.
async blockMultipleDomains(domains: string[], description?: string): Promise<{ blocked: string[], failed: string[] }> { const blocked: string[] = []; const failed: string[] = []; for (const domain of domains) { try { await this.blockDomain(domain, description); blocked.push(domain); } catch (error) { console.error(`Failed to block ${domain}:`, error); failed.push(domain); } } return { blocked, failed }; }