aboutsummaryrefslogtreecommitdiff
path: root/net/privoxy/files
diff options
context:
space:
mode:
authorChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-02-15 16:58:25 +0100
committerChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-02-15 16:58:43 +0100
commit87b9255c03f29f02ceaec80cdacd033e1c6b39c1 (patch)
tree152bcf7849e9ad43663a03c3d12edc2863632f87 /net/privoxy/files
parentce83241311758402d9ecffe191e51db81f29c76e (diff)
privoxy: remove upgrade handling, conffile and initscript fixes
* remove upgrade handling for version 3.0.21 or older packages. Also fix #726 * added user.action, user.filter and user.trust files to conffiles (might be modified by user on running system) * move permission setting from Makefile (install) to initscript because permissions are overwritten during/inside buildroot Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'net/privoxy/files')
-rw-r--r--net/privoxy/files/privoxy.config11
-rw-r--r--net/privoxy/files/privoxy.init73
-rw-r--r--net/privoxy/files/privoxy.oldconfig33
3 files changed, 58 insertions, 59 deletions
diff --git a/net/privoxy/files/privoxy.config b/net/privoxy/files/privoxy.config
index 50e401f9a..95b6cf10c 100644
--- a/net/privoxy/files/privoxy.config
+++ b/net/privoxy/files/privoxy.config
@@ -1,13 +1,12 @@
-# this file support all available configuration options of
-# Privoxy web-proxy
+# this file support all available configuration options of Privoxy web-proxy
# the scripts move all options to the final privoxy readable configuration file
#
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! privoxy uses "-" in option names but uci only support "_" !!!
# !!! privoxy "listen-address" must be uci "listen_address" !!!
# !!! !!!
-# !!! if you add entries please use !!!
-# !!! option for options with one parameter (option confdir) !!!
+# !!! if you add entries please use !!!
+# !!! option for options with one parameter (option confdir) !!!
# !!! list for options with multiple parameters (list listen_address) !!!
# !!! !!!
# !!! special handling for debug option !!!
@@ -19,10 +18,11 @@ config privoxy 'privoxy'
option logdir '/var/log'
option logfile 'privoxy.log'
list filterfile 'default.filter'
+# list filterfile 'user.filter'
list actionsfile 'match-all.action'
list actionsfile 'default.action'
# list actionsfile 'user.action'
- list listen_address '127.0.0.1:8118'
+# list listen_address '127.0.0.1:8118'
list listen_address '192.168.1.1:8118'
option toggle '1'
option enable_remote_toggle '1'
@@ -38,6 +38,7 @@ config privoxy 'privoxy'
option socket_timeout '300'
list permit_access '192.168.1.0/24'
option debug_1 '0'
+ option debug_512 '1'
option debug_1024 '0'
option debug_4096 '1'
option debug_8192 '1'
diff --git a/net/privoxy/files/privoxy.init b/net/privoxy/files/privoxy.init
index 9b4f3a327..b8d978fc3 100644
--- a/net/privoxy/files/privoxy.init
+++ b/net/privoxy/files/privoxy.init
@@ -8,9 +8,6 @@ CFGFILE=/var/etc/privoxy.conf
CFGTEMP=/var/etc/privoxy.conf.tmp
_uci2conf() {
- local _LOGDIR="/var/log" # set default
- local _LOGFILE="privoxy.log" # set default
-
# redefined callback for options when calling config_load
option_cb()
{
@@ -19,21 +16,19 @@ _uci2conf() {
local __OPT="$1"
local __VAL="$2"
case $__OPT in
- logdir) # logdir handled later
- _LOGDIR="$__VAL" ;;
- logfile) # logfile handled later
- _LOGFILE="$__VAL" ;;
+ confdir|templdir|temporary_directory|logdir|logfile)
+ # needs to be handled separately because we need to set permissions
+ # AND needs to be defined first because of a BUG inside privoxy
+ # require directories to be defined first inside config
+ ;;
+ debug_*)
+ [ $__VAL -eq 0 ] && return # not set ignore
+ echo -e "debug\t$(echo $__OPT | sed -e 's#debug_##g')" >> $CFGTEMP ;;
*)
# detect list options (LENGTH) and ignore
echo $__OPT | grep -i "_LENGTH" >/dev/null 2>&1 && return
# detect list options (ITEM) and ignore
echo $__OPT | grep -i "_ITEM" >/dev/null 2>&1 && __OPT=$(echo $__OPT | sed -e "s#_ITEM.##g")
- # filter debug_*
- echo $__OPT | grep -i "debug_" >/dev/null 2>&1 && {
- [ $__VAL -eq 0 ] && return # not set ignore
- __VAL=$(echo $__OPT | sed -e "s#debug_##g")
- __OPT="debug"
- }
# uci only accept "_" but we need "-"
local __OPT=$(echo $__OPT | sed -e "s#_#-#g")
# write to config
@@ -42,9 +37,11 @@ _uci2conf() {
esac
}
+ # temporary config file
+ # privoxy need read access
mkdir -m0755 -p /var/etc
- echo "" > $CFGTEMP # create tmp config file
- chmod 644 $CFGTEMP # garantee that privoxy can read
+ echo "" > $CFGTEMP
+ chmod 644 $CFGTEMP
chgrp privoxy $CFGTEMP
echo '### AUTO-GENERATED CONFIGURATION' >> $CFGTEMP
@@ -53,19 +50,53 @@ _uci2conf() {
echo '### SEE /etc/config/privoxy INSTEAD' >> $CFGTEMP
echo '' >> $CFGTEMP
- config_load privoxy # calling above option_cb()
-
- # write logdir/logfile to config
- echo -e "logdir\t$_LOGDIR" >> $CFGTEMP
- echo -e "logfile\t$_LOGFILE" >> $CFGTEMP
+ # confdir
+ # privoxy needs read access (possibly write access)
+ _CONFDIR=$(uci -q get privoxy.privoxy.confdir) || _CONFDIR="/etc/privoxy"
+ chmod 755 $_CONFDIR
+ chmod 664 $_CONFDIR/*
+ chgrp privoxy $_CONFDIR $_CONFDIR/*
+ echo -e "confdir\t$_CONFDIR" >> $CFGTEMP
+
+ # templdir
+ # privoxy need read access
+ _TEMPLDIR=$(uci -q get privoxy.privoxy.templdir) # no default needed
+ if [ -z "$_TEMPLDIR" ]; then
+ chmod 755 $_CONFDIR/templates
+ chmod 644 $_CONFDIR/templates/*
+ chgrp privoxy $_CONFDIR/templates $_CONFDIR/templates/*
+ else
+ chmod 755 $_TEMPLDIR
+ chmod 644 $_TEMPLDIR/*
+ chgrp privoxy $_TEMPLDIR $_TEMPLDIR/*
+ echo -e "templdir\t$_TEMPLDIR" >> $CFGTEMP
+ fi
- # create logfile and set permissions
+ # logdir and logfile
+ # privoxy needs read/write access
+ _LOGDIR=$(uci -q get privoxy.privoxy.logdir) || _LOGDIR="/var/log"
+ _LOGFILE=$(uci -q get privoxy.privoxy.logfile) || _LOGFILE="privoxy.log"
+ mkdir -m0755 -p $_LOGDIR
touch $_LOGDIR/$_LOGFILE
chmod 664 $_LOGDIR/$_LOGFILE
chown privoxy:privoxy $_LOGDIR/$_LOGFILE
+ echo -e "logdir\t$_LOGDIR" >> $CFGTEMP
+ echo -e "logfile\t$_LOGFILE" >> $CFGTEMP
+
+ # temporary-directory
+ # privoxy needs read/write access
+ _TMP_DIR=$(uci -q get privoxy.privoxy.temporary_directory) # no default needed
+ if [ -n "$_TMP_DIR" ]; then
+ mkdir -m0750 -p $_TMP_DIR
+ chown privoxy:privoxy $_TMP_DIR
+ echo -e "temporary-directory\t$_TMP_DIR" >> $CFGTEMP
+ fi
+
+ config_load privoxy # calling above option_cb() and write the rest into $CFGTEMP
# move temp to final privoxy readable configuration
mv -f $CFGTEMP $CFGFILE
+ return 0
}
boot() {
diff --git a/net/privoxy/files/privoxy.oldconfig b/net/privoxy/files/privoxy.oldconfig
deleted file mode 100644
index 9496356dc..000000000
--- a/net/privoxy/files/privoxy.oldconfig
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# original configuration file used by privoxy
-# this is no longer supported by this package
-# it's converted and moved to uci configuration
-# please look at /etc/config/privoxy
-#
-confdir /etc/privoxy
-logdir /var/log
-logfile privoxy.log
-filterfile default.filter
-actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.
-actionsfile default.action # Main actions file
-#actionsfile user.action # User customizations
-listen-address 127.0.0.1:8118
-toggle 1
-enable-remote-toggle 1
-enable-remote-http-toggle 0
-enable-edit-actions 1
-enforce-blocks 0
-buffer-limit 4096
-forwarded-connect-retries 0
-accept-intercepted-requests 0
-allow-cgi-request-crunching 0
-split-large-forms 0
-keep-alive-timeout 300
-socket-timeout 300
-permit-access 192.168.1.0/24
-debug 1 # show each GET/POST/CONNECT request
-debug 4096 # Startup banner and warnings
-debug 8192 # Errors - *we highly recommended enabling this*
-#admin-address privoxy-admin@example.com
-#proxy-info-url http://www.example.com/proxy-service.html
-