Created
November 30, 2011 12:23
-
-
Save farhaven/1408892 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Privoxy configuration, stored as /etc/privoxy/config.m4 | |
confdir /etc/privoxy | |
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 | |
filterfile default.filter | |
filterfile user.filter # User customizations | |
logdir /log | |
logfile logfile | |
listen-address 127.0.0.1:8118 | |
toggle 1 | |
enable-remote-toggle 0 | |
enable-remote-http-toggle 0 | |
enable-edit-actions 1 | |
enforce-blocks 0 | |
buffer-limit 4096 | |
# for TOR | |
include(/etc/privoxy/tor/tor) | |
forward 192.168.*.*/ . | |
forward 10.*.*.*/ . | |
forward 127.*.*.*/ . | |
forward localhost/ . | |
forwarded-connect-retries 0 | |
accept-intercepted-requests 0 | |
allow-cgi-request-crunching 0 | |
split-large-forms 0 | |
keep-alive-timeout 5 | |
socket-timeout 300 | |
handle-as-empty-doc-returns-ok 1 | |
------------------------------------------------ | |
# /etc/privoxy/tor/enable | |
forward-socks5 / 127.0.0.1:9050 . | |
------------------------------------------------ | |
# /etc/privoxy/tor/disable | |
# this file is empty | |
------------------------------------------------ | |
# ~/bin/tor-toggle.sh | |
#!/bin/ksh | |
conf=/etc/privoxy | |
current=$(basename `readlink ${conf}/tor/tor`) | |
echo $current | |
sudo rm ${conf}/tor/tor | |
if [ "$current" == "enable" ]; then | |
sudo ln -s ${conf}/tor/disable ${conf}/tor/tor | |
else | |
sudo ln -s ${conf}/tor/enable ${conf}/tor/tor | |
fi | |
m4 ${conf}/config.m4 | sudo tee ${conf}/config | |
sudo /etc/rc.d/privoxy restart | |
case "$current" in | |
"enable") | |
echo 'torbutton("disabled")' | awesome-client | |
;; | |
*) | |
echo 'torbutton("enabled")' | awesome-client | |
;; | |
esac | |
--------------------------------------------------------------- | |
# things in rc.lua | |
function torbutton(status) | |
naughty.notify({ text = status, title = "TOR status" }) | |
colors = { | |
["enabled"] = "#009000", | |
["disabled"] = "#900000" | |
} | |
txt_tor:set_markup(obvious.lib.markup.fg.color(colors[status], "☮")) | |
end | |
txt_tor = wibox.widget.textbox() | |
if awful.util.pread("readlink /etc/privoxy/tor/tor"):match("enable.$") then | |
txt_tor:set_markup(obvious.lib.markup.fg.color("#009000", "☮")) | |
else | |
txt_tor:set_markup(obvious.lib.markup.fg.color("#900000", "☮")) | |
end | |
txt_tor:buttons(awful.util.table.join( | |
awful.button({ }, 1, function () awful.util.spawn("bin/tor-toggle.sh") end) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment