Site Tools


advanced-adblock

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
advanced-adblock [2023/08/06 15:25] – [Domain blacklist custom] -change "%" to "+" for accuracy hogwildadvanced-adblock [2023/08/13 17:03] (current) – [Domain whitelist] -formatting hogwild
Line 3: Line 3:
 This menu contains settings to configure FreshTomato's ad blocker. It is strongly advised that you read the **How Adblock Works** section to understand its functioning, even if you use v2. This menu contains settings to configure FreshTomato's ad blocker. It is strongly advised that you read the **How Adblock Works** section to understand its functioning, even if you use v2.
  
-In this documentation, the function/menu will be spelled capitalized ("Adblock"). The script that executes will be spelled in lower case ("adblock"). \\+In documentation, the function/menu will be spelled capitalized ("Adblock"). The actual script will be spelled "adblock", in lower case. \\ 
  
 ===== v1 and v2 ===== ===== v1 and v2 =====
Line 41: Line 42:
 **Debug mode (v1)** **Debug mode (v1)**
  
-Checking this box enables debug mode for dnsmasq in the log. This tells FreshTomato that you want all DNS queries routed to dnsmasq to be logged to the system log (syslog). This is useful when testing/troubleshooting Adblock. For more on testing, see the //Notes and Troubleshooting// section of this page. This option is identical to "Debug Mode" in the [[advanced-dhcpdns|DHCP/DNS/TFTP]] menu. Thus, in v2, it was removed from the Adblock menu.+Checking this box enables debug mode for dnsmasq in the log. This tells FreshTomato that you want all DNS queries routed to dnsmasq to be logged to the system log. This is useful when testing/troubleshooting Adblock. For more on testing, see the //Notes and Troubleshooting// section of this page. This option is identical to "Debug Mode" in the [[advanced-dhcpdns|DHCP/DNS/TFTP]] menu. Thus, in v2, it was removed from the Adblock menu.
  
  \\  \\
Line 51: Line 52:
 **Max Log Level (v2)**: **Max Log Level (v2)**:
  
-Thew new v2 interface lets you set the maximum log level output the script will generate.   \\  \\+Thew newer v2 interface lets you set the maximum log level output the script will generate.   \\  \\
  
 Supported levels include: Supported levels include:
Line 70: Line 71:
  \\  \\
  
-A good way to view the logs is to go to the [[status-log|Logs]] menu and enter 'adblockin the "Find in syslog" field. This filters the log view to show only entries adblock entries. At level 7, adblock produces additional debugging files. These files are saved in /tmp/adblock.debug.$now, (where "$now" is the absolute number of seconds elapsed). References to adblock in the the trace file will then be displayed in the Web interface.\\  \\+A good way to view Adblock log entries is to go to the [[status-log|Logs]] menu and type "adblockin the "Find in syslog" field. This filters the view to show only adblock entries. When set to level 7, adblock produces additional debugging files. These files are saved in /tmp/adblock.debug.$now, (where "$now" is the absolute number of seconds elapsed). References to adblock in the the trace file will then be displayed in the Web interface.\\  \\
  
  {{::20230125-163305.png?776x296|Viewing adblock log entries}}\\  \\  {{::20230125-163305.png?776x296|Viewing adblock log entries}}\\  \\
Line 84: Line 85:
  \\  \\
  
-This limit is calculated as 10% of physical RAM (when external storage is set). When no external storage is found, the limit is calculated as 6.5% of RAM. The limit can be also manually configured. However, if your device becomes unstable, it is advised that you revert to the automatically-calculated value.+This limit is calculated as 10% of physical RAM (when external storage is set). When no external storage is found, the limit is calculated as 6.5% of RAM. The limit can be also manually configured. However, if your device becomes unstable, you should revert to the auto-calculated value.
  
-To be clear, this is a limit, not a target. There's nothing wrong with having a small blockfile compared to the limit. A larger blockfile will result in longer restart times for the dnsmasq service. This is important because there will be no DHCP/DNS/TFTP functionality until dnsmasq finishes restarting.+This is a limit, not a target. There's nothing wrong with having a small blockfile compared to the limit. A larger blockfile will result in longer restart times for the dnsmasq service. This is important because there will be no DHCP/DNS/TFTP functionality until dnsmasq finishes restarting.
  
  \\  \\
Line 92: Line 93:
 **Custom Path (v2):** **Custom Path (v2):**
  
-An important v2 feature is the ability to configure an (optional) path to permanent storage where adblock can store relevant files. You are strongly advised to specify a custom path. A custom path enables extra functionality in the script. It allows adblock to store whole lists, their http headers and the actual compiled blockfile on external storage. This offloads RAM demand (/tmp) to permanent storage, and allows for information to survive a reboot.+An important v2 feature is the option to configure path to permanent storage where adblock can store relevant files. It is strongly advised to specify a custom path. A custom path enables extra functionality in the script. It allows adblock to store whole lists, their http headers and the actual compiled blockfile on external storage. This offloads RAM demand (/tmp) to permanent storage, and allows for information to survive a reboot.
  
  \\ {{adblock-v2-custom_path.jpg?573x31}}  \\ {{adblock-v2-custom_path.jpg?573x31}}
Line 98: Line 99:
  \\  \\
  
-This is very useful when the script is re-run (manually or automatically) and there are no updated lists or configuration changes. The check for configuration changes involves controlling any modification to nvram variables since the last script run.+This is very useful when the script is re-run (manually or automatically) and there are no updated lists or configuration changes. The check for configuration changes involves controlling any modification to NVRAM variables since the last script run.
  
 When a custom path is defined, adblock will: When a custom path is defined, adblock will:
Line 114: Line 115:
 This saves time and resources. This saves time and resources.
  
-Here, configuration means any externally-mapped files where //blacklist_custom// or whitelists are defined (For example: /mnt/USB/my_whitelist.txt). Using a Custom path also allows adblock to load faster on post-(re)boot.+Here, "configurationmeans any externally-mapped files where //blacklist_custom// or whitelists are defined (For example: /mnt/USB/my_whitelist.txt). Using a Custom path also allows adblock to load faster on post-(re)boot.
  
  \\  \\
Line 217: Line 218:
 For example, if you enter "+sub.domain.com", only "sub.domain.com" will be blacklisted. "Sub1.sub.domain.com", "sub2.sub.domain.com" and other subdomains will not be filtered. For example, if you enter "+sub.domain.com", only "sub.domain.com" will be blacklisted. "Sub1.sub.domain.com", "sub2.sub.domain.com" and other subdomains will not be filtered.
  
-Prepending a "+" sign to a domain entry will blacklist that domain and all subdomains and force a pruning of any subdomains found in the final blockfile. Pruning removes duplicate/redundant entries from the blocklist file. +Prepending a "+" sign to a domain will also force a pruning of any subdomains found in the final blockfile. Pruning removes duplicate/redundant blocklist entries. Duplicate entries make for a larger blockfile size, which can increase processor cycles, RAM usage and storage space. Thus, pruning significant number of duplicated entries can reduce CPU, memory and storage needs.
- +
-Duplicate or redundant entries make for a larger blockfile size, which can increase processor cycles, RAM usage and storage space. Thus, pruning significant amounts of redundant entries can reduce CPU, memory and storage needs.+
  
 Any line starting with a "#" or "!" character is considered a comment and will be ignored. Any line starting with a "#" or "!" character is considered a comment and will be ignored.
 +
 + \\
  
 **Sort a-z ↓** **:**  Clicking this button sorts the contents of this field alphabetically.  \\ **Sort a-z ↓** **:**  Clicking this button sorts the contents of this field alphabetically.  \\
Line 234: Line 235:
  \\  \\
  
-Domain whitelist can use:+=== Syntaxes === 
 + 
 +The Domain whitelist can use:
  
   * Standard domains (one entry per line).   * Standard domains (one entry per line).
   * A path to a file of domains (one domain per line) . \\ For example: "/mnt/usb/my_whitelist.txt".   * A path to a file of domains (one domain per line) . \\ For example: "/mnt/usb/my_whitelist.txt".
-  * Prepending a "%" sign to an entry indicates a "strict" whitelisting. \\ Whitelisting always takes precedence over blacklisting. \\ For example, if a blacklist contained "ads.example.com"then whitelisting "example.com" will undo the blacklisting of  "ads.example.com"  and all its subdomains. +  * Prepending a "%" sign to an entry indicates a "strict" whitelisting. \\ Whitelisting always takes precedence over blacklisting. \\ For example, if a blacklist contained "ads.example.com", whitelisting "example.com"  \\ will undo the blacklisting of  "ads.example.com"  and all other subdomains.
-  * Blacklisting all subdomains may not be your goal. Whitelisting "%example.com"  will whitelist only "example.com", and will not negate blacklisting of "ads.example.com" or any of its subdomains.+
  
-When adding custom entries:+ \\
  
-If you whitelist"sub.domain.com", then+When adding entries:
  
-"sub1.sub.domain.com"+If you whitelist: "sub.domain.com", then:
  
-"sub2.sub.domain.com"+ "sub1.sub.domain.com" 
 + 
 + "sub2.sub.domain.com"
  
 and all other subdomains will be whitelisted. and all other subdomains will be whitelisted.
  
-However, this may not be what you want.+ \\
  
-To prevent subdomains of an entry from being whitelisted, prepend a "%" sign to an entry.+You can prevent subdomains of an entry from being whitelisted by prepending a "%" sign to an entry.
  
-For example, if you enter "%sub.domain.com", only "sub.domain.com" will be whitelisted. "Sub1.sub.domain.com", "sub2.sub.domain.com" and other subdomains will still be filtered.+For example, if you enter "%sub.domain.com":
  
-Prepending a "+" sign to a domain entry will whitelist that domain and all subdomains and force a pruning of any subdomains found in the final blockfilePruning removes duplicate/redundant entries from the blocklist fileDuplicate or redundant entries can increase processor and RAM usageThuspruning significant amounts of redundant entries can reduce CPU and memory usage.+"sub.domain.com" will be whitelisted, but; 
 + 
 +"Sub1.sub.domain.com", and "sub2.sub.domain.com" will still be blocked.
  
 Any line starting with a "#" or "!" character is considered a comment and will be ignored. Any line starting with a "#" or "!" character is considered a comment and will be ignored.
  
-**Sort a-z ↓** :  Clicking this button sorts the field content alphabetically.+ \\ **Sort a-z ↓** :  Clicking this button sorts the field contents alphabetically.
  
- \\   \\+ \\
  
 === Maintaining the Domain whitelist === === Maintaining the Domain whitelist ===
advanced-adblock.1691331921.txt.gz · Last modified: 2023/08/06 15:25 by hogwild