###############################################################################
##    HaCi - IP Address Administration                                        #
##    Copyright (C) 2006-2010 by Lars Wildemann                               #
##    Author: Lars Wildemann <HaCi@larsux.de>                                 #
##                                                                            #
##    HaCi is an IP Address / Network Administration Tool with IPv6 Support.  #
##    It stores its data efficiently in a relational Database and uses a      #
##    treelike Strukture to illustrate supernets and subnets.                 #
##                                                                            #
##    This program is free software; you can redistribute it and#or modify    #
##    it under the terms of the GNU General Public License as published by    #
##    the Free Software Foundation; either version 2 of the License, or       #
##    (at your option) any later version.                                     #
##                                                                            #
##    This program is distributed in the hope that it will be useful,         #
##    but WITHOUT ANY WARRANTY; without even the implied warranty of          #
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
##    GNU General Public License for more details.                            #
###############################################################################

OVERVIEW
  HaCi is a web frontend for administrating networks. It consist of a (perl) CGI and a (mySQL) database as backend.

REQUIRERMENTS
  All you need is a webserver (e.g.: Apache), a database (e.g.: mySQL) and an OS which supports perl.

  - Perl    (check with `perl -M<MODULE> -e 1 2>/dev/null && echo "Ok" || echo "Failed"`)
    - Cache::Cache
    - CGI
    - CGI::Ajax
    - CGI::Carp
    - CGI::Cookie
    - CGI::Session
    - Class::Accessor
    - Class::MakeMethods
    - Config::General
    - DBD::mysql
    - Digest::MD5
    - Digest::SHA
    - DNS::ZoneParse           (optional for importing Zonefiles)
    - Encode
    - Encode::Guess
    - File::Temp
    - HTML::Entities
    - IO::Socket::INET6        (optional for IMAP authentication support)
    - Locale::gettext
    - Log::LogLite
    - Math::BigInt::GMP        (optional, but proposed for more performance!)
    - Math::BigInt v1.87
    - Net::CIDR
    - Net::DNS                 (optional for importing Zonefiles)
    - Net::IPv6Addr
    - Net::Ping                (optional for Ping-Plugin)
    - Net::SNMP
    - Pod::WSDL                (optional for SAOP support)
    - SOAP::Transport::HTTP    (optional for SAOP support)
    - SQL::Translator::Diff    (optional for automatic database upgrade support)
    - SQL::Translator v0.09000 (optional for automatic database upgrade support)
    - Storable
    - Template
    - Text::CSV_XS             (optional for importing CSV-Files)
    - Time::Local
    - Apache::DBI              (optional for getting connection persistence when using mod-perl)
  - HTTP Server
  - SQL Database

  You can use the scripts 'bin/checkPerlDependencies.bash', 'bin/checkPerlOptionals.bash' or the testpage "/cgi-bin/test.cgi" to check for dependencies. 

INSTALLATION
  1)
    First, extract the archiv into a directory, from which the HTTP server will process it and check dependencies.

  2)
    If needed, accommodate the file/directory permissions, so the HTTP server will have no problems.
      <installDir>/logs   : HTTPServer (rwx)
      <installDir>/spool  : HTTPServer (rwx)

  3)
    Modify the HaCi.conf.sample (<installDir>/etc) for your needs. 
    It can be stored either in '/etc/HaCi.conf' or '<installDir>/etc/HaCi.conf'. 
    '/etc/HaCi.conf' has precedence.
    
  4)
    Configure your database and webserver, for serving your new tool. 
    e.g.:
    - MySQL
---------------------- 8< ---------------------
CREATE USER 'HaCi'@'localhost' IDENTIFIED BY '<GEHEIM!>';
GRANT USAGE ON *.* TO 'HaCi'@'localhost' IDENTIFIED BY '<GEHEIM!>';
CREATE DATABASE `HaCi`;
GRANT ALL PRIVILEGES ON `HaCi`.* TO 'HaCi'@'localhost' WITH GRANT OPTION;
---------------------- 8< ---------------------

      - Apache  (httpd.conf)
---------------------- 8< ---------------------
<VirtualHost *:80>
  ServerName  haci.domain.tld
  DocumentRoot  /var/www/HaCi/html
  ScriptAlias   /cgi-bin/  /var/www/HaCi/cgi-bin/

  <Directory /var/www/HaCi/cgi-bin>
    # If you want to use Mod-Perl ---
    PerlRequire   /var/www/HaCi/etc/startup.pl
    SetHandler    perl-script
    PerlHandler   Apache::Registry         # mod-perl1
    PerlResponseHandler ModPerl::Registry  # mod-perl2
    #--------------------------------
    Options       +ExecCGI
    AllowOverride All
    Order         allow,deny
    allow from    all
  </Directory>
</VirtualHost>
---------------------- 8< ---------------------



    - lighttpd
      - standalone (/etc/lighttpd/lighttpd.conf):
---------------------- 8< ---------------------
server.document-root  = "/var/www/HaCi/html"
server.errorlog    = "/var/www/HaCi/logs/error.log"
alias.url    += ("/cgi-bin/" => "/var/www/HaCi/cgi-bin/")
---------------------- 8< ---------------------

      - VHost (/etc/lighttpd/conf-available/20-HaCi.conf):
---------------------- 8< ---------------------
server.modules                 += ( "mod_simple_vhost" )
simple-vhost.server-root        = "/var/www"
simple-vhost.document-root      = "/html/"
simple-vhost.default-host       = "HaCi"
alias.url                      += ( "/cgi-bin/" => "/var/www/HaCi/cgi-bin/" )
---------------------- 8< ---------------------

      - activate CGI
        - Debian:
ln -s /etc/lighttpd/conf-available/10-cgi.conf /etc/lighttpd/conf-enabled/

Edit '/etc/lighttpd/conf-available/10-cgi.conf' and comment the alias-Line out:
# alias.url       += ( "/cgi-bin/" => "/usr/lib/cgi-bin/" )
#
        - SuSE:
          Edit '/etc/lighttpd/modules.conf' and enable following line:
          include "conf.d/cgi.conf"


  5)
    HaCi Daemon (bin/HaCid.pl)
    The HaCi daemon is responsible for the recurrent plugins. It runs them in defined intervals.
    You can start it with the parameter '-c' therewith it exists after one full run and you can start it by crontab.
    The daemon stores its PID in 'spool' and writes its logfile in 'logs'. So it must have write permissions to this directories.


  6)
    HaCiAPI
    HaCi supports a SOAP-Interface for accessing the data not only from the webfrontend but also from a perl/php/... script.
    You can find a short description and a demo perl script in the 'docs' directory.

  
  7)
    Look at 'http://sourceforge.net/projects/haci/' for new releases and
            'http://haci.larsux.de' for a wiki and the latest infos about HaCi.

    For exporting the last CVS version call
    $ cvs -z3 -d:pserver:anonymous@haci.cvs.sourceforge.net:/cvsroot/haci export -D NOW HaCi
  
  8)
    FINISH
  

  9) Additional comments

    Cleanup Database
      'bin/cleanupDatabase.pl'
      This tool checks the database for stale and broken entries. Pass '-c' as parameter in order to cleanup found issues. Please make sure to backup your database before.


AUTHOR
  Lars Wildemann
  haci@larsux.de

# vim:ts=8
