Changeset 417
- Timestamp:
- 06/30/10 17:48:03 (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/CustIDCK.pm
r400 r417 34 34 35 35 return 1 if $custid =~ /^STAFF$/; 36 return 1 if $custid =~ /^ 6750400$/; # just in case some later change might block this36 return 1 if $custid =~ /^5554242$/; # just in case some later change might block this 37 37 return 1 if $custid =~ /^\d{7}$/; 38 38 return 1 if $custid =~ /^\d{10}$/; -
trunk/cgi-bin/IPDB.pm
r416 r417 7 7 # Last update by $Author$ 8 8 ### 9 # Copyright (C) 2004-20 06- Kris Deugau9 # Copyright (C) 2004-2010 - Kris Deugau 10 10 11 11 package IPDB; … … 20 20 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); 21 21 22 $VERSION = 2 .6;22 $VERSION = 2; ##VERSION## 23 23 @ISA = qw(Exporter); 24 24 @EXPORT_OK = qw( … … 53 53 our %IPDBacl; 54 54 55 our $org name = 'Example Corp';55 our $org_name = 'Example Corp'; 56 56 our $smtphost = 'smtp.example.com'; 57 57 our $domain = 'example.com'; 58 our $defcustid = '5554242'; 59 # mostly for rwhois 60 ##fixme: leave these blank by default? 61 our $org_street = '123 4th Street'; 62 our $org_city = 'Anytown'; 63 our $org_prov_state = 'ON'; 64 our $org_pocode = 'H0H 0H0'; 65 our $org_country = 'CA'; 66 our $org_phone = '000-555-1234'; 67 our $org_techhandle = 'ISP-ARIN-HANDLE'; 68 69 our $syslog_facility = 'local2'; 58 70 59 71 # Let's initialize the globals. … … 561 573 # have to insert all pool IPs into poolips table as "unallocated". 562 574 $sth = $dbh->prepare("insert into poolips (pool,ip,custid,city,type)". 563 " values ('$pool', ?, ' 6750400', '$city', '$type')");575 " values ('$pool', ?, '$defcustid', '$city', '$type')"); 564 576 my @poolip_list = $pool->hostenum; 565 577 if ($class eq 'all') { # (DSL-ish block - *all* IPs available … … 618 630 eval { 619 631 $msg = "Unable to deallocate $disp_alloctypes{$type} $cidr"; 620 $sth = $dbh->prepare("update poolips set custid=' 6750400',available='y',".632 $sth = $dbh->prepare("update poolips set custid='$defcustid',available='y',". 621 633 "city=(select city from allocations where cidr >>= '$cidr'". 622 634 " order by masklen(cidr) desc limit 1),". … … 716 728 ##TEMP 717 729 # We've already deleted the block, now we have to stuff its IPs into the pool. 718 my $sth2 = $dbh->prepare("insert into poolips values ('209.91.185.0/24',?,' 6750400','Sudbury','di','y','','','')");730 my $sth2 = $dbh->prepare("insert into poolips values ('209.91.185.0/24',?,'$defcustid','Sudbury','di','y','','','')"); 719 731 $sth2->execute($cidr->addr); 720 732 foreach my $ip ($cidr->hostenum) { … … 849 861 "Subject: {IPDB} $subj\n", 850 862 "X-Mailer: IPDB Notify v".sprintf("%.1d",$IPDB::VERSION)."\n", 851 "Organization: $org name\n",863 "Organization: $org_name\n", 852 864 "\n$message\n"); 853 865 } -
trunk/cgi-bin/MyIPDB.pm
r416 r417 8 8 # Last update by $Author$ 9 9 ### 10 # Copyright (C) 2004-2006 - Kris Deugau 10 # Copyright (C) 2004-2010 - Kris Deugau 11 12 # don't remove! required for GNU/FHS-ish install from tarball 13 ##uselib## 11 14 12 15 use IPDB 2.0 qw(:ALL); … … 24 27 #$IPDB::smtphost = '127.0.0.1'; 25 28 #$IPDB::domain = 'bob.com'; 29 #$IPDB::defcustid = '5554242'; 30 # Globals for db2rwhois.pl 31 #$IPDB::org_street = '123 4th Street'; 32 #$IPDB::org_city = 'Anytown'; 33 #$IPDB::org_prov_state = 'ON'; 34 #$IPDB::org_pocode = 'H0H 0H0'; 35 #$IPDB::org_country = 'CA'; 36 #$IPDB::org_phone = '000-555-1234'; 37 # note: following may also just be a bare email address 38 #$IPDB::org_techhandle = 'ISP-ARIN-HANDLE'; 39 40 # Logging destination. Defaults to local2. See your local syslog docs for valid facilities. 41 # Note that the value here should have the LOG_ prefix removed, and convert to lower-case. 42 # local0 through local7 and user make the most sense. 43 #$IPDB::syslog_facility = 'daemon'; 26 44 27 45 # Keep Perl from complaining. -
trunk/cgi-bin/access-pwd-update.pl
r399 r417 8 8 # Last update by $Author$ 9 9 ### 10 # Copyright (C) 2007 ,2008- Kris Deugau10 # Copyright (C) 2007-2010 - Kris Deugau 11 11 12 12 use strict; 13 13 use warnings; 14 14 use DBI; 15 use lib '/var/www/ipdb.example.com/ip/cgi-bin/'; 15 16 # don't remove! required for GNU/FHS-ish install from tarball 17 ##uselib## 18 16 19 use MyIPDB; 17 20 -
trunk/cgi-bin/admin.cgi
r416 r417 10 10 # Last update by $Author$ 11 11 ### 12 # Copyright (C) 2004-20 06- Kris Deugau12 # Copyright (C) 2004-2010 - Kris Deugau 13 13 14 14 use strict; … … 17 17 use DBI; 18 18 use CommonWeb qw(:ALL); 19 use MyIPDB;20 19 use CustIDCK; 21 20 #use POSIX qw(ceil); … … 23 22 24 23 use Sys::Syslog; 24 25 # don't remove! required for GNU/FHS-ish install from tarball 26 ##uselib## 27 28 use MyIPDB; 25 29 26 30 openlog "IPDB-admin","pid","local2"; … … 149 153 if (!$status) { 150 154 printError("Customer ID not valid. Make sure the Customer ID ". 151 "is correct.<br>\nUse STAFF for staff static IPs, and 6750400for any other ".155 "is correct.<br>\nUse STAFF for staff static IPs, and $IPDB::defcustid for any other ". 152 156 "non-customer assignments."); 153 157 return; -
trunk/cgi-bin/allocate.pl
r198 r417 10 10 use strict; 11 11 use warnings; 12 #use CGI::Carp qw(fatalsToBrowser);13 use Carp;14 12 use DBI; 15 13 use CommonWeb qw(:ALL); 16 use MyIPDB;17 use IBLink;18 use POSIX qw(ceil);19 14 use NetAddr::IP; 20 15 21 16 use Sys::Syslog; 17 18 # don't remove! required for GNU/FHS-ish install from tarball 19 ##uselib## 20 21 use MyIPDB; 22 22 23 23 openlog "IPDBshell","pid","local2"; -
trunk/cgi-bin/checkcusts.pl
r400 r417 7 7 # Last update by $Author$ 8 8 ### 9 # Copyright (C) 2004-20 06Kris Deugau9 # Copyright (C) 2004-2010 Kris Deugau 10 10 11 11 use DBI; … … 33 33 push @def_custids, $data[0]; 34 34 } 35 $sth = $dbh->prepare("select cidr,custid from searchme where not (custid=' 6750400') ".35 $sth = $dbh->prepare("select cidr,custid from searchme where not (custid='$IPDB::defcustid') ". 36 36 "and not (custid='STAFF') order by cidr"); 37 37 #$sth = $dbh->prepare("select cidr,custid from searchme order by cidr"); -
trunk/cgi-bin/combineblocks.pl
r401 r417 14 14 use DBI; 15 15 #use CommonWeb qw(:ALL); 16 use MyIPDB;17 16 #use POSIX qw(ceil); 18 17 use NetAddr::IP; 19 18 20 #use Sys::Syslog; 19 # don't remove! required for GNU/FHS-ish install from tarball 20 ##uselib## 21 22 use MyIPDB; 21 23 22 24 my $null = new NetAddr::IP "255.255.255.255/32"; -
trunk/cgi-bin/consistency-check.pl
r402 r417 8 8 # Last update by $Author$ 9 9 ### 10 # Copyright (C) 2004 - Kris Deugau10 # Copyright (C) 2004-2010 - Kris Deugau 11 11 12 12 use DBI; 13 use NetAddr::IP; 14 15 # don't remove! required for GNU/FHS-ish install from tarball 16 ##uselib## 17 13 18 use MyIPDB; 14 use NetAddr::IP;15 19 16 20 print "Content-type: text/plain\n\n"; … … 230 234 print "Checking for customer blocks with 'bad' CustIDs:\n"; 231 235 # Make sure cn-type ("customer netblock") blocks have "real" CustIDs. 232 $sth = $dbh->prepare("select cidr,type,custid from allocations where type='cn' and (custid=' 6750400' or custid='STAFF') order by cidr");236 $sth = $dbh->prepare("select cidr,type,custid from allocations where type='cn' and (custid='$IPDB::defcustid' or custid='STAFF') order by cidr"); 233 237 $sth->execute; 234 238 while (@data = $sth->fetchrow_array) { -
trunk/cgi-bin/extras/db2rwhois.pl
r380 r417 10 10 # Last update by $Author$ 11 11 ### 12 # Copyright (C) 2004-20 07- Kris Deugau12 # Copyright (C) 2004-2010 - Kris Deugau 13 13 14 14 use strict; … … 16 16 use DBI; 17 17 use NetAddr::IP; 18 use File::Path 'rmtree'; 19 use POSIX qw(strftime); 20 21 # don't remove! required for GNU/FHS-ish install from tarball 22 ##uselib## 23 18 24 use MyIPDB; 19 use File::Path 'rmtree'; 20 21 $ENV{"PATH"} = "/bin;/usr/bin"; 25 26 #$ENV{"PATH"} = "/bin;/usr/bin"; 22 27 23 28 my $rwhoisDataPath = "/etc/rwhoisd"; … … 91 96 print "$masterblocks[$i] $ctime $mtime\n"; 92 97 93 my $date; 94 chomp ($date = `/bin/date +"%Y-%m-%d"`); 98 my $date = strftime("%Y-%m-%d", localtime); 95 99 96 100 my $rwnet = "net-".$masterblocks[$i]->addr."-".$masterblocks[$i]->masklen; … … 111 115 mkdir "$netdatadir/data/referral"; 112 116 113 my $serial ;114 chomp ($serial = `/bin/date '+%Y%m%d'000000000`); 115 117 my $serial = strftime("%Y%m%d%H%M%S000", localtime); 118 119 ##fixme: SOA should be different every time data changes, therefore need to rewrite this ~~ every export :( 116 120 print " Creating SOA...\n"; 117 121 open SOAFILE, ">$netdatadir/soa"; … … 147 151 148 152 print " Copying template files...\n"; 153 ##fixme: find a way to do this without a shell (or functional equivalent) 149 154 qx { /bin/cp $rwhoisDataPath/skel/attribute_defs/* $netdatadir/attribute_defs/ }; 150 155 156 ##fixme: not sure if this is even necessary, since it's not referenced anywhere I can recall... 151 157 print " Creating org data...\n"; 152 open ORGDATAFILE, ">$netdatadir/data/org/ friendlyisp.txt";158 open ORGDATAFILE, ">$netdatadir/data/org/ourorg.txt"; 153 159 print ORGDATAFILE qq(ID: NETBLK-ISP.$masterblocks[$i] 154 160 Auth-Area: $masterblocks[$i] 155 Org-Name: Friendly ISP156 Street-Address: 123 4th Street157 City: Anytown158 State: ON159 Postal-Code: H0H 0H0160 Country-Code: CA161 Phone: 000-555-1234161 Org-Name: $IPDB::org_name 162 Street-Address: $IPDB::org_street 163 City: $IPDB::org_city 164 State: $IPDB::org_prov_state 165 Postal-Code: $IPDB::org_pocode 166 Country-Code: $IPDB::org_country 167 Phone: $IPDB::org_phone 162 168 Created: 20040308 163 169 Updated: 20040308 … … 189 195 "IP-Network: $masterblocks[$i]\n". 190 196 "IP-Network-Block: ".$masterblocks[$i]->range."\n". 191 "Org-Name: Friendly ISP\n".192 "Street-Address: 123 4th Street\n".193 "City: Anytown\n".194 "StateProv: Ontario\n".195 "Postal-Code: H0H 0H0\n".196 "Country-Code: CA\n".197 "Tech-Contact: ISP-ARIN-HANDLE\n".197 "Org-Name: $IPDB::org_name\n". 198 "Street-Address: $IPDB::org_street\n". 199 "City: $IPDB::org_city\n". 200 "StateProv: $IPDB::org_prov_state\n". 201 "Postal-Code: $IPDB::org_pocode\n". 202 "Country-Code: $IPDB::org_country\n". 203 "Tech-Contact: $IPDB::org_techhandle\n". 198 204 "Created: $ctime\n". 199 205 "Updated: $mtime\n". … … 226 232 227 233 # Fill in a generic entry for nameless allocations 228 if ($desc =~ /^\s*$/) { $desc = 'Friendly ISP'; }234 if ($desc =~ /^\s*$/) { $desc = $IPDB::org_name; } 229 235 230 236 # Fix up datestamps. We don't *really* need sub-microsecond resolution on our exports... … … 257 263 "IP-Network: $net\n". 258 264 "IP-Network-Block: ".$net->range."\n". 259 "Org-Name: Friendly ISP\n".260 "Street-Address: 123 4th Street\n".261 "City: Anytown\n".262 "StateProv: Ontario\n".263 "Postal-Code: H0H 0H0\n".264 "Country-Code: CA\n".265 "Tech-Contact: ISP-ARIN-HANDLE\n".265 "Org-Name: $IPDB::org_name\n". 266 "Street-Address: $IPDB::org_street\n". 267 "City: $IPDB::org_city\n". 268 "StateProv: $IPDB::org_prov_state\n". 269 "Postal-Code: $IPDB::org_pocode\n". 270 "Country-Code: $IPDB::org_country\n". 271 "Tech-Contact: $IPDB::org_techhandle\n". 266 272 "Created: $ctime\n". 267 273 "Updated: $mtime\n". … … 281 287 "IP-Network: $net\n". 282 288 "IP-Network-Block: ".$net->range."\n". 283 "Org-Name: ".($name ? $name : 'Friendly ISP')."\n".284 "Street-Address: ".($street ? $street : '123 4th Street')."\n".285 "City: ".($city ? $city : 'Anytown')."\n".286 "StateProv: ".($prov ? $prov : 'Ontario')."\n".287 "Postal-Code: ".($pocode ? $pocode : 'H0H 0H0')."\n".288 "Country-Code: ".($country ? $country : 'CA')."\n".289 "Tech-Contact: ".($tech ? $tech : 'ISP-ARIN-HANDLE')."\n".289 "Org-Name: ".($name ? $name : $IPDB::org_name)."\n". 290 "Street-Address: ".($street ? $street : $IPDB::org_street)."\n". 291 "City: ".($city ? $city : $IPDB::org_city)."\n". 292 "StateProv: ".($prov ? $prov : $IPDB::org_prov_state)."\n". 293 "Postal-Code: ".($pocode ? $pocode : $IPDB::org_pocode)."\n". 294 "Country-Code: ".($country ? $country : $IPDB::org_country)."\n". 295 "Tech-Contact: ".($tech ? $tech : $IPDB::org_techhandle)."\n". 290 296 "Created: $ctime\n". 291 297 "Updated: $mtime\n". -
trunk/cgi-bin/freespace.pl
r320 r417 8 8 # Last update by $Author$ 9 9 ### 10 # Copyright (C) 2004-20 06- Kris Deugau10 # Copyright (C) 2004-2010 - Kris Deugau 11 11 12 12 use DBI; 13 use NetAddr::IP; 14 15 # don't remove! required for GNU/FHS-ish install from tarball 16 ##uselib## 17 13 18 use MyIPDB; 14 use NetAddr::IP;15 19 16 20 ($dbh,$errstr) = connectDB_My; -
trunk/cgi-bin/ipdb.psql
r416 r417 137 137 mi Static IP - Dialup Static dialup IP 23 ISP 138 138 wi Static IP - Wireless Static wireless IP 24 ISP 139 sd Static Pool - Servers Server pool 40 6750400ISP139 sd Static Pool - Servers Server pool 40 5554242 ISP 140 140 cd Static Pool - Cable Cable pool 41 CBL-BUS ISP-STATIC-CABLE 141 141 dp Static Pool - DSL DSL pool 42 DSL-BUS ISP-STATIC-DSL 142 142 mp Static Pool - Dialup Static dialup pool 43 DIAL-BUS ISP-STATIC-DIAL 143 143 wp Static Pool - Wireless Static wireless pool 44 WL-BUS ISP-STATIC-WIFI 144 en End-use netblock End-use netblock 100 6750400ISP144 en End-use netblock End-use netblock 100 5554242 ISP 145 145 me Dialup netblock Dialup netblock 101 DIAL-RES ISP-DIAL 146 146 de Dynamic DSL block Dynamic DSL block 102 DSL-RES ISP-DSL … … 154 154 ad Static Pool - Management Management pool 196 NOC-VPN ISP 155 155 bd Static pool - Wifi CPE Wifi CPE pool 197 ISP 156 in Internal netblock Internal netblock 199 6750400ISP157 wc Reserve for CORE/WAN blocks CORE/WAN blocks 200 6750400ISP158 pc Reserve for dynamic-route DSL netblocks Dynamic-route netblocks 201 6750400ISP-STATIC-DSL159 ac Reserve for ATM ATM blocks 202 6750400ISP160 fc Reserve for fibre Fibre blocks 203 6750400ISP161 wr CORE/WAN block CORE/WAN block 220 6750400ISP156 in Internal netblock Internal netblock 199 5554242 ISP 157 wc Reserve for CORE/WAN blocks CORE/WAN blocks 200 5554242 ISP 158 pc Reserve for dynamic-route DSL netblocks Dynamic-route netblocks 201 5554242 ISP-STATIC-DSL 159 ac Reserve for ATM ATM blocks 202 5554242 ISP 160 fc Reserve for fibre Fibre blocks 203 5554242 ISP 161 wr CORE/WAN block CORE/WAN block 220 5554242 ISP 162 162 pr Dynamic-route DSL netblock (cust) Dynamic-route DSL (cust) 221 ISPCUST 163 163 ar ATM block ATM block 222 ISP 164 164 fr Fibre Fibre 223 ISP 165 rm Routing Routed netblock 500 6750400ISP166 mm Master block Master block 999 6750400ISP165 rm Routing Routed netblock 500 5554242 ISP 166 mm Master block Master block 999 5554242 ISP 167 167 \. 168 168 -
trunk/cgi-bin/main.cgi
r416 r417 7 7 # Last update by $Author$ 8 8 ### 9 # Copyright (C) 2004-2010 - Kris Deugau 9 10 10 11 use strict; … … 13 14 use DBI; 14 15 use CommonWeb qw(:ALL); 15 use MyIPDB;16 16 use CustIDCK; 17 17 use POSIX qw(ceil); … … 19 19 20 20 use Sys::Syslog; 21 22 # don't remove! required for GNU/FHS-ish install from tarball 23 ##uselib## 24 25 use MyIPDB; 21 26 22 27 openlog "IPDB","pid","local2"; … … 956 961 if (!$status) { 957 962 printError("Customer ID not valid. Make sure the Customer ID ". 958 "is correct.<br>\nUse STAFF for staff static IPs, and 6750400for any other ".963 "is correct.<br>\nUse STAFF for staff static IPs, and $defcustid for any other ". 959 964 "non-customer assignments."); 960 965 return; -
trunk/cgi-bin/newcity.cgi
r416 r417 8 8 # Last update by $Author$ 9 9 ### 10 # Copyright (C) 2004 ,2005- Kris Deugau10 # Copyright (C) 2004-2010 - Kris Deugau 11 11 12 12 use strict; … … 15 15 use DBI; 16 16 use CommonWeb qw(:ALL); 17 use MyIPDB;18 17 #use POSIX qw(ceil); 19 18 use NetAddr::IP; 20 19 21 20 use Sys::Syslog; 21 22 # don't remove! required for GNU/FHS-ish install from tarball 23 ##uselib## 24 25 use MyIPDB; 22 26 23 27 openlog "IPDB","pid","local2"; -
trunk/cgi-bin/newnode.cgi
r416 r417 15 15 use DBI; 16 16 use CommonWeb qw(:ALL); 17 use MyIPDB;18 17 #use POSIX qw(ceil); 19 18 use NetAddr::IP; 20 21 19 use Sys::Syslog; 22 20 23 openlog "IPDB","pid","local2"; 21 # don't remove! required for GNU/FHS-ish install from tarball 22 ##uselib## 23 24 use MyIPDB; 25 26 openlog "IPDB","pid","$IPDB::syslog_facility"; 24 27 25 28 # Collect the username from HTTP auth. If undefined, we're in a test environment. -
trunk/cgi-bin/search.cgi
r402 r417 9 9 # Last update by $Author$ 10 10 ### 11 # Copyright 2005 ,2006Kris Deugau11 # Copyright 2005-2010 - Kris Deugau 12 12 13 13 use strict; … … 16 16 use DBI; 17 17 use CommonWeb qw(:ALL); 18 use MyIPDB;19 18 use POSIX qw(ceil); 20 19 use NetAddr::IP; 21 20 22 # Don't need a username or syslog here. syslog left active for debugging. 23 use Sys::Syslog; 24 openlog "IPDBsearch","pid","local2"; 21 # don't remove! required for GNU/FHS-ish install from tarball 22 ##uselib## 23 24 use MyIPDB; 25 25 26 26 # Why not a global DB handle? (And a global statement handle, as well...)
Note:
See TracChangeset
for help on using the changeset viewer.