adblock2privoxy (www/adblock2privoxy) Updated: 9 months ago Add to my watchlist

Convert adblock config files to privoxy format

Convert adblock config files to privoxy format. AdBlock Plus browser plugin has great block list files provided by big community, but it is client software and cannot work on a server as proxy. Privoxy proxy has good potential to block ads at server side, but it experiences acute shortage of updated block lists. This software converts adblock lists to privoxy config files format. Almost all adblock features are supported including block/unblock requests (on privoxy) all syntax features are supported except for regex templates matching host name hide/unhide page elements (via CSS) all syntax features are supported all block request options except for outdated ones: Supported: script, image, stylesheet, object, xmlhttprequest, object-subrequest, subdocument, document, elemhide, other, popup, third-party, domain=..., match-case, donottrack.

Version: 2.3.0 License: GPL-3 GitHub
Maintainers essandess
Categories www haskell
Homepage https://github.com/essandess/adblock2privoxy
Platforms darwin
Variants
  • initialize_always (Always initialize all configuration files. Intended for development and troubleshooting only. Working deployments must disable this variant to prevent configuration files being overwritten at the next upgrade. Existing configuration files are not overwritten by default.)
  • stack (Use stack to build.)

"adblock2privoxy" depends on

run (4)
build (9)
lib (4)
patch (1)

Ports that depend on "adblock2privoxy"



Port notes

After initial installation, it is necessary to kickstart this launch daemon, which does not run at load:

sudo launchctl kickstart -k system/org.macports.adblock2privoxy

The blocklist URLs are specified in the file ${prefix}/etc/adblock2privoxy/adblock2privoxy_blocklist.txt.

Example production run:

adblock2privoxy -p ${prefix}/etc/adblock2privoxy/privoxy \
-w ${prefix}/etc/adblock2privoxy/css -d 127.0.0.1:8119 \
$(< ${prefix}/etc/adblock2privoxy/adblock2privoxy_blocklist.txt)

Update run:

adblock2privoxy -t ${prefix}/etc/adblock2privoxy/privoxy/ab2p.task

The CSS web server domain name or IP address is specified by the environment variable ADBLOCK2PRIVOXY_CSS_SERVER (with default value):

ADBLOCK2PRIVOXY_CSS_SERVER=127.0.0.1:8119

To change this or site-specific environment variables, set them in the optional file

${prefix}/etc/adblock2privoxy/ADBLOCK2PRIVOXY.env

Please note that the macOS command `launchctl setenv` is now prohibited by SIP. Configure adblock2privoxy PKI by creating a certificate from e.g. Privoxy's certificate authority (CA). As sudo:

# Example, more likely use ${prefix}/etc/privoxy/CA
cp -R ${prefix}/etc/privoxy/ca.macports ca.adblock2privoxy \
&& cd ca.adblock2privoxy
cp ${prefix}/etc/adblock2privoxy/certs/openssl.cnf .
# edit openssl.cnf for your local organizationName, commonName, etc.

# initialize
touch index.txt
echo 1000 > serial

# Server certificates

# Server certificate encrypted key and decrypted key
openssl genpkey -out adblock2privoxy-nginx.key.pem \
-algorithm EC -pkeyopt ec_paramgen_curve:P-384 -aes256 \
-pass file:passphrase.txt
openssl ec -in adblock2privoxy-nginx.key.pem \
-passin file:passphrase.txt \
-out adblock2privoxy-nginx.key.pem.decrypted
chmod go-rwx adblock2privoxy-nginx.key.pem.decrypted

# Server certificate CSR
openssl req -config openssl.cnf -new -sha384 \
-key adblock2privoxy-nginx.key.pem \
-passin file:passphrase.txt \
-out adblock2privoxy-nginx.csr.pem -batch

# Server certificate (825 days maximum validity)
# https://support.apple.com/en-us/HT210176
openssl ca -config openssl.cnf -days 825 -notext -md sha384 \
-extensions server_cert -in adblock2privoxy-nginx.csr.pem \
-out adblock2privoxy-nginx.cert.pem \
-passin file:passphrase.txt \
-subj '/CN=adblock2privoxy-nginx' -batch

# Server certificate chain of trust
cat adblock2privoxy-nginx.cert.pem ca.cert.pem \
> adblock2privoxy-nginx.chain.pem

# Server certificate and chain validity
openssl verify -CAfile ca.cert.pem adblock2privoxy-nginx.cert.pem
openssl verify -CAfile ca.cert.pem adblock2privoxy-nginx.chain.pem

# Install the adblock2privoxy PKI
cp -p ca.key.pem ca.cert.pem passphrase.txt \
adblock2privoxy-nginx.cert.pem adblock2privoxy-nginx.chain.pem \
adblock2privoxy-nginx.key.pem \
adblock2privoxy-nginx.key.pem.decrypted \
${prefix}/etc/adblock2privoxy/certs Startup items (named 'adblock2privoxy-nginx, adblock2privoxy') have been generated that will aid in starting adblock2privoxy with launchd. They are disabled by default. Execute the following command to start them, and to cause them to launch at startup:

sudo port load adblock2privoxy


Port Health:

Loading Port Health

Installations (30 days)

9

Requested Installations (30 days)

6