I love creating software, this is my dream. My goal is to create as much as possible open source software. Help me by suggesting one.

Thursday, March 01, 2007

Internet Cache Setup

Easily configure Squid to use ICP and as a personal cache server.

Internet Cache Setup makes it easier to configure squid to use as a local
cache server, as well as to use multicast ICP cache sharing to speed up the
internet on the network. It can also configure an external proxy address
within the GUI interface.

The software is available here

4 comments:

Martin said...

I tried your software on Ubuntu Feisty and it doesn't work there. Or at least, it doesn't work properly.

Every time I enable squid, the option "visible_hostname" is appended to the /etc/squid/squid.conf. It is never removed.

squid is never started. Shouldn't this program start squid?

When I reinstalled squid to double-check the config file (hoping it would lay down the original) I got errors:

Setting up squid (2.6.5-4ubuntu2) ...
Creating squid spool directory structure
FATAL: Bungled squid.conf line 4362: visible_hostname
Squid Cache (Version 2.6.STABLE5): Terminated abnormally.
* Restarting Squid HTTP proxy squid * Creating squid spool directory structure
FATAL: Bungled squid.conf line 4362: visible_hostname
Squid Cache (Version 2.6.STABLE5): Terminated abnormally.
FATAL: Bungled squid.conf line 4362: visible_hostname
Squid Cache (Version 2.6.STABLE5): Terminated abnormally.

without any visible_hostname line, I get the following error:

Setting up squid (2.6.5-4ubuntu2) ...
Creating squid spool directory structure
FATAL: Could not determine fully qualified hostname. Please set 'visible_hostname'
Squid Cache (Version 2.6.STABLE5): Terminated abnormally.

so it looks like you're trying to set visible_hostname to... something.

I'm not sure why this isn't getting filled in properly, because from my env vars it looks like it should:

mespinoza@sec2lpt7-linux:/usr/bin$ echo $HOSTNAME
sec2lpt7-linux
mespinoza@sec2lpt7-linux:/usr/bin$ grep '\$HOSTNAME' internet-cache-setup
echo "visible_hostname $HOSTNAME" >> $SQUID_CONF;

I looked at the code...

SQUID_VISIBLE_HOSTNAME=$(cat $SQUID_CONF | grep ^visible_hostname | cut -d " " -
f2 | sed 's/^ //g');
echo "visible_hostname is set to $SQUID_VISIBLE_HOSTNAME"

and

CHECK_VISIBLE_HOSTNAME () {
if [ -z "$SQUID_VISIBLE_HOSTNAME" ]; then
echo "visible_hostname $HOSTNAME" >> $SQUID_CONF;
fi
}

What you are doing here is you are somehow setting a bad visible_hostname line the first time, and then your script is not finding visible_hostname because of the way you are looking for it. You should be grepping for '^visible_hostname' to find out if it exists at all, then parsing the results of the grep to determine whether it is set to anything useful.

The only place that "$HOSTNAME" occurs is in the snip above, so I assume you are counting on hostname coming from the environment. I'm not sure why this isn't happening for me, but it is good practice to use /bin/hostname instead of the environment variable because it may not be properly set.

If I change that line to the following:

echo "visible_hostname `/bin/hostname`" >> $SQUID_CONF;

Then the program seems to basically work, including starting squid, because the config file is valid.

However, last time I restarted firefox it didn't actually activate the proxy information, it filled it in. I'm about to try again.

Also notable is the fact that your dialogs do not correctly draw with nonstandard fonts. I can email you an image demonstrating but the point is that there is not room for all of the text and it is overlapped. I can see more or less what is there but it's less than clear.

Thank you for taking on this task. A simple squid configurator is more than welcome (although one that does some more complicated things, like providing an ad blocking proxy, would also be welcome.) But it does appear to need a touch or two...

Martin said...

One last note: an option to set the cache size is absolutely mandatory. The default is 100MB, which will not hurt anyone, but is also of limited use. My Firefox cache is set to 50MB. Doubling the cache is not exciting.

I would suggest reading the default cache_dir from the file:

#Default:
# cache_dir ufs /var/spool/squid 100 16 256

then replicating the line and allowing the editing of the size value (first number) and then automatically set the other values from it (first- and second-level directories, respectively) while allowing manual editing of those values.

It would also be excellent to allow multiple store types; aufs would be a good start since it requires no special additional flags and the options come in the same order and number as the ufs store type. You could also allow the diskd store by the same token (although it does have two additional optional arguments.) But this is just a minor feature request, really. Being able to set the cache size is what matters.

joelbryan said...

Hi Martin, Thanks for your corrections, I learned something new about using /bin/hostname. I'll be setting up SVN of all my projects so it'll be edited. I'm still on the process of learning how to use it. Thanks

piju said...

how about polipo ?

About Me

joelbryan
Paranaque, Metro Manila, Philippines
I like creating software that makes people's life easier.
View my complete profile