Zapping Ads with Squid and adzapper

Discuss Applications
User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jul 22, 2003 9:41 pm

Ok, here's a start:
http://voidmain.is-a-geek.net/files/squidcon/

You'll find "squidcon.php" and "squidcon.sudoers" in the above directory.

- have Apache/PHP running on your squid server
- put the php file somewhere under your web root and rename it to have a *.php extension
-- I would put it in it's own directory and name it "index.php" and make sure that "index.php" is listed as a directory index file in your Apache configuration
-- I would also restrict access to it with a ".htaccess" file.
- edit the php script and check to make sure the config vars at the top are correct (your ACL directory and filename)
- make sure your ACL file is writable by your apache user
- if you want the PHP script to automatically reload Squid when you make a change then you'll need to set up you /etc/sudoers file sorta like my example sudoers file at the above URL

If we're lucky maybe some adventurous young person might want to expand it into a more featured Squid Console. This is just a quick 0.0.1 release that may go no further. :)

Maniaman
scripter
scripter
Posts: 94
Joined: Tue Mar 11, 2003 5:10 pm

Post by Maniaman » Wed Jul 23, 2003 7:22 am

Nice. :D

One problem though...
I edited my /etc/sudoers like you said, but squid still doesn't reload when I save the banned.sites through the web console. Are there any services I need to restart after editing /etc/sudoers?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Jul 23, 2003 5:12 pm

You didn't change the permissions on /etc/sudoers did you? It needs to be mode "440":

# chown root:root /etc/sudoers
# chmod 440 /etc/sudoers

Also "sudo" must be installed (which sudo). :) Check your logs for sudo errors to see what the problem might be:

# grep sudo /var/log/secure | tail
# grep sudo /var/log/messages | tail

Maniaman
scripter
scripter
Posts: 94
Joined: Tue Mar 11, 2003 5:10 pm

Post by Maniaman » Wed Jul 23, 2003 5:18 pm

Jul 23 08:10:24 localhost sudo(pam_unix)[12207]: authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=apache
Jul 23 08:19:26 localhost sudo(pam_unix)[12310]: authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=apache
I got a bunch of those when I did grep sudo /var/log/messages | tail

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Jul 23, 2003 5:44 pm

Change the SQUIDSERVER from "proxy" to "localhost" in /etc/sudoers. I also just changed it in the example sudoers on the web server and added a little comment as I am sure that is your problem.

Maniaman
scripter
scripter
Posts: 94
Joined: Tue Mar 11, 2003 5:10 pm

Post by Maniaman » Fri Jul 25, 2003 9:45 am

One last problem I'm having...
I just set up a .htaccess file for the php "program" you made4. Now when I enter the correct username/pass it redirects me to http://localhost.localdomain/squid/ instead of the correct domain.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Jul 25, 2003 5:17 pm

I don't know what your .htaccess file looks like which would help but as far as your web server configuration goes I usually put an entry in my /etc/hosts file for my Ethernet interface and use that name in my Apache configuration for "ServerName". For instance in my /etc/hosts I have:

Code: Select all

127.0.0.1       localhost.localdomain   localhost
192.168.1.2    nitro.voidmain.home    nitro
Then in my /etc/httpd/conf/httpd.conf I have:

Code: Select all

ServerName nitro.voidmain.home:80
Of course my web server is in my DMZ where it has a static IP address. If your web server is on a dynamic IP you will not want to add the entry to /etc/hosts but rather just set your ServerName appropriately.

Maniaman
scripter
scripter
Posts: 94
Joined: Tue Mar 11, 2003 5:10 pm

Post by Maniaman » Fri Jul 25, 2003 5:45 pm

That fixed it. Thanks again :)

I'm also currently adding a script that will allow you to select the error files from a list and edit them. I might post it here when I get it done. Only bad thing is you have to chmod all the error files. I dont see any way around having to do that either without running apache as root. :(

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Jul 25, 2003 6:17 pm

You don't really want to "edit" the error logs do you? You just want to view them right? Also, have you ever heard of webmin? Not only can you browse/search the logs but it has a web based file manager where you can edit files etc (ewwwwww). But more importantly webmin is great for all you administration needs if you are rather n00bish (and even if you are not so n00bish).

Maniaman
scripter
scripter
Posts: 94
Joined: Tue Mar 11, 2003 5:10 pm

Post by Maniaman » Fri Jul 25, 2003 6:36 pm

Not the logs. The pages that come up when you go to a blocked site or a non existent site. Also I've been using Webmin for a few weeks too :)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Nov 03, 2003 10:28 pm


Post Reply