| 1 | $Id: INSTALL 517 2012-10-18 20:53:10Z kdeugau $ | 
|---|
| 2 |  | 
|---|
| 3 | Requirements | 
|---|
| 4 | ============ | 
|---|
| 5 |  | 
|---|
| 6 | - Any CGI-capable web server that can execute arbitrary files or | 
|---|
| 7 | files with administrator-defineable extensions | 
|---|
| 8 | - PostgreSQL >= 7.4.  It should be possible to (fairly) trivially patch | 
|---|
| 9 | the code for any other DBMS that supports: | 
|---|
| 10 | - an IP address/CIDR netblock data type | 
|---|
| 11 | - higher/greater, lower/less than, contains, and is-contained-by | 
|---|
| 12 | operators | 
|---|
| 13 | - Perl >= 5.6 | 
|---|
| 14 | - Standard modules: | 
|---|
| 15 | These should be included in any base Perl install | 
|---|
| 16 | - File::Path | 
|---|
| 17 | - CGI::Carp | 
|---|
| 18 | - POSIX | 
|---|
| 19 | - Sys::Syslog | 
|---|
| 20 | - Extra modules: | 
|---|
| 21 | - NetAddr::IP >= 4.x.  3.x may work, however 4.x has been out for | 
|---|
| 22 | more than 4 years. | 
|---|
| 23 | - DBI | 
|---|
| 24 | - DBD::Pg | 
|---|
| 25 | - Sys::SigAction.  This isn't strictly required;  it's used in an | 
|---|
| 26 | example hook for validating customer IDs against an external | 
|---|
| 27 | database.  It could arguably be replaced with sigaction() from the | 
|---|
| 28 | POSIX module when using Perl >= 5.8.2.  See eg Sys::SigAction on | 
|---|
| 29 | CPAN (http://search.cpan.org/~lbaxter/Sys-SigAction-0.11/lib/Sys/SigAction.pm) | 
|---|
| 30 | for some thoughts on the gritty details. | 
|---|
| 31 |  | 
|---|
| 32 | Installing the IPDB | 
|---|
| 33 | =================== | 
|---|
| 34 |  | 
|---|
| 35 | 1) Untar in a convenient location.  You should be able to simply use the | 
|---|
| 36 | unpacked tarball as-is, or you can run "make install" to install files | 
|---|
| 37 | in /usr/local/lib/ipdb-#VERSION#, with configuration modules in | 
|---|
| 38 | /usr/local/etc/ipdb-#VERSION#. | 
|---|
| 39 |  | 
|---|
| 40 | The Makefile supports substitution on most standard | 
|---|
| 41 | GNU/FHS-ish paths, so you could also run: | 
|---|
| 42 |  | 
|---|
| 43 | make install prefix=/opt | 
|---|
| 44 |  | 
|---|
| 45 | to install it under /opt. | 
|---|
| 46 |  | 
|---|
| 47 | The Makefile also supports DESTDIR for packaging, so you can use: | 
|---|
| 48 |  | 
|---|
| 49 | make install libdir=/usr/lib sysconfdir=/etc DESTDIR=/tmp/ipdbpkgroot | 
|---|
| 50 |  | 
|---|
| 51 | to install for packaging under /tmp/ipdbpkgroot with the core scripts | 
|---|
| 52 | and HTML packaged under /usr/lib/ipdb-#VERSION#, and the configuration | 
|---|
| 53 | modules packaged under /etc/ipdb-#VERSION#. | 
|---|
| 54 |  | 
|---|
| 55 | 2) Configuration:  These module files will either be in the cgi-bin/ | 
|---|
| 56 | directory from the unpacked tarball, or /usr/local/etc/ipdb-#VERSION# | 
|---|
| 57 | if installed with 'make install'. | 
|---|
| 58 | a) Edit MyIPDB.pm:  you need to set the database DSN and | 
|---|
| 59 | company info.  You should probably also set the syslog facility and | 
|---|
| 60 | default custid. | 
|---|
| 61 | b) Edit CustIDCK.pm as needed to validate customer IDs. | 
|---|
| 62 |  | 
|---|
| 63 | 4) Create the database, and the inital tables using cgi-bin/ipdb.psql. | 
|---|
| 64 |  | 
|---|
| 65 | 5) Configure your webserver to call the IPDB scripts at an appropriate | 
|---|
| 66 | web path.  A webroot pointing to the HTML files (first level under | 
|---|
| 67 | the ipdb-#VERSION#/ tarball directory, or /usr/local/lib/ipdb-#VERSION#) | 
|---|
| 68 | should work fine;  a server alias under an existing virtual host should | 
|---|
| 69 | work as well. | 
|---|
| 70 |  | 
|---|
| 71 | Set $IPDB::webpath (the web path to your IPDB install) in MyIPDB.pm. | 
|---|
| 72 | Straight out of the tarball it should work at the webroot, but if you | 
|---|
| 73 | want it in a subdirectory, you'll need to set this variable to get all | 
|---|
| 74 | of the internal links to behave properly. | 
|---|
| 75 |  | 
|---|
| 76 | The directory containing the HTML and scripts must have at least the | 
|---|
| 77 | following Apache directives (or other server equivalent) set: | 
|---|
| 78 |  | 
|---|
| 79 | Options ExecCGI IncludesNoEXEC | 
|---|
| 80 |  | 
|---|
| 81 | 6) User lists can be maintained two basic ways: | 
|---|
| 82 |  | 
|---|
| 83 | a) Use the built-in user manager to add and remove users.  This | 
|---|
| 84 | requires mod_auth_pgsql, configured with read/write access to the | 
|---|
| 85 | IPDB users table.  A default user admin, password admin, is created | 
|---|
| 86 | in step 4 above - make sure to create a new user as an admin, and | 
|---|
| 87 | remove the default user (or at least change its password). | 
|---|
| 88 |  | 
|---|
| 89 | b) Maintain an external .htpasswd file of your own, configured and | 
|---|
| 90 | maintained however you like.  In this case the access-pwd-update.pl | 
|---|
| 91 | script should edited to match the .htpasswd filename/path and should | 
|---|
| 92 | be called from cron to make sure new users get added to the | 
|---|
| 93 | database, and old ones get deleted.  This extra maintenance of user | 
|---|
| 94 | lists is necessary to support the access controls, which are stored | 
|---|
| 95 | in the database. | 
|---|
| 96 |  | 
|---|
| 97 | You will have to either temporarily create a user "admin", so that user | 
|---|
| 98 | can grant other users priviledges, or run the following on the database: | 
|---|
| 99 |  | 
|---|
| 100 | UPDATE users SET acl='bacdsA' WHERE username='newadminuser'; | 
|---|
| 101 |  | 
|---|
| 102 | Replace 'newadminuser' as appropriate. | 
|---|
| 103 |  | 
|---|
| 104 | If you don't do this, nobody will be able to make any changes; | 
|---|
| 105 | access-pwd-update.pl only grants minimal read access to new users. | 
|---|
| 106 |  | 
|---|
| 107 | 7) (optional) Pick a log facility by setting $IPDB::syslog_facility in | 
|---|
| 108 | MyIPDB.pm, and tweak your syslog configuration to direct IPDB logging | 
|---|
| 109 | to a custom log.  Most logging is at the level of "info" or "warn". | 
|---|
| 110 | Full changes are not logged.  Logging verbosity isn't very high, so it | 
|---|
| 111 | may be acceptable to leave the log stream at the defaults. | 
|---|
| 112 |  | 
|---|
| 113 | --- | 
|---|
| 114 |  | 
|---|
| 115 | Basic installation should now be complete!  Log in as an admin user, | 
|---|
| 116 | add your ARIN, RIPE, LACNIC, AfriNIC, or APNIC allocations and start | 
|---|
| 117 | documenting your netblock usage. | 
|---|
| 118 |  | 
|---|
| 119 | If you want to export rWHOIS data, see http://www.unixadmin.cc/rwhois/ | 
|---|
| 120 | for a place to start on setting up an rWHOIS server.  Note that | 
|---|
| 121 | db2rwhois.pl creates and maintains the net-<cidr> trees, all you have | 
|---|
| 122 | to do is configure the daemon itself.  Schedule runs of | 
|---|
| 123 | cgi-bin/extras/db2rwhois.pl followed by rwhois_indexer (every hour | 
|---|
| 124 | should be plenty often).  You'll need to fill in correct organization | 
|---|
| 125 | contact info in MyIPDB.pm. | 
|---|
| 126 |  | 
|---|
| 127 | If you're just running from the unpacked tarball directory, you may need | 
|---|
| 128 | to create symlinks in cgi-bin/extras/ for IPDB.pm and MyIPDB.pm, | 
|---|
| 129 | pointing to ../IPDB.pm and ../MyIPDB.pm respectively.  Otherwise | 
|---|
| 130 | db2rwhois.pl won't be able to find these modules. | 
|---|