DansGuardian Documentation Wiki

You are here: Main Index » using_blocked_message_delivery_for_other_purposes_too


|

Wiki Information

Using Blocked Message Delivery for Other Purposes Too

A CGI program that's invoked whenever a page is blocked can do more than just deliver the message to the user. It can also send email, permanently deny web access to users that exceed their daily allotment of page blocks, and so forth. Using additional CGI Program behaviors is most appropriate where some immediate action is required. Where action can wait until the end of the day (for example notify the administrator of a list of suspect URLs), some form of Log File Analysis is probably more appropriate. The infrastructure requirements of a CGI program may be substantial, almost always militating for sticking with the much simpler Method 1 (of 2): Using an HTML File of delivering block messages.

If other purposes are important enough to require Method 2 (of 2): Using a CGI Program to deliver block messages, you may be able to reuse an existing script or you may need to program your own script. To browse through a library of existing scripts that you might reuse, web browse to the page http://dansguardian.org/?page=extras and look under the heading “Reporting script and gif replacements:”. If you set out to create a new CGI Program, you may need the detailed information about query arguments in CGI Program Parameters.

One of the additional functions a blocked page CGI Program might perform is to modify the behavior of DansGuardian itself. A common additional behavior is to deny future web access to a user who's had too many blocked pages during the day. You can do this several different ways, all the way from disabling that particular computer by banning its IP address to moving a user to a different filter group. (The existing scripts in the library of addons use the lower end method of simply banning a particular computer by banning an IP address, probably partly because this is simpler [just add but don't change file lines] and partly because it's much easier to configure and use in a specific environment. The higher end method of moving a user to a different filter group is also possible in theory.)

To enable a blocked page CGI Program to modify the behavior of DansGuardian itself you must:

  1. Run the webserver that provides the blocked page on the same computer as DansGuardian itself. (…unless you want to handle all the security issues of remote program execution)
  2. Set up permissions so all the configuration files that are involved can be read and written by both DansGuardian itself and the CGI Program via the webserver
  3. Set up permissions so the CGI Program via the webserver is allowed to restart DansGuardian as needed
  4. Have DansGuardian do a gentle restart (dansguardian -g) of DansGuardian after configuration files are modified so DansGuardian will reread all its configuration files

Once you set up a web server as part of supporting a CGI Program, you can also add as many images as you like to the blocked page, both for the additional behavior and as part of the blocked page message itself. Here is some additional information about adding images to the blocked page (this information is specifically for an HTML Template and may need to be slightly translated for use with a CGI Program).