Firewall External Block List

AstLinux provides an IPv4 / IPv6 Stateful Filtering Firewall, based on the excellent Arno's iptables Firewall (AIF) firewall script, developed by Arno van Amersfoort.

A feature of AIF (v2.0.1g or later) is the ability to parse *.netset text files for IP/Net entries and use the ipset command to generate a hashed list in kernel memory to allow a single iptables firewall rule to very quickly match incoming and/or outgoing traffic against this list. Equally important, this ipset list may be rebuilt and swapped into place without needing to totally rebuild the firewall rules.

This feature allows blocklists, often very large blocklists containing tens of thousands of IP/Net entries to be efficiently added and matched by an iptables rule forcing specific traffic to be dropped by the firewall.

Note: AstLinux 1.2.8 or later is required

Enable *.netset Blocklists

Select the Network Tab in the web interface.
Network Tab

Click on the Firewall Configuration:
Firewall

Finally, check this entry under the “Block All Traffic by Host/CIDR:” section:
Enable Blocklists

If you had previously enabled “Block Host/CIDR using the file /mnt/kd/blocked-hosts”, you will most likely want to migrate to a .netset file and no longer use /mnt/kd/blocked-hosts since the netset method loads much faster.

Updating *.netset Blocklists

AstLinux contains a command reload-blocklist-netset to regularly update .netset IP/Net entries.

From the CLI, issue the reload-blocklist-netset command without arguments to display usage and a list of supported external blocklist netsets.

Cron may be used to run this script once or twice every day, for example:

15 05,15 * * * reload-blocklist-netset /mnt/kd/blocklists firehol_level1 voipbl >/dev/null 2>&1

Important → Do not use the cron time schedule as above, make changes so the servers are not hit at the same time.

In this example, a /mnt/kd/blocklists/firehol_level1.netset and a /mnt/kd/blocklists/voipbl.netset file will be created.

Tip → You must manually create the /mnt/kd/blocklists directory if it does not exist.

If you are manually adding or deleting any .netset files you can apply the changes to the firewall with this command from the CLI:

arno-iptables-firewall force-reload

File format for *.netset Files

Each .netset file may contain only one IP/Net entry per line, each IP/Net entry must start at the beginning of the line and any valid entry must be immediately followed by a new-line or a POSIX :space: character. File contents not matching an IP/Net will be ignored.

File naming convention, use *v6.netset files for IPv6 entries, all other *.netset files default to IPv4. Filenames are limited to a maximum of 27 characters before the .netset suffix.

Note → The filename prefix is used as the ipset set name, the Linux Kernel limits the set name length.

Optional whitelist.netset, whitelistv6.netset files may contain IP/Net entries that will not be blocked by any other *.netset file. Automatically by default, all Private (RFC1918), Link-Local and Multicast IP/Nets will be whitelisted, even if whitelist netset files are not defined.

Note → Whitelist IP/Net entries are not necessarily “allowed” in the firewall, their scope only keeps other *.netset files from blocking specific traffic.

Web Interface Edit tab

Special *.netset files will be displayed in the Edit tab “System Configuration” file list if they exist.

Blocklist IPv4 Set: blocked-hosts.netset
Blocklist IPv6 Set: blocked-hostsv6.netset

Whitelist IPv4 Set: whitelist.netset
Whitelist IPv6 Set: whitelistv6.netset

External sources for Blocklists

The “firehol_level1” blacklist is composed from aggregating IP lists, providing maximum protection with minimum false positives.
Tip → The “firehol_level2” and/or “firehol_level3” blacklist may be used in addition to the base “firehol_level1” blacklist.
FireHOL IP Lists

The “voipbl” distributed VoIP blacklist is aimed to protect against VoIP Fraud and minimizing PBX network abuse. Sponsored by ScopServ International.
VoIP Blacklist

Spamhaus DROP and EDROP are included in the “firehol_level1” blocklist.
Spamhaus Don't Route Or Peer Lists

Aggregate your own custom blocklist using FireHOL's update-ipsets on a server external to AstLinux.
Using update-ipsets