Skip to content

Commit 47d505c

Browse files
committed
fix: custom config
1 parent 6c9d279 commit 47d505c

3 files changed

Lines changed: 43 additions & 27 deletions

File tree

Dockerfile

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -130,35 +130,10 @@ RUN set -ex; \
130130
mkdir -p /var/log/privoxy /usr/local/etc/privoxy/CA /usr/local/etc/privoxy/certs /usr/local/etc/privoxy/privman-rules; \
131131
chown -R privoxy:privoxy /var/log/privoxy /usr/local/etc/privoxy; \
132132
chmod +x /usr/local/sbin/privoxy; \
133-
cp -a /usr/local/etc/privoxy /opt/privoxy-default; \
134133
# Change the default config
135-
cp /usr/local/etc/privoxy/config /usr/local/etc/privoxy/config.orig; \
134+
mv /usr/local/etc/privoxy/config /usr/local/etc/privoxy/config.orig; \
136135
sed -i '/^+set-image-blocker{pattern}/a +https-inspection \\' /usr/local/etc/privoxy/match-all.action; \
137-
sed -i \
138-
-e 's/^confdir .+/confdir \/usr\/local\/etc\/privoxy/' \
139-
-e 's/^templdir .+/templdir \/usr\/local\/etc\/privoxy\/templates/' \
140-
-e '/^actionsfile user.action/a actionsfile privman-rules\/user.action\nactionsfile ab2p.system.action\nactionsfile ab2p.action' \
141-
-e '/^filterfile user.filter/a filterfile privman-rules\/user.filter\nfilterfile ab2p.system.filter\nfilterfile ab2p.filter' \
142-
-e 's/^#debug 1.+/debug 1/' \
143-
-e 's/^#debug 512.+/debug 512/' \
144-
-e 's/^#debug 1024.+/debug 1024/' \
145-
-e 's/^#debug 8192.+/debug 8192/' \
146-
-e 's/^listen-address .+/listen-address 0.0.0.0:${PRIVOXY_PORT}/' \
147-
-e 's/^enforce-blocks .+/#enforce-blocks 0/' \
148-
-e 's/^buffer-limit .+/buffer-limit 25600/' \
149-
-e 's/^keep-alive-timeout .+/keep-alive-timeout 120/' \
150-
-e 's/^tolerate-pipelining .+/tolerate-pipelining 0/' \
151-
-e 's/^socket-timeout .+/socket-timeout 30/' \
152-
-e 's/^#max-client-connections .+/max-client-connections 256/' \
153-
-e 's/^#listen-backlog .+/listen-backlog 128/' \
154-
-e 's/^#ca-directory .+/ca-directory \/usr\/local\/etc\/privoxy\/CA/' \
155-
-e 's/^#ca-cert-file .+/ca-cert-file privoxy-ca-bundle.crt/' \
156-
-e 's/^#ca-key-file .+/ca-key-file cakey.pem/' \
157-
-e 's/^#certificate-directory .+/certificate-directory \/usr\/local\/etc\/privoxy\/certs/' \
158-
-e 's/^#trusted-cas-file .+/trusted-cas-file trustedCAs.pem/' \
159-
-e '$a\receive-buffer-size 32768' \
160-
-e '$a\cipher-list ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256' \
161-
/usr/local/etc/privoxy/config; \
136+
cp -a /usr/local/etc/privoxy /opt/privoxy-default; \
162137
chmod +x /usr/local/sbin/privoxy;
163138

164139
# adblock2privoxy

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ docker cp privoxy:/usr/local/etc/privoxy/CA/privoxy-ca-bundle.crt .
105105
| /usr/local/etc/privoxy/certs | Where privoxy stores the downloaded certificates |
106106
| /var/lib/privoxy | Where are the scripts related to privoxy |
107107

108+
## :wrench: Custom configuration
109+
110+
- If want privman blocking need add:
111+
```yaml
112+
actionsfile privman-rules/user.action
113+
filterfile privman-rules/user.filter
114+
```
115+
- If want adblock2privoxy blocking need add:
116+
```yaml
117+
actionsfile ab2p.system.action
118+
actionsfile ab2p.action
119+
filterfile ab2p.system.filter
120+
filterfile ab2p.filter
121+
```
122+
108123
## :computer: Privoxy Compiler Options
109124

110125
- --disable-toggle

docker-entrypoint.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@ fi
1010
if [ ! -e /usr/local/etc/privoxy/config ] || [ -z "$(ls -A /usr/local/etc/privoxy)" ]; then
1111
echo "[entrypoint] void config, populating defaults..."
1212
cp -a /opt/privoxy-default/* /usr/local/etc/privoxy/
13+
cp /usr/local/etc/privoxy/config.orig /usr/local/etc/privoxy/config
14+
sed -i \
15+
-e 's/^confdir .+/confdir \/usr\/local\/etc\/privoxy/' \
16+
-e 's/^templdir .+/templdir \/usr\/local\/etc\/privoxy\/templates/' \
17+
-e '/^actionsfile user.action/a actionsfile privman-rules\/user.action\nactionsfile ab2p.system.action\nactionsfile ab2p.action' \
18+
-e '/^filterfile user.filter/a filterfile privman-rules\/user.filter\nfilterfile ab2p.system.filter\nfilterfile ab2p.filter' \
19+
-e 's/^#debug 1.+/debug 1/' \
20+
-e 's/^#debug 512.+/debug 512/' \
21+
-e 's/^#debug 1024.+/debug 1024/' \
22+
-e 's/^#debug 8192.+/debug 8192/' \
23+
-e 's/^listen-address .+/listen-address 0.0.0.0:${PRIVOXY_PORT}/' \
24+
-e 's/^enforce-blocks .+/#enforce-blocks 0/' \
25+
-e 's/^buffer-limit .+/buffer-limit 25600/' \
26+
-e 's/^keep-alive-timeout .+/keep-alive-timeout 120/' \
27+
-e 's/^tolerate-pipelining .+/tolerate-pipelining 0/' \
28+
-e 's/^socket-timeout .+/socket-timeout 30/' \
29+
-e 's/^#max-client-connections .+/max-client-connections 256/' \
30+
-e 's/^#listen-backlog .+/listen-backlog 128/' \
31+
-e 's/^#ca-directory .+/ca-directory \/usr\/local\/etc\/privoxy\/CA/' \
32+
-e 's/^#ca-cert-file .+/ca-cert-file privoxy-ca-bundle.crt/' \
33+
-e 's/^#ca-key-file .+/ca-key-file cakey.pem/' \
34+
-e 's/^#certificate-directory .+/certificate-directory \/usr\/local\/etc\/privoxy\/certs/' \
35+
-e 's/^#trusted-cas-file .+/trusted-cas-file trustedCAs.pem/' \
36+
-e '$a\receive-buffer-size 32768' \
37+
-e '$a\cipher-list ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256' \
38+
/usr/local/etc/privoxy/config
1339
fi
1440

1541
echo "[entrypoint] starting..."

0 commit comments

Comments
 (0)