How to use Zenfirewall with apf

The best option is to add it to the general APF configuration under the Global Trust section.

##
# Global Trust
##
# This is an implementation of the trust rules (allow/deny_hosts) but
# on a global perspective. You can define below remote addresses from
# which the glob_allow/deny.rules files should be downloaded from on
# a daily basis. The files can be maintained in a static fashion by
# leaving USE_RGT=0, ideal for a host serving the files.
USE_RGT="1"
GA_URL="https://zenfirewall.com/zenblock_allow.txt"
GD_URL="https://zenfirewall.com/zenblock.txt"

Alternatively, you can execute this script.:

curl -sf https://zenfirewall.com/zenblock.txt | grep -E '^[0-9.]+' | while read -r ip; do grep -q "$ip" /etc/apf/glob_deny.rules || apf -d "$ip" "Block by ZenFirewall blocklist"; done

To automate this, you can schedule it in a cron job to run once or twice daily.