SMBD Audit Installation
=======================

First you have to INSTALL mysql_audit.so or mgsql_audit.so module for 
Samba and configure it. Check you VFS directory - usually /usr/lib/vfs
or /usr/lib/samba/vfs or /usr/lib64/samba/vfs (if you are using 64bit 
system) 
Put mysql_audit.so or pgsql_audit.so to your VFS directory. Add a line
to smb.conf file

vfs object = mysql_audit

or

vfs object = pgsql_audit

NOTE: this module was copiled and tested with Samba 3.0.28 and
if you will put .so or full path name into "vfs object" parameter
it won't work!!!

After have installed and configured mysql_audit.so or pgsql_audit.so 
module you have to do the following:
--------------------------------------------------------------------------------
1. Create user/database. Replace 'smbd001' with your password.

1.1 MySQL. Under root or other mysql 
   powered user give the following command:

 mysqladmin -p create smbd
 
    and using mysql cli or any GUI admin:
 
 GRANT ALL ON smbd.* TO 'smbd'@'localhost' IDENTIFIED BY 'smbd001';

1.2 PostgreSQL. Under postgres or other PostgreSQL
   powered user give the following command in psql:
   
CREATE USER smbd PASSWORD 'smbd001';
CREATE DATABASE smbd OWNER smbd;

--------------------------------------------------------------------------------
2. Create audit tables and populate data in the database.

2.1 MySQL

 mysql -p smbd < smbd_mysql.sql
 
2.2 PostgreSQL

 psql smbd smbd < smbd_pgsql.sql

 NOTE:if you choose to give other name to audit database don't forget to
      change it int ./config/config.php, and ./src/pgsql_logger.h ;)
      do I say - Leave it as it is!

--------------------------------------------------------------------------------
3. Now you MUST configure DB connection

3.1 MySQL.

 In smb.conf, right after "vfs object = mysql_audit" specify
 
    mysql_audit:host=localhost
    mysql_audit:user=smbd
    mysql_audit:pass=smbd001
    mysql_audit:name=smbd
    mysql_audit:port=3306
 
 NOTE: all parameters are optional, if you don't specify them they will be 
       assigned as specified above(localhost,smbd,smbd001,smbd,3306).
    
3.2 PostgreSQL. 

 In smb.conf, right after "vfs object = pgsql_audit" specify
 
    pgsql_audit:host=localhost
    pgsql_audit:user=smbd
    pgsql_audit:pass=smbd001
    pgsql_audit:name=smbd
    pgsql_audit:port=5432
 
 NOTE: all parameters are optional, if you don't specify them they will be 
       assigned as specified above(localhost,smbd,smbd001,smbd,5432).

--------------------------------------------------------------------------------
4. Go to ./config/config.php and edit it for your liking.
   That's it. Now just link or copy whole content of this directory to a
   place available by web server and go for it!


NOTE: If mysql is not available user won't be able to connect to the share.
      If your system's national charset is in the other codepage then UTF-8 and 
      you have files with such names - web interface would be messed up.

5. [OPTIONAL] Specify operations to log.

 Module is a clone of full_audit VFS module, so it has capability to skip certain
 operations and avoid filling database with unwanted messages:
 
 Specify mysql_audit
 
  mysql_audit:success = open opendir
  mysql_audit:failure = all
  
 or for pgsql_audit
 
  pgsql_audit:success = open opendir
  gsql_audit:failure = all
 
 success: A list of VFS operations for which a successful completion should
 be logged. Defaults to logging all operations.
 failure: A list of VFS operations for which failure to complete should be
 logged. Defaults to logging everything.
 
 vfs op can be "all" which means log all operations (default behaviour).
 vfs op can be "none" which means no logging or any combination of operations
 you want to log - in example above log "open" and "opendir" on success.
 
