GNU Linux/FREESCO/Guides/Privoxy

From WhyAskWhy.org Wiki
Jump to: navigation, search




Much of the following content has been ported over with little correction from its original source. The directions may contain broken links and may also refer to older software or operating systems that are no longer supported by their respective vendors. If you have specific questions, please contact me via Twitter and I'll try to help you out.


Privoxy 3.0.2 for FREESCO

You'll follow the directions provided from your Zipslack 3.9 box where you will compile and configure Privoxy. The directions for a hard disk installation are proof of concept only as you'll be running Privoxy directly from the ZipSlack 3.9 installation and not from your FREESCO hard disk installation. The directions for a floppy disk based FREESCO router are also not permanent, but these instructions allow you to see how it might be done.


Compiling Privoxy

Hard Disk setup

If you have a hard disk install of FREESCO, you'll compile Privoxy using these steps inside of your ZipSlack 3.9 installation:

  1. autoheader
  2. autoconf
  3. ./configure --disable-pthread --with-user=root --with-group=root
  4. cp config.h config.tmp
  5. sed 's!#define HAVE_.*TIME_R 1!/* & */!g' config.tmp > config.h
  6. rm config.tmp
  7. make
  8. make install


An alternative to line 5 is to manually alter the following lines in config.h:

#define HAVE_GMTIME_R 1 
#define HAVE_LOCALTIME_R 1

to:

/* 
#define HAVE_GMTIME_R 1 
#define HAVE_LOCALTIME_R 1
*/

Floppy Disk setup

If you run FREESCO from a floppy disk, you'll instead compile Privoxy from your ZipSlack 3.9 installation using these directions:

  1. autoheader
  2. autoconf
  3. ./configure --disable-pthread --with-user=root --with-group=root --prefix=/privoxy 
  4. cp config.h config.tmp
  5. sed 's!#define HAVE_.*TIME_R 1!/* & */!g' config.tmp > config.h
  6. rm config.tmp
  7. make
  8. make install

The difference between these compilation directions vs the earlier ones is the additional configure option: --prefix=/privoxy


Privoxy Installation

Privoxy 3.0.2 has been compiled and only a few more steps to go before we're finished.

In addition to the Privoxy files that were installed earlier during the build process, you also need additional files in order to run Privoxy. Inside of the source directory where you uncompressed the source archive, you'll find the following list of files.

Copy them to the locations specified in the table below using the path that matches the installation you want to have. Keep in mind that Hard disk refers to running Privoxy from the ZipSlack 3.9 installation and not an installation of FREESCO onto a hard disk. I expect that creating a tarball of /privoxy, decompressing it on the hard disk-based FREESCO router and modifying rc_user to call /privoxy/sbin/privoxy would do the trick, I haven't tested that approach and couldn't say for sure.


File copy destinations
File name Hard disk Floppy disk
default.action /usr/local/etc/default.action /privoxy/etc/default.action
default.filter /usr/local/etc/default.action /privoxy/etc/default.action
standard.action /usr/local/etc/default.action /privoxy/etc/default.action
user.action /usr/local/etc/default.action /privoxy/etc/default.action
config [1] /usr/local/sbin/config /privoxy/sbin/config


Floppy Disk setup

If you don't use a hard disk based FREESCO, you'll need to follow the steps outlined below.

I currently use [2] FREESCO 0.3.0 with the option for a read-only floppy. So, once FREESCO starts loading, it is setup to create a ramdisk where it copies the contents of the floppy before it continues to load. I also have the option enabled in setup for FREESCO to create two extra ramdisks for program usage. They're nice, but it doesn't help the average user much because of the floppy limitations. A fter basic configuration, FREESCO 0.3.0 doesn't leave you with but a very small amount of free disk space (under a 100K); this isn't enough to use Privoxy from the boot floppy.

I personally prefer a bootable cd method, but haven't gotten around to producing a bootable cd for 0.3.0 yet, as I lack the motivation to do so; the FREESCO box I'm using has an older non El-Torrito capable bios.

Assuming you compiled FREESCO using the directions earlier for including --prefix=/privoxy, we're ready to copy the files to the FREESCO floppy disk. Substitute your values for IP address and privoxy source directory for the ones given below.

# Insert a blank floppy and mount it. This is NOT your FREESCO floppy disk.
mount -t vfat /dev/fd0 /mounted_floppy_directory
cd privoxy_source_directory
# Open config with vi, vim, joe, nano or whatever happens to be your favorite editor.
# Change listen-address 127.0.0.1:8118 to the internal (private network) ip address of your FREESCO box, along with the port you wish it to run on. 
# For example listen-address 192.168.0.1:8118 
# Or, just use sed.
sed -i 's/127.0.0.1/192.168.0.1/g' config

sed is pretty cool. :)


Notice this is not config.h that is being altered by sed, it is config, without any extension. Also, notice the intentional double space between the ending s and the 1 following right behind it. It is required.


  1. cp default.filter default.action standard.action user.action /privoxy/etc/
  2. cp config /privoxy/sbin 
  3. cd /privoxy
  4. mount -t vfat /dev/fd0 /mounted_floppy_directory


Make sure you mount the floppy. I forgot to do that and ended up having to repeat the process after cleaning up the errant file copy.


  1. cp -R ./* /mounted_floppy_directory/ 
  2. cp /bin/cp /mounted_floppy_directory/
  3. cp /bin/netstat /mounted_floppy_directory/ 
  4. sync; umount /mounted_floppy_directory/

We're now finished copying files to the floppy, so let's turn our attention to your FREESCO router.

  1. Boot your FREESCO router in read-only mode with extra ramdisks enabled. This is an option that was included with 0.3.0, and is probably included in recent versions.
  2. Once that is done, and FREESCO is loaded and running, remove the boot floppy and insert the floppy you just copied the Privoxy files to.
  1. mount -t vfat /dev/fd0 /mnt/fd 
  2. cp /mnt/fd/cp /bin/cp
  3. /bin/cp /mnt/fd/netstat /bin/netstat
  4. sync

Now that the floppy is mounted and the ZipSlack 3.9 binaries are copied to the /bin directory, we're ready to copy over the Privoxy files.

  1. cd /mnt/ram2

If you couldn't change directories to that directory, you'll need to make sure you have the extra ramdisks option turned on. If you don't, now is the time to go back and do that and repeat the steps needed to get back to this point.

  1. mkdir privoxy
  2. cd privoxy
  3. /bin/cp -R /mnt/fd/* ./ ; sync
  4. cd /
  5. ln -s /mnt/ram2/privoxy ./privoxy 
  6. cd /privoxy/sbin
  7. ./privoxy

You should now see something similar to:

Privoxy(00001) Info: loading configuration file /mnt/ram2/privoxy/sbin/config
:

If you didn't change what address and port you wish privoxy to run on, it will probably try to run on 127.0.0.1:8118. To verify this, run /bin/netstat, which we copied earlier.

You'll probably see something similar (trimmed for neatness):

[Linux] netstat -an

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 192.168.0.1:8118        0.0.0.0:*               LISTEN
tcp        0      2 192.168.0.1:23          192.168.0.13:2293       ESTABLISHED
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:515             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
udp        0      0 0.0.0.0:1044            0.0.0.0:*
udp        0      0 0.0.0.0:53              0.0.0.0:*
udp        0      0 127.0.0.1:1027          127.0.0.1:514           ESTABLISHED
udp        0      0 0.0.0.0:514             0.0.0.0:*
raw        0      0 0.0.0.0:1               0.0.0.0:*               7

Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ]         STREAM                   14633  /dev/log
unix  2      [ ]         STREAM     CONNECTED     14632
unix  2      [ ]         STREAM                   13167  /dev/log
unix  2      [ ]         STREAM     CONNECTED     13166
unix  2      [ ]         STREAM                   12318  /dev/log
unix  2      [ ]         STREAM     CONNECTED     12317
unix  2      [ ]         STREAM                   2813   /dev/log
unix  2      [ ]         STREAM     CONNECTED     2812
unix  2      [ ]         STREAM                   2544   /dev/log
unix  2      [ ]         STREAM     CONNECTED     2543
unix  1      [ ACC ]     STREAM     LISTENING     1275   /dev/log
unix  2      [ ]         STREAM                   106    /dev/log
unix  2      [ ]         STREAM     CONNECTED     105
[Linux]

Privoxy is running at 192.168.0.1:8118 as shown above. Currently there are no clients connected, so it is in a listen state.

Are you ready? Go ahead and configure your browser to use Privoxy as your browser proxy for http & https and give it a try. You should be able to connect and start surfing the web. If you have trouble, be sure to post your issue in the support forums under the correct version of FREESCO you're using. I've followed my own steps and it works as advertised, but I could have glossed over something that I'm used to doing.

Unfortunately, the pthread option had to be disabled to get Privoxy to compile properly. I don't recall whether this is a limitation of this particular kernel version or not.

Enjoy, and please send any suggestions and/or corrections my way. Thanks for reading, and remember, feedback is appreciated!

Dingetje, thanks for the help man, this "Writeup", is for you! If you had not sent me your compile log, I would have never gotten this far. Keep up the great work & positive attitude towards newbies!

BTW, for those of you that noticed the this error when you issued make install:

make: *** [install] Error 1

This is because a privoxy user and group doesn't exist at the time of compilation. This could probably be solved by creating them prior to installation, but since this was a proof-of-concept build I did not pursue it.


References

  1. config is found as config.txt on Win32 systems. Make sure to rename to config.
  2. This guide, written somewhere between 2002-2003, was ported over without changing the tense used