Web Interface

Gavin Nelmes-Crocker gavin at NETERGY.COM
Sat Dec 21 15:44:00 GMT 2002


Ok somewhat delayed - sorry work got in the way along with Christmas stuff
anyway here is a taster of what we are doing at the moment - probably not
perfect but it seems to work.

This is just the section for creating the virus.scanning.rules but it can be
mirrored for any of the rules files.

First off create a MySQL database and then a table for the scanning rules
(we called it scan_rules) create the three fields for the FromTo stuff, the
domain and yes/no

Now on our server we have php running as a cgi so we can use that first line
and run the script as a cron job but if you remove that and call the page up
in the browser it won't show you anything but it will create the file.
Basically the script will read the table and parse it out to the file in
$virusfile . The include file at the top contains the info for connecting to
the database - I can send one if anyone doesn't have this but its fairly
simple.

You need to change your MailScanner.conf file to reference the
rules/virus.scanning.rules for how it will process the domains and of course
you will only see the changes take effect after 4 hours (standard reload
config for Mailscanner) or if you force it in your script by doing a
/etc/rc.d/init.d/MailScanner reload.

You do need to make sure that the table has default rule in it or alter the
script to always add a default rule to the end and that it is it either use
phpmyadmin to add entries to the table or build a php page to do it and
there you have it the building block for a web admin.  I plan to extend this
to the spam score rules etc so that you could have a customer log in who can
then change their high and low levels as well as what happens to the mail
and what account it goes to etc.

If anyone has any improvements/ideas please let us all know. I'm not really
a programmer I tweak other peoples ideas to get what I want or plough my way
through the book until I get exasperated and ask a php programming friend
for help :-)

Hope this helps

Gavin


#!/usr/bin/php -q
<?php
include "common_db-nvsd.inc";
$link_id=db_connect();
$query=" SELECT * FROM scan_rules";
$result=mysql_query($query);
$virusfile=fopen ("/etc/MailScanner/rules/virus.scanning.rules","w");
while($row=mysql_fetch_array($result))
          {
$virusstring=$row[fromto]."      ".$row[domain]."        ".$row[yesno];

if ($row[host_name]==NULL)
{
$virus=$row[fromto]." - ".$row[domain]." ".$row[yesno];
}
fwrite($virusfile,$virusstring);
fwrite($virusfile,"\n");
            }
fclose ($virusfile);

?>

> -----Original Message-----
> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]On
> Behalf Of James A. Pattie
> Sent: 18 December 2002 16:52
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: Web Interface
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Gavin Nelmes-Crocker wrote:
> >>Is your interface mainly for editing MailScanner.conf or will it also
> >>allow you to edit rules files, etc.?
> >>
> >>Are you going to try and allow an email user to modify their settings?
> >>Settings being: viruscan, spam filter, spam score, spam action, etc.
> >
> >
> > what we have done for the virusscan rules and others is use a mysql
> > database - put a php frontend and then use some php running as cron
> jobs to
> > create the actual files from the database then do a Mailscanner
> reload and
> > its all updated.  I suppose you could do the same the mailscanner
> config but
> > it would be a long winded way of doing it as there is lots of stuff
> that you
> > never change.
> >
>
> Any chance that you might be able to release these scripts?
>
>
> - --
> James A. Pattie
> james at pcxperience.com
>
> Linux  --  SysAdmin / Programmer
> Xperience, Inc.
> http://www.pcxperience.com/
> http://www.xperienceinc.com/
>
> GPG Key Available at http://www.pcxperience.com/gpgkeys/james.html
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQE+AKe1tUXjwPIRLVERAg4NAKCWE0M9tXtJ80Ug2dMZM5Za4vBvJgCeL/Cn
> eKg/svG7hmw4lj4kag49Ajo=
> =46wZ
> -----END PGP SIGNATURE-----
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> --
> This message has been scanned for viruses and dangerous content
> by the Netergy Virus Spam Defence, and is believed to be clean.
> For details on having your email scanned email nvsd at netergy.com
>


--
This message has been scanned for viruses and dangerous content
by the Netergy Virus Spam Defence, and is believed to be clean.
For details on having your email scanned email nvsd at netergy.com



More information about the MailScanner mailing list