As per subject; server running on maggie.automagic.org. Feedback welcome. Source attached. There are surely bugs. To those who have already seen this, apologies for the duplicates. To use, whois -h maggie.automagic.org blah.co.nz or, if you're using an OpenBSD snapshot more recent than the 2.6 release, whois blah.co.nz which is really a shortcut for whois -h nz.whois-servers.net blah.co.nz or, if you must, fwhois blah.co.nz(a)maggie.automagic.org or you could always use some Windows variant by feverishly clicking buttons and sliding scroll bars, forwarding VBS files to all your friends and relatives whilst distracted by the dancing paperclip. GEEK FAQ 1. Sometimes it looks very much as though I am returning duplicate person objects. However, the technical and holder contact details are not normalised within the glazier schema, and in fact the records where data is stored are quite different. I implemented an elaborate scheme which compared holder and tech details using a (patent-pending) fumbling hack heuristic, but abandoned it as soon as I realised that it's a fool's errand, really. 2. The whois server on whois.patho.gen.nz used "root(a)patho.gen.nz" as the e-mail address in the "changed" fields. This caused all kinds of spam complaints to be directed at that address, so in this new proxy I construct a postmaster address at the domain -- I can't use the real address of the last person to submit a change, since the Glazier system doesn't store it. 3. Check the header comments in each response to see which real server is being queried (this may well change). 4. Before you mail me and say "domain proz.ac.nz doesn't have a tech contact record!" check the authoritative glazier data, because so far that's where all the anomolies I have found actually originate. Don't shoot the messenger. 5. I run this on a BSD box out of tcpserver, using something like tcpserver -q -c 8 -u nobody -g nobody \ 0 whois /usr/local/libexec/whois-domainz.sh & but you could run it out of inetd just as easily. If you attempt to run it on certain (cough) user-friendly linux distribution, you'll have to hack the hideous fwhois syntax around the more correct and elegant "standard" berkeley whois syntax shown in the script (troll, troll). 6. Buffer bounds checking is weak in awk, so I'd advise running the script with no privileges (as above) if you want to run a local copy. 7. I had to use a nasty y2k hack when reformatting the "changed" field, since the Glazier system returns a two-digit year in the dates it returns. 8. The Glazier whois server from which we try to pull our source data has been periodically refusing connections. If we get connection refused, we fall back to using whois.patho.gen.nz (which reports on data from the Waikato system). A "%"-prefixed comment at the top will tell you when this happens. 9. Share and enjoy :) #!/bin/sh # # glazier/domainz whois proxy 0.11 # # I run this out of tcpserver, see http://cr.yp.to/ucspi-tcp/tcpserver.html # which is where TCPREMOTEIP comes from. The server at 202.46.160.18 is # running right now, but may move since I'm not aware that it's an offically- # supported service. # # This proxy is currently running on maggie.automagic.org, if you want # to test it out. Bugs, improvements and baseless legal threats should # be sent to jabley(a)automagic.org. # # This source is public domain. A courtesy tip of the hat would be # appreciated if you manage to make millions whilst using it :) # # Joe Abley, 7 May 2000 whois_glazier=whois.domainz.net.nz whois_waikato=tardis.patho.gen.nz tmp=/var/tmp/whois-glazier.$$ read key key=$(echo ${key} | tr ' ' ' ') echo "% * Proxy connection at $(date) from ${TCPREMOTEIP}" echo "% *" echo "% * Attempting whois from server ${whois_glazier}" echo "% *" if whois -h ${whois_glazier} ${key} 2>/dev/null >${tmp}; then awk -v whois_date="$(date)" -v whois_client="${TCPREMOTEIP}" \ -v whois_key="${key}" -v whois_glazier="${whois_glazier}" ' BEGIN \ { print "% * This data was harvested from a public whois interface"; printf "%% * hosted at %s. Retrieval and use of the data", whois_glazier; print "% * below are subject to the same restrictions and conditions"; print "% * imposed by the source server. No responsibility is taken"; print "% * nor warranty made for the accuracy of the information"; print "% * presented here. Administrative contact for this server"; print "% * is whois(a)automagic.org."; print "% "; printf "%% query: %s\n", whois_key; printf "%% client: %s\n", whois_client; printf "%% date: %s\n", whois_date; print "% "; } { gsub(/\r/, ""); } /^domain_name: / \ { ripe_domain = $2; next; } /^holder_contact: / \ { sub(/^holder_contact: /, ""); ripe_admin_c = $0; next; } /^technical_contact: / \ { sub(/^technical_contact: /, ""); ripe_tech_c = $0; next; } /^ns_name_[0-9][0-9]*: [a-zA-Z0-9]/ \ { ripe_nserver[ns++] = $2; next; } /^holder_name: / || \ /^domain_name_status: / || \ /^registrar: / || \ /^domain_datecreated: / \ { ripe_remarks[rk++] = $0; next; } /^domain_datelastmodified: / \ { sub(/^domain_datelastmodified: /, ""); split($0, field); split(field[1], subfield, /\//); year = (subfield[3] > 70 ? 1900+subfield[3] : 2000+subfield[3]); ripe_changed = sprintf("%4d%02d%02d", year, subfield[2], subfield[1]); next; } /^technical_contact_address_line_[0-9]: / \ { sub(/^technical_contact_address_line_[0-9]: /, ""); if ($0 !~ /^ *$/) ripe_tech_address[tad++] = $0; } /^technical_contact_phone: / \ { sub(/^technical_contact_phone: /, ""); ripe_tech_phone = $0; next; } /^technical_contact_fax: / \ { sub(/^technical_contact_fax: /, ""); ripe_tech_fax = $0; next; } /^technical_contact_email: / \ { sub(/^technical_contact_email: /, ""); ripe_tech_email = $0; next; } /^holder_address: / \ { sub(/^holder_address: /, ""); ripe_admin_address[0] = $0; next; } /^holder_addr_citycountry: / \ { sub(/^holder_addr_citycountry: /, ""); ripe_admin_address[1] = $0; next; } /^holder_phone: / \ { sub(/^holder_phone: /, ""); ripe_admin_phone = $0; next; } /^holder_fax: / \ { sub(/^holder_fax: /, ""); ripe_admin_fax = $0; next; } /^holder_email: / \ { sub(/^holder_email: /, ""); ripe_admin_email = $0; next; } {} END \ { if (ripe_admin_c == "") print "% * no registration data returned by query"; else { printf "domain: %s\n", ripe_domain; printf "admin-c: %s\n", ripe_admin_c; if (ripe_tech_c != "") printf "tech-c: %s\n", ripe_tech_c; for (s in ripe_nserver) printf "nserver: %s\n", ripe_nserver[s]; for (s in ripe_remarks) printf "remarks: %s\n", ripe_remarks[s]; printf "changed: postmaster@%s %s\n", ripe_domain, ripe_changed; printf "source: AUTOMAGIC\n\n"; printf "person: %s\n", ripe_admin_c; for (s in ripe_admin_address) printf "address: %s\n", ripe_admin_address[s]; if (ripe_admin_phone != "") printf "phone: %s\n", ripe_admin_phone; if (ripe_admin_fax != "") printf "fax-no: %s\n", ripe_admin_fax; if (ripe_admin_email != "") printf "e-mail: %s\n", ripe_admin_email; printf "changed: postmaster@%s %s\n", ripe_domain, ripe_changed; printf "source: AUTOMAGIC\n\n"; if (ripe_tech_c != "") { printf "person: %s\n", ripe_tech_c; for (s in ripe_tech_address) printf "address: %s\n", ripe_tech_address[s]; if (ripe_tech_phone != "") printf "phone: %s\n", ripe_tech_phone; if (ripe_tech_fax != "") printf "fax-no: %s\n", ripe_tech_fax; if (ripe_tech_email != "") printf "e-mail: %s\n", ripe_tech_email; printf "changed: postmaster@%s %s\n", ripe_domain, ripe_changed; printf "source: AUTOMAGIC\n"; } } }' ${tmp} rm -f ${tmp} logger -p daemon.info -t whois-glazier query key ${key} \ from ${TCPREMOTEIP} used ${whois_glazier} else echo "% * Connection refused from Domainz/Glazier whois server at" echo "% * ${whois_glazier}; reverting to Domainz/Waikato whois proxy" echo "% * at ${whois_waikato}" echo "% *" whois -h tardis.patho.gen.nz ${key} 2>/dev/null logger -p daemon.info -t whois-glazier query key ${key} \ from ${TCPREMOTEIP} used ${whois_waikato} fi --------- To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz where the body of your message reads: unsubscribe nznog