File: README

package info (click to toggle)
haci 0.98c-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,240 kB
  • sloc: perl: 23,790; javascript: 1,817; sh: 225; makefile: 8
file content (299 lines) | stat: -rw-r--r-- 11,799 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
###############################################################################
##    HaCi - IP Address Administration                                        #
##    Copyright (C) 2006-2015 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/postgreSQL) 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
    - Digest::MD5
    - Digest::SHA
    - Encode
    - Encode::Guess
    - File::Temp
    - HTML::Entities
    - Locale::gettext
    - Log::LogLite
    - Math::BigInt v1.87
    - Net::CIDR
    - Net::IPv6Addr
    - Net::SNMP
    - Storable
    - Template
    - Time::Local
    - DBD::mysql               (for mysql support)
    - DBD::Pg                  (for postgresql support)
    - Apache::DBI              (optional for getting connection persistence when using mod-perl)
    - DNS::ZoneParse           (optional for importing Zonefiles)
    - File::Basename           (optional for XMP-RPC API support)
    - Frontier::Client         (optional for XMP-RPC API support)
    - IO::Socket::INET6        (optional for IMAP authentication support)
    - Math::BigInt::GMP        (optional, but proposed for more performance!)
    - Net::DNS                 (optional for importing Zonefiles)
    - Net::LDAP                (optional for LDAP authentication)
    - Net::Ping                (optional for Ping-Plugin)
    - 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)
    - Text::CSV                (optional for ex/importing CSV-Files)
    - Text::CSV_XS             (optional for faster ex/importing CSV-Files)
    - Time::HiRes              (optional for XMP-RPC API support)
    - JSON                     (optional for RESTWrapper API support)
    - URI::Query               (optional for RESTWrapper API support)
  - 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.
      $ cd /var/www
      $ wget 'http://downloads.sourceforge.net/project/haci/haci/0.98c/HaCi_0.98c.tar.gz'
      $ tar xfzv HaCi_0.98c.tar.gz
      $ HaCi/bin/checkPerlDependencies.bash
      $ HaCi/bin/checkPerlOptionals.bash

  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< ---------------------
      - HaCi will automatically initiate/update the database with the latest schema. If you don't want HaCi to do this by itself, you can import the latest schema dump:
        $ mysql -u HaCi -p HaCi < docs/HaCi_v0.98c.mysql
    - postgresql
      - Execute as postgres super user:
        $ createuser -PSDR HaCi
        $ createdb -O HaCi HaCi
      - Add this line to your 'pg_hba.conf'
        host    HaCi        HaCi        127.0.0.1/32          md5
      - import the database schema dump with the latest version in order to initialize the database
        $ psql HaCi < docs/HaCi_v0.98c.pgsql
      - OR update to a new version (i.e.: from 0.98b to 0.98c):
        $ psql HaCi < docs/HaCi_v0.98b-v0.98c.pgsql

      - postgresql v9.0+: Perhaps you need to set the following variable in your 'postgresql.conf', in order to make ipv6 work:
        bytea_output = 'escape'


    - 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>
  
  # Exclude the soap api interface from the mod-perl handler
  <Files HaCiAPI.cgi>
    SetHandler None
  </Files>

  # Include XML-RPC API
  PerlSwitches -I/var/www/HaCi/modules
  <Location /RPC2>
    SetHandler perl-script
    PerlHandler HaCi::XMLRPC

    # disable compressing, because of problems with chunked transfer encodings
    SetEnv no-gzip
  </Location>

  # Simple REST-Wrapper which itself uses the XMLRPC-API
  <Location /RESTWrapper>
    SetHandler           perl-script
    PerlHandler          HaCi::RESTWrapper
  </Location>

</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 (documentation can be found in /doc)
    - SOAP (deprecated)
    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.
    - XMLRPC
    There is also a XML-RPC API which can be easily integrated into several programming languages. Documentation can be found in the 'docs' directory.
    The following methods can be used:
      - search
      - getFreeSubnets
      - getFreeSubnetsFromSearch
      - addNet
      - editNet
      - delNet
      - assignFreeSubnet
      - getNetworkDetails
      - getSubnets
    - REST
    There is a very basic REST Wrapper which itself uses the XML-RPC-API. 
    The main reason for this is to support tools which can only communicate via REST (i.e.: Table-JSON-Plugin in Confluence).
    The available methods are the same as in the XML-RPC-API.
    Authentication is done via HTTP-Basic-Auth or via "username"- and "password"-Parameters.

  
  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.


 UPGRADE

  1)
    Make a database backup

  2)
    Stop the web server

  3)
    Rename the HaCi-Document-Root
      i.e.:
      $ mv /var/www/HaCi /var/www/HaCi_OLD

  4)
    Get the actual code, extract it and check for new dependencies
      $ cd /var/www
      $ wget 'http://downloads.sourceforge.net/project/haci/haci/0.98c/HaCi_0.98c.tar.gz'
      $ tar xfzv HaCi_0.98c.tar.gz
      $ cd HaCi
      $ bin/checkPerlDependencies.bash
      $ bin/checkPerlOptionals.bash

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

  6)
    Update your database
    e.g.:
    - MySQL
      - HaCi will automatically update the database with the latest schema. If you don't want HaCi to do this by itself, you can do the changes manually
        $ less docs/manualDatabaseUpgrades_mysql.txt
    - postgresql
      - update to a new version (i.e.: from 0.98b to 0.98c):
        $ psql HaCi < docs/HaCi_v0.98b-v0.98c.pgsql

  7)
    Check for new entries in the webserver configuration (Apache example in INSTALLATION step 4)

  8)
    Check for new configuration items in HaCi.conf and synchronize it with your old config (if it doesn't resides in /etc).

  9)
    Start the webserver & FINISH
    The first HaCi request will take some time, because of housekeeping stuff (see in webserver error logfile for more info)


AUTHOR
  Lars Wildemann
  haci@larsux.de

# vim:ts=8