Then a few things happened around the same time. First, I needed that spare hard drive to go into a refurbished computer that went to my father-in-law. Time to use a ramdisk for my havp scanning filesystem. Next, my son (now 10) started using the web more. Time for a filter.
This post will document how I implemented the squidGuard proxy server as a content filter, havp as an antivirus proxy, with a ramdisk as the havp scanning filesystem. Getting the ramdisk to mount with each reboot took some work, so here’s what I did.
First, the ramdisk. Hopefully someone can correct me, but I found that I could not simply put a line in my /etc/fstab for the ramdisk and just have it get mounted with a system reboot. Reboots are pretty rare, but this is the problem… they are so rare that when they do happen, I have to re-learn (a la google) how to create the ramdisk properly, then when starting havp fails I have to re-remember that I have to reset permissions on the mounted ramdisk, etc. Time for a script. Here’s my script, called /usr/local/bin/mount-havp-ramdisk.sh:
#! /bin/bash # HAVP requires a filesystem with mandatory locks. # I use a ramdisk for the filesystem, which must be created # before use by HAVP. # The script is called from the /etc/init.d/havp startup script, # and verifies that the ramdisk exists and is mounted, and if not # it creates it and sets proper permissions. # Set some variables RAMDISK=/dev/ram0 MOUNTPOINT=/var/tmp/havp HAVPUSER=havp # # If the ramdisk is already exists and is mounted, then no need to continue. # MP="`/bin/mount |/bin/grep $RAMDISK`" if [ "$MP" != "" ]; then # ramdisk is mounted; exit with success. exit 0; fi # # Since ramdisk not mounted, we won't assume it exists. # First we'll create the ramdisk, then mount it with mandatory locking # and finally set permissions # /sbin/mke2fs -q -m 0 /dev/ram0 && \ /bin/mount -o mand $RAMDISK $MOUNTPOINT && \ /bin/chown $HAVPUSER:root $MOUNTPOINT && \ /bin/chmod 0750 $MOUNTPOINT exit $?
Source : http://drhymel.com/blog/?p=25