#! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'Manifest' <<'END_OF_FILE' X-r--r--r-- 1 dank 10574 Aug 1 19:17 INSTALL X-r--r--r-- 1 dank 7130 Aug 1 19:19 INSTALL.QI X-r--r--r-- 1 dank 4443 Aug 1 19:10 Makefile X-r--r--r-- 1 dank 8741 Aug 1 20:11 README X-r--r--r-- 1 dank 232 Jul 31 00:13 addhostname.awk X-r-xr-xr-x 1 dank 1568 Jul 31 00:13 dig_ls_hosts.sh X-r--r--r-- 1 dank 1857 Aug 1 19:07 dot.plan X-r--r--r-- 1 dank 5362 Aug 1 19:06 horton-qi.perl X-r--r--r-- 1 dank 10 Jul 31 00:13 hosts.exclude X-r--r--r-- 1 dank 166 Jul 31 00:13 hosts.xlat X-r--r--r-- 1 dank 3676 Aug 1 19:09 hourly.sh X-r-xr-xr-x 1 dank 264 Jul 31 00:13 lower.sh X-r--r--r-- 1 dank 304 Jul 31 00:13 ls_finger.awk X-r--r--r-- 1 dank 1275 Jul 31 20:09 ls_finger.sh X-r-xr-xr-x 1 dank 3023 Jul 31 00:13 ls_hosts.sh X-r-xr-xr-x 1 dank 2467 Jul 31 00:13 ls_mail.sh X-r--r--r-- 1 dank 3794 Aug 1 19:08 monthly.sh X-r--r--r-- 1 dank 1049 Jul 31 00:13 nukefortune.awk X-r--r--r-- 1 dank 743 Aug 1 20:13 patchlevel.h X-rw-r--r-- 1 dank 5318 Aug 1 15:31 phquery/Makefile.orig X-rw-r--r-- 1 dank 704 Aug 1 14:48 phquery/README X-rw-r--r-- 1 dank 184 Aug 1 15:36 phquery/README.TOO X-rw-r--r-- 1 dank 3074 Aug 1 14:48 phquery/cdefs.h X-rw-r--r-- 1 dank 1520 Aug 1 14:48 phquery/dconn.c X-rw-r--r-- 1 dank 9831 Aug 1 14:48 phquery/malloc.c X-rw-r--r-- 1 dank 4995 Aug 1 14:48 phquery/messages.h X-rw-r--r-- 1 dank 6046 Aug 1 14:48 phquery/phquery.8 X-rw-r--r-- 1 dank 44505 Aug 1 18:43 phquery/phquery.c X-rw-r--r-- 1 dank 8640 Aug 1 14:48 phquery/phquery.h X-rw-r--r-- 1 dank 1934 Aug 1 14:48 phquery/sendmail.diffs X-rw-r--r-- 1 dank 437 Aug 1 16:08 phquery/sendmail.h X-r--r--r-- 1 dank 823 Jul 31 00:13 pickone.awk X-rw-r--r-- 1 dank 1299 Aug 1 17:37 popmods/README X-rw-r--r-- 1 dank 853 Aug 1 17:31 popmods/pop_lastlog.c X-rw-r--r-- 1 dank 2036 Aug 1 17:31 popmods/pop_pass.c X-r--r--r-- 1 dank 873 Aug 1 19:08 privacy.mail X-r--r--r-- 1 dank 492 Jul 31 00:13 probe.mail X-r--r--r-- 1 dank 2512 Jul 31 00:13 quick_smtp.c X-r--r--r-- 1 dank 3597 Jul 31 00:13 quickfinger.c X-r--r--r-- 1 dank 799 Jul 31 00:13 recvmail.awk X-r--r--r-- 1 dank 2484 Jul 31 00:13 sortdate.awk X-r--r--r-- 1 dank 346 Jul 31 00:13 toshort.awk X-r--r--r-- 1 dank 2223 Jul 31 00:13 whoisd.c END_OF_FILE if test 2546 -ne `wc -c <'Manifest'`; then echo shar: \"'Manifest'\" unpacked with wrong size! fi # end of 'Manifest' fi if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(8741 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' Xhorton - an e-mail directory daemon, whois/ph server, and fuzzy mail forwarder X@(#)README 2.3 8/1/92 X XSYNOPSIS X Invoke hourly.sh and monthly.sh from crontab X Invoke in.whoisd and horton-qi from inetd X XINTRODUCTION X Horton automatically and silently creates a electronic mail address X directory by 'finger'ing each host in your domain periodically, X and lets users look up e-mail addresses with the 'whois' command. X If your company or university doesn't yet have an e-mail directory, X this package will provide you with one without much effort on your part. X It can also be a useful adjunct to a manually maintained e-mail directory, X because it is always up to date, whereas the manually maintained one can X lag weeks or months behind changes in the real world. (e.g. Caltech has X both a manual whois server and a Horton whois server.) X X Besides accepting whois queries, Horton can also forward mail addressed X to John-Miller@horton to the most recent e-mail address for John Miller X in the whois database. This is sometimes called fuzzy name lookup. X Horton can, as a side effect, also accept ph queries. X X The command X whois -h horton_server search_key X where X horton_server is the name of the computer running Horton X search_key is all or part of a person's name X lists all people whose name or username match the pattern. X X Look at dot.plan, or ~horton/.plan, for more info about how to access X the database. X XENVIRONMENT X Horton runs under Unix, and has been tested with SunOS 4.1.1 and X partially tested with HP/UX and NeXT Mach 2.0. X It requires sh, csh, and TCP/IP, and relies on other machines (possibly X VMS systems) to respond to Finger requests. X The mail forwarding feature requires sendmail and the Perl interpreted X language; the installation instructions mention where to obtain Perl. X XLIMITATIONS X The ph searching is slow, and personal names are restricted to 19 chars. X XPATCHLEVEL X This is horton-2.2, patchlevel 1. X It supercedes horton-1.8, which was comp.sources.misc Volume 31, Issue 38. X XCOPYRIGHT STATUS X This software is in the public domain, except for quickfinger.c and X quick_smtp.c, which are partly derived from publicly available X Berkeley Unix networking sources. X XIMPLEMENTATION X Horton simply runs 'finger @host' on a predetermined set of X computers, and keep track of who logs in where. X It works with the finger services provided by NeXTs, Suns, X and even VMS systems running Multinet. X X It also runs 'finger user' on all the users of the local X computer; this is meant to catch users who never log X in but rather check their mail with Eudora via POPmail. X (POPmail has to be modified to update /var/adm/lastlog for X this to have any effect; see popmods/README.) X X A hacked version of finger which times out after ten seconds X is used to avoid locking up when probing unknown hosts. X X All four daemons (hourly.sh, monthly.sh, in.whoisd, and horton-qi) X should be run by the psuedouser 'horton'. Except during the execution X of monthly.sh, horton's mail is forwarded to the Horton Administrator. X The Administrator's name, phone number, and e-mail address are set in X Makefile, copied to the pseudouser's .plan file, and broadcast by X monthly.sh. X X X Installation of hourly.sh, in.whoisd, and monthly.sh is documented in X INSTALL. X X monthly.sh is run from crontab to determine which hosts to poll; it X updates the file hosts.poll. It reads the file hosts.exclude X and avoids polling or probing any of those hosts, addresses, or X networks. Only hosts that support finger, SMTP or MX mail, and X are able to use source routing to send a message through their machine X are added to hosts.poll; a message is sent to postmaster at each X site added to hosts.poll to inform them that their machine is now X being monitored by Horton. The message describes how to use the X database, and how to contact the Administrator in case of trouble. X Hosts that are already in hosts.poll stay in hosts.poll until X removed manually. X X hourly.sh is run from crontab. It reads hosts.poll, polls those hosts X with finger, updates hourly.dat (the e-mail addreass database), and X creates hourly.out (a tabs-expanded copy of the database). X Names are rewritten from Last, First to First Last for consistent X searching. X X in.whoisd is a server that accepts search patterns from clients X running the program 'whois', and runs egrep on the database file. X It is invoked by inetd, and takes one argument: the data file to search. X X X Installation of horton-qi and phquery is documented in INSTALL.QI. X X horton-qi is an optional server that accepts ph queries from clients X running the programs 'ph' or 'phquery'; it is a Perl program which X searches the name field of the database file and returns the address of X the named person's most recently used mailbox. X It is invoked by inetd, and takes one argument: the data file to search. X X phquery is the optional fuzzy address resolver; it accepts messages from X sendmail, looks up the To: address in the name field of the database by X connecting to horton-qi, and reinvokes sendmail to deliver the message X to the named person. X XINPUT FILES X hosts.xlat must exist and must be nonempty. X When you have Horton up and running, you will want to edit this X file to add one line for each machine which remote mounts /var/spool/mail X from another machine; the first word on the line is the client name, X the second word on the line is the server name. X Horton uses this info to report all users on the clients as if they X only ever logged in to their server; this reduces the confusion of X the user who is trying to decide which of the machines to send mail to. X X For example, if sparky and rover mount /var/spool/mail from dog, X you should add the following lines to hosts.xlat: X sparky.podunk.edu dog.podunk.edu X rover.podunk.edu dog.podunk.edu X X hosts.exclude must exist and must be nonempty. Use this file X to exclude hosts that don't want to be disturbed in any way X by automatic fingering or mail-probing. It can contain X hostnames or IP addresses. These are matched with fgrep -v, X so partial names or addresses will act like wildcards. X Careful, or you may exclude more hosts than you intend. X The format is one pattern per line: X scratchy.podunk.edu X 128.149.77. X 128.149.80.5 X X hosts.test should only exist during testing of monthly.sh. X If it exists, monthly.sh does not probe hosts whose names are X not in hosts.test; also, only 20 seconds are allowed for mail X probes to return instead of the usual 1000. This takes some X of the hassle out of testing. X XOUTPUT FILES X hosts.poll lists the hosts to query with finger, one per line, e.g. X sparky.podunk.edu X dog.podunk.edu X rover.podunk.edu X It is updated by monthly.sh, but you can add lines to it manually, too. X X The revolving output data file is hourly.dat, which is in the format X user@host.podunk.edu full name last date logged in X where the columns are separated by tabs. X It is both read and written by hourly.sh, and read by horton-qi. X X The same data is placed in hourly.out, but with tabs expanded to spaces. X It is written by hourly.sh, and read by in.whoisd. X XSECURITY X You may wish to restrict whois server access to local hosts. This X can be done with log_tcp, a great TCP/IP access control package X available from many ftp hosts. X X It is wise to make your local computers fairly secure before X letting the outside world see your whois database. X XBUGS X Truncates long names, such as Barbara Horner-Miller, at 19 X characters! X X Works with the finger output I've seen, but might not work X with other finger daemons, such as Charon's. X X monthly.sh will ignore hosts that refuse to deliver X non-local mail but support finger, such as Charon. X XSEE ALSO X Qi/Doc/Protocol.lpr in uxc.cso.uiuc.edu:/pub/qi.tar.Z for a X description of the CSO Name Server protocol used by qi, ph, and phquery. X X sipb.mit.edu:/pub/whois/whois-servers.list for a list of known X whois servers on the Internet. X X uwho: a metawhois which searches first for a whois server, then X for the person you're looking for. Submitted to comp.sources.reviewed. X Probably the easiest way to make use of the above list of known X whois servers, and a good tool to give your users to access your X own whois database. X XAUTHORS X Daniel Kegel X Heather L. Sherman (the digmeister) END_OF_FILE if test 8741 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'INSTALL' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'INSTALL'\" else echo shar: Extracting \"'INSTALL'\" \(10574 characters\) sed "s/^X//" >'INSTALL' <<'END_OF_FILE' XInstall notes for horton. XPlease read README first. X@(#)INSTALL 2.3 8/1/92 X X1. Pick a name for the pseudouser that will run the daemon, preferably horton. X Choose a working directory, preferably /home/horton/etc. X Pseudouser must own this directory and its contents. X Edit Makefile to set value of DIR to the working directory, X the ADMINISTRATOR's name, TELEPHONE_NUMBER, and E-MAIL-ADR, X and the server's DOMAIN and HOSTNAME. X X If your host is a POPmail host, you may wish to activate X the 'local users' loop in hourly.sh (see popmods/README). X If pseudouser is not horton, edit the .plan file to reflect the name. X X2. As root, create the pseudouser. X % su X # /usr/etc/install/add_user horton 99 999 "Horton T. Elefant" /home/horton /bin/csh X X3. Become the pseudouser, create directories for the source and datafiles, X unpack this software, then compile and install the software. X % su horton X %% cd /home/horton X %% mkdir src etc X %% cd src X %% /bin/sh PATH/horton.shar X %% make X %% make install X %% make clean X X4. Normally, Horton runs monthly.sh to update hosts.poll, the list of X computers to monitor for users. For now, just create that file by X hand, listing your own computer and a couple others that you know X allow finger requests: X %% cat > hosts.poll X myhost.podunk.edu X otherhost.podunk.edu X ^D X X5. Horton's main activity is to run the shell script hourly.sh once per X hour or so to finger all the hosts in hosts.poll. X Put hourly.sh in horton's crontab, and set it to run two minutes from X now: X %% crontab -e X 59 8-18 * * * /bin/nice /home/horton/etc/hourly.sh /home/horton/etc >/tmp/horton_h.log 2>&1 X X Replace /home/horton/etc with the working directory you selected in step 1; X replace podunk.edu with your domain's name, and X replace 59 with the current minute + 2. X X When hourly.sh starts running, watch /tmp/horton_h.log: X tail -f /tmp/horton_h.log X If no obvious error messages occur in the first minute or two, X let it finish (this takes about 10 minutes), then check the file X hourly.out. It should have good usernames and addresses in it, X possibly mixed with a few garbage entries from overeager fingerd's. X For instance, X root@myhost.podunk.edu ??? Thu Jul 23 1992 X yang@myhost.podunk.edu Betty Yang Mon Jul 27 1992 X rodent@otherhost.podunk.edu Moe Rodent Fri Jul 24 1992 X If it looks reasonable, Horton is probably collecting data OK. X X6. Enable the daemon that responds to user requests for information. X Become root and edit /etc/inetd.conf: X % su X # vi /etc/inetd.conf X Add the line X whois stream tcp nowait nobody /home/horton/etc/in.whoisd in.whoisd /home/horton/etc/hourly.out X substituting your chosen directory for /home/horton/etc. X X Cause it to take effect by sending inetd a kill -HUP, e.g. X ps augx | grep inetd X kill -1 nnnn X X7. Verify that daemon is handling requests. If you have 'whois', type X % whois -h localhost @ X Otherwise, type X % telnet localhost 43 X @ X ^D X X It should print out the contents of hourly.out (the daemon just uses X egrep, and every line in hourly.out has a @ in it). X X8. OK! Now you know that Horton is basically working. But at this point X it is only checking the few hosts that you entered by hand in hosts.poll. X If your domain has more than a few computers, you'll want Horton to X discover eligible computers itself. (This is a real labor-saver for X networks of hundreds of computers.) X First, however, you should face the fact that the information Horton X gathers can be sensitive. You should decide whether to allow other domains X to access your e-mail directory. If the answer is 'no', then you must X control access somehow; on HP-UX systems, you can just edit X /usr/adm/inetd.sec and add a line like X whois allow *.podunk.edu 128.149.* X Otherwise, you have to install log_tcp, a great TCP/IP access control X package available as the file log_tcp_4.2.shar.Z from many ftp hosts, X including X (host) (directory) X ftp.uu.net /pub/security X ftp.waseda.ac.jp /pub/security/othertools X iraun1.ira.uka.de /security X svin02.info.win.tue.nl /pub/security X X It may be wise to make your local computers fairly secure before X letting the outside world see your whois database. Installing X log_tcp to restrict outside login access, installing npasswd to X prevent users from picking lame passwords, running COPS periodically X to flush out random security holes, and keeping up-to-date on X security patches from your OS vendor would go a long way towards X preventing breakins at your site. X X9. (optional) I suggest you create an alias 'horton' in your network's X DNS host tables for the server machine. This lets you move the whois X server to a different machine without making people relearn the X server's address. X X10. Since Horton is a 90's sorta guy, he is polite, and notifies the X postmaster at each newly found computer by sending the letter X 'privacy.mail'. (People like to know about little things like X automatic surveilance deamons monitoring their computers!) X This file also should explain how to use the directory, and how X to get a host excluded from the directory. X Edit privacy.mail to describe your access policy, and to advertise X any tools you have to offer users for accessing the directory. X %% vi privacy.mail X X11. The best way for Horton to find computers is with the program 'dig'. X If your domain uses DNS and has delegated subzones (only large domains X tend to do this) or has some hosts that are on the Internet but use DNS X MX records to forward their mail to some other host, for best results X you should install the program 'dig' before running monthly.sh. X Dig can be obtained by FTPing the file dig.2.0.tar.Z from one of: X ftp.uu.net /networking/ip/dns X munnari.oz.au /pub/net X aix1.segi.ulg.ac.be /pub/unix X clouso.crim.ca /pub X ftp.uni-kl.de /pub1/unix/networking/dns X funet.fi /networking/domain X imag.imag.fr /archive/tcp-ip/bind.resolver X relay.iunet.it /disk0/network/DNS X toklab.ics.osaka-u.ac.jp /UUNET91/vol7/networking X ifi.uio.no /pub X src.doc.ic.ac.uk /comms/tcpip/nameserver X mcsun.eu.net /network X For small domains that don't use MX records, monthly.sh should work X fine without dig. X X12. Test monthly.sh as follows: X A. Become the psuedouser, and cd to the ETC directory you selected in step 1. X % su horton X %% cd X %% cd etc X X B. Create a file 'hosts.test' containing just your own hosts- X that way you won't bother anyone else until you have Horton X operational. X %% cat > hosts.test X myhost.podunk.edu X myotherhost.podunk.edu X ^D X X C. Run monthly.sh, giving your domain's name (not your hostname): X %% ./monthly.sh podunk.edu . >& log & X %% tail -f log X X It should finish in about forty seconds. If everything ran ok, X the file 'hosts.poll' should list the same computers as 'hosts.test' X (possibly in a different order or with alternate names), and X the postmasters at the systems you listed should have gotten a message X saying that their systems are now being polled by Horton. X X If everything looks fine, delete hosts.test, and go on with step D. X Otherwise skip to step E. X X D. If you got this far, then monthly.sh will probably work. X Run it for real this time to create a full hosts.poll and notify X all the hosts being polled. X X Put monthly.sh in horton's crontab, and set it to run two minutes from X now: X %% crontab -e X 59 23 7 * * /bin/nice /home/horton/etc/monthly.sh podunk.edu /home/horton/etc >/tmp/horton_m.log 2>&1 X Replace /home/horton/etc with the working directory you selected in step 1; X replace podunk.edu with your domain's name; X replace 7 with the current day of the week, X replace 23 with the current hour, and X replace 59 with the current minute + 2. X X When monthly.sh starts running, watch /tmp/horton_m.log: X %% tail -f /tmp/horton_m.log X If no obvious error messages occur in the first minute or two, X let it finish (this takes an hour or so), then check the file X hosts.poll; it should list all the hosts that support finger AND X properly handle e-mail, which should be most of the Unix X and many of the VMS hosts in your domain. X X If hosts.poll looks OK, then monthly.sh ran OK, and you can go on X to the next step. Otherwise, disable the crontab entry. X X E. If something went wrong in steps B, C, or D, or monthly.sh doesn't X find any of your computers, something is wrong with either the scripts X or your mail system; report the problem to the author, and create X hosts.poll manually instead of with monthly.sh. X X13. Some of the sysops who receive the automatically generated letter X sent out by monthly.sh, and others who notice Horton's incessant X fingering, may wish to be excluded from the directory. X Add their name or internet address to hosts.exclude, and delete X them from hosts.poll. X X14. If some hosts are e-mail clients of another host, and you wish to X reduce the ambiguity of the directory, add clientname servername X pairs to hosts.xlat. X X15. (optional) Set the default server for whois queries to be 'horton'. X You can do this by renaming the original whois to be whois.orig, X installing the shell script X #!/bin/sh X if [ _$1 = -h ]; X then X /usr/ucb/whois.orig $* X else X /usr/ucb/whois.orig -h horton $* X fi X exit 0 X X in place of the original whois on all clients. X X Better yet, get and install the program 'uwho', soon to appear in X comp.sources.reviewed. X X15. (optional) X If you decided to allow other domains to access your whois server, X send e-mail to mhpower@athena.mit.edu to announce it. X Matt H. Power of MIT has compiled and X maintains an extensive list of sites that run "whois" servers. The X file can be retrieved via anonymous ftp from X /pub/whois/whois-servers.list on sipb.mit.edu [18.70.0.224]. X The program 'uwho' uses a local copy of this list, and can automatically X retrieve a new copy upon command. X X16. (optional) Continue with the file INSTALL.QI to enable ph query support X and fuzzy mail forwarding. X X*end* END_OF_FILE if test 10574 -ne `wc -c <'INSTALL'`; then echo shar: \"'INSTALL'\" unpacked with wrong size! fi # end of 'INSTALL' fi if test -f 'INSTALL.QI' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'INSTALL.QI'\" else echo shar: Extracting \"'INSTALL.QI'\" \(7130 characters\) sed "s/^X//" >'INSTALL.QI' <<'END_OF_FILE' X@(#)INSTALL.QI 2.1 8/1/92 X XBesides accepting whois queries, Horton can also forward mail addressed Xto John-Miller@horton to the most recent e-mail address for John in the Xwhois database. Horton can, as a side effect, also accept ph queries. XThe steps needed to install ph support and mail forwarding are listed below. X XPh is the client program used by the CSO Name Server program 'qi'. Xqi is becoming popular as an online campus telephone/e-mail directory Xwhich can be updated by the users. XThe main advantage of supporting ph from Horton's point of view is Xthat ph responses provide tagged information, i.e. e-mail addresses Xare easily extracted from them, and that Paul Pomes has written a program, Xphquery, that lets Sendmail implement fuzzy mail forwarding. XYou can get the latest version of phquery from uxc.cso.uiuc.edu in Xmail/sendmail/uiuc, but I've included a copy of phquery version 3.14 X(modified to compile without the rest of sendmail) in the directory phquery. XYou can get more information on ph and qi from the newsgroup info.ph, Xor by downloading the file qi.tar.Z via anonymous FTP from the following Xhosts (and perhaps others): X (host) (directory) X uxc.cso.uiuc.edu /pub X ccadfa.cc.adfa.oz.au /pub/net X svin02.info.win.tue.nl /pub/archives X uts.mcc.ac.uk /pub/src X XThis document describes how to enable Horton's ph query interface, and Xhow to modify a SunOS sendmail.cf file to do fuzzy name resolution. X X1. Horton's ph support and mail forwarding feature requires Perl. X If you don't have Perl, you can get it via anonymous ftp from X (host) (directory) X ftp.uu.net /languages/perl/perl.tar.Z X convex.com /pub/perl/perl.tar.Z X nuri.inria.fr /lang/perl/perl-4.034.tar.Z X theta.iis.u-tokyo.ac.jp /GNU/perl-4.034.tar.Z X walhalla.germany.eu.net /pub/gnu/perl-4.034.tar.Z X You may as well install it now, since so many people are starting X to use it. X X2. Figure out what your computer calls the protocol used by ph. X Become the superuser. X Look at /etc/services or your NIS map services.byname, and find the X name of the service for 105/tcp (it will be either ns or csnet-ns). X If there is none, add the line X csnet-ns 105/tcp X to your services file. X X3. Enable the daemon. X Add the line X ns stream tcp nowait nobody perl perl DIR/horton-qi DIR/hourly.dat X to /etc/inetd.conf, replacing DIR with Horton's working directory, X usually /home/horton/etc, and prefixing the first perl with the path X to perl on your system. X X4. Enable Internet access to the daemon, if needed. X On HP/UX systems with inetd access control, edit /usr/adm/inetd.sec X and add a line like X csnet-ns allow *.podunk.edu 128.149.* X (replace csnet-ns with ns if that's what you found in /etc/services) X to allow local access, or X csnet-ns allow X to allow the whole Internet to read your directory. X X On systems with log_tcp access control installed, edit /etc/hosts.allow X and add the line X horton-qi: .podunk.edu, 128.149. X to allow local access, or X horton-qi: ALL X to allow the whole Internet to read your directory. X X5. Test the daemon. X Type X % telnet localhost 105 X help X query Smith X to test out the service. You should get horton-qi's short help X message, and should be able to look up people from the e-mail directory. X Make sure that you can look up your own e-mail unambiguously with X query Yourfirstname Yourlastname X X If all you wanted was to enable the ph interface, stop here; you're done. X The following steps show how to enable fuzzy mail forwarding. X X6. Test phquery by sending yourself a letter the hard way, X pretending that you are Sendmail invoking phquery. Type X % phquery/phquery -f yourname@yourhost Yourfirstname-Yourlastname X To: Yourfirstname-Yourlastname@horton X From: yourname@yourhost X X test message X ^D X X This should cause lines like X Aug 1 12:05 phquery[21805]: From (null) X Aug 1 12:05 phquery[21805]: querying for name "dan-kegel" X Aug 1 12:05 phquery[21805]: querying for name "dan kegel" X Aug 1 12:05 phquery[21805]: dan-kegel --> dank@blacks.jpl.nasa.gov X to appear in your system log (/var/log/syslog on SunOS 4.x systems). X X After ten or so seconds, you should receive the letter in your mailbox. X X7. Modify sendmail.cf to invoke phquery. X These instructions are for a SunOS4.1.1 system - your system may be X different. X X First, make sure you have created the DNS alias 'horton' to point X to your machine (talk to your DNS administrator about this). X X Then look over the context diff file phquery/sendmail.diff- it describes X the following changes in a different way. X Make a copy of the system's sendmail.cf, and edit it as follows: X % cp /etc/sendmail.cf sendmail.cf.ph X % vi sendmail.cf.ph X A. Add the alternate hostname, usually horton, to the Cw line, e.g. X Cw blacks blacks.jpl.nasa.gov horton horton.jpl.nasa.gov X B. Create a class to match either horton or horton.DOMAIN: X #### start phquery X # Aliases for domain addresses for which we send mail thru phquery X CMhorton horton.jpl.nasa.gov X #### end phquery X C. Define a PH mailer to invoke phquery: X #### start phquery X # phquery mailer; rewrites addresses using CSO name lookup X MPH, P=/home/horton/etc/phquery, F=DFMhnmur, A=phquery $u X #### end phquery X D. Immediately after the line "S0", add a single rule to send X properly-addressed mail thru the PH mailer: X #### start phquery X R$*<@$=M> $#PH $@$w $:$1 X #### end phquery X X Now, test your modified sendmail.cf.ph file: X % su X # /usr/lib/sendmail -Csendmail.cf.ph -bt X ADDRESS TEST MODE X Enter
X X At this point, enter 0 followed by Yourfirstname-Yourlastname@horton: X > 0 dan-kegel@horton X It should print out several lines, ending with a line like X rewrite: ruleset 0 returns: $# "PH" $@ "blacks" "." "jpl" "." "nasa" "." "gov" $: "dan-kegel" X X If it worked, try installing it, and test it on a locally-generated letter: X # cp /etc/sendmail.cf /etc/sendmail.cf.noph X # cp sendmail.cf.ph /etc/sendmail.cf X # /usr/lib/sendmail -bz X # exit X % mail Yourfirstname-Yourlastname@horton X This is a test. X ^D X X After about ten seconds, check your mailbox; the letter should have been X mailed to the first mailbox found with your name in the whois database. X If that worked ok, kill the sendmail daemon and restart it so X it can handle remotely-generated letters properly: X % su X # ps augx | grep sendmail X # kill -9 nnnn X # /usr/lib/sendmail -bd -q1h X X where nnnn is the process number of the sendmail daemon, and X /usr/lib/sendmail -bd -q1h is the line from /etc/rc.local that usually X starts up the daemon. X X Finally, test whether remotely-generate letters get forwarded properly; X from some other host, send mail to Yourfirstname-Yourlastname@horton X and make sure it gets thru. X You should also make sure that normal mail still gets thru properly. X X- end - X X- Dan Kegel (dank@blacks.jpl.nasa.gov) END_OF_FILE if test 7130 -ne `wc -c <'INSTALL.QI'`; then echo shar: \"'INSTALL.QI'\" unpacked with wrong size! fi # end of 'INSTALL.QI' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(4443 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# Makefile for Horton X# @(#)Makefile 2.2 8/1/92 X XSHELL = /bin/sh X X#----- Configuration section X# DIR is where data files and scripts go; this must be a writable filesystem XDIR = /home/horton/etc X X# HOME is the pseudouser's login directory XHOME = /home/horton X X# DOMAIN is your organization's top level e-mail domain. XDOMAIN = podunk.edu X X# HOSTNAME is the name of the Horton server, preferably the alias "horton". X# Using an alias means being able to move the server from host to host later X# without having to notify all the users; it also allows sendmail to X# distinguish between normal mail and mail that should be handled by phquery. XHOSTNAME = horton.$(DOMAIN) X X# ADMINISTRATOR is the name of the person running Horton. XADMINISTRATOR = Joe Sysop X X# E-MAIL-ADR is ADMINISTRATOR's e-mail address. XE-MAIL-ADR = joe@host.podunk.edu X X# TELEPHONE_NUMBER is ADMINISTRATOR's phone number. XTELEPHONE_NUMBER= 800-555-1212 X X#----- End of configuration section X XCFILES=quickfinger.c whoisd.c quick_smtp.c XEXEFILES= in.whoisd quickfinger quick_smtp XSHFILES= dig_ls_hosts.sh hourly.sh ls_finger.sh ls_hosts.sh ls_mail.sh \ X lower.sh monthly.sh XAWKFILES= addhostname.awk ls_finger.awk nukefortune.awk pickone.awk \ X recvmail.awk sortdate.awk toshort.awk XPERLFILES=horton-qi.perl X X# X Xall: $(EXEFILES) horton-qi phquery/phquery X Xclean: X - rm -f *.o $(EXEFILES) core X cd phquery; make clean X XSHARSRCS1 = README INSTALL INSTALL.QI Makefile patchlevel.h \ X dot.plan probe.mail privacy.mail hosts.xlat hosts.exclude XSHARSRCS2 = $(SHFILES) $(AWKFILES) $(PERLFILES) $(CFILES) XPHQSRCS2 = phquery/Makefile.orig phquery/README phquery/README.TOO \ X phquery/cdefs.h phquery/dconn.c phquery/malloc.c \ X phquery/messages.h phquery/phquery.8 phquery/phquery.h \ X phquery/sendmail.diffs phquery/sendmail.h X X# Make shar files under 50 kilobytes. Xshar: $(SHARSRCS1) $(SHARSRCS2) X ls -l $(SHARSRCS1) $(SHARSRCS2) phquery/* popmods/* > Manifest X shar -n1 -e4 Manifest $(SHARSRCS1) popmods popmods/* > horton.shar1 X shar -n2 -e4 $(SHARSRCS2) > horton.shar2 X shar -n3 -e4 phquery phquery/phquery.c > horton.shar3 X shar -n4 -e4 phquery $(PHQSRCS2) > horton.shar4 X Xin.whoisd: whoisd.o X $(CC) $(CFLAGS) -o in.whoisd whoisd.o X Xquickfinger: quickfinger.o X $(CC) $(CFLAGS) -o quickfinger quickfinger.o X Xquick_smtp: quick_smtp.o X $(CC) $(CFLAGS) -o quick_smtp quick_smtp.o X X# Autoconfig rules X.plan: dot.plan Makefile X sed -e 's/HOSTNAME/$(HOSTNAME)/g' \ X -e 's/ADMINISTRATOR/$(ADMINISTRATOR)/g' \ X -e 's/E-MAIL-ADR/$(E-MAIL-ADR)/g' \ X -e 's/TELEPHONE_NUMBER/$(TELEPHONE_NUMBER)/g' \ X dot.plan > .plan X Xhorton-qi: horton-qi.perl Makefile X sed -e 's/DOMAIN/$(DOMAIN)/g' \ X -e 's/ADMINISTRATOR/$(ADMINISTRATOR)/g' \ X -e 's/E-MAIL-ADR/$(E-MAIL-ADR)/g' \ X horton-qi.perl > horton-qi X Xphquery/Makefile: phquery/Makefile.orig Makefile X sed -e 's/HOSTNAME/$(HOSTNAME)/g' \ X phquery/Makefile.orig > phquery/Makefile X Xphquery/phquery: phquery/Makefile X cd phquery; make clean; make X Xinstall: $(EXEFILES) $(AWKFILES) $(SHFILES) horton-qi phquery/phquery \ X hosts.xlat hosts.exclude probe.mail privacy.mail .plan X cd $(DIR); rm -f $(EXEFILES) X cp $(EXEFILES) $(DIR) X cd $(DIR); chmod 755 $(EXEFILES) X X cd $(DIR); rm -f $(AWKFILES) X cp $(AWKFILES) $(DIR) X cd $(DIR); chmod 644 $(AWKFILES) X X cd $(DIR); rm -f $(SHFILES) X cp $(SHFILES) $(DIR) X cd $(DIR); chmod 755 $(SHFILES) X X# Perl is only needed for ph support and mail forwarding; X# see INSTALL.QI. X cd $(DIR); rm -f horton-qi phquery X cp horton-qi phquery/phquery $(DIR) X cd $(DIR); chmod 755 horton-qi phquery X X# Only install the example host files if none there. X test -f $(DIR)/hosts.xlat || cp hosts.xlat $(DIR)/hosts.xlat X test -f $(DIR)/hosts.exclude || cp hosts.exclude $(DIR)/hosts.exclude X test -f $(DIR)/probe.mail || cp probe.mail $(DIR)/probe.mail X test -f $(DIR)/privacy.mail || cp privacy.mail $(DIR)/privacy.mail X chmod 644 $(DIR)/hosts.xlat $(DIR)/hosts.exclude $(DIR)/probe.mail \ X $(DIR)/privacy.mail X X# Only install the plan file if none there. X test -f $(HOME)/.plan || cp .plan $(HOME)/.plan X chmod 644 $(HOME)/.plan X X# Only install the .forward file if none there. X# This file gets removed during monthly.sh, so X# place an alternate copy in .forward.bck for possible later human use. X test -f $(HOME)/.forward || echo $(E-MAIL-ADR) > $(HOME)/.forward X chmod 644 $(HOME)/.forward X cp $(HOME)/.forward $(HOME)/.forward.bck X X @echo Be sure to update /etc/inetd.conf and crontab. END_OF_FILE if test 4443 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'patchlevel.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patchlevel.h'\" else echo shar: Extracting \"'patchlevel.h'\" \(743 characters\) sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE' X/* X INSTALL 2.3 8/1/92 X INSTALL.QI 2.1 8/1/92 X Makefile 2.2 8/1/92 X README 2.3 8/1/92 X addhostname.awk 2.1 7/31/92 X dig_ls_hosts.sh 2.1 7/31/92 X dot.plan 2.2 8/1/92 X horton-qi.perl 2.2 8/1/92 X hourly.sh 2.2 8/1/92 X lower.sh 2.1 7/31/92 X ls_finger.awk 2.1 7/31/92 X ls_finger.sh 2.2 7/31/92 X ls_hosts.sh 2.1 7/31/92 X ls_mail.sh 2.1 7/31/92 X monthly.sh 2.4 8/1/92 X nukefortune.awk 2.1 7/31/92 X pickone.awk 2.1 7/31/92 X privacy.mail 2.2 8/1/92 X probe.mail 2.1 7/31/92 X quick_smtp.c 2.1 7/31/92 X quickfinger.c 2.1 7/31/92 from net.c 5.5 (Berkeley) 6/1/90 X recvmail.awk 2.1 7/31/92 X sortdate.awk 2.1 7/31/92 X toshort.awk 2.1 7/31/92 X whoisd.c 2.1 7/31/92 X*/ X#define PATCHLEVEL 1 Xstatic char patchlevelid[]="@(#)patchlevel.h 2.2 8/1/92; horton-2.2"; END_OF_FILE if test 743 -ne `wc -c <'patchlevel.h'`; then echo shar: \"'patchlevel.h'\" unpacked with wrong size! fi # end of 'patchlevel.h' fi if test -f 'dot.plan' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'dot.plan'\" else echo shar: Extracting \"'dot.plan'\" \(1857 characters\) sed "s/^X//" >'dot.plan' <<'END_OF_FILE' XHorton is the keeper of the whois database on HOSTNAME. XWhois is an e-mail directory service. X XTo look up somebody's e-mail address: XOn most Unix systems, type X whois -h HOSTNAME search_key XOn VMS systems with Multinet TCP/IP, type X whois /host=HOSTNAME search_key XThe search key can be a whole name, or just a fragment of a name. XIf there are no matches, nothing will be printed; try a shorter Xfragment. X XIf you have a Unix system without whois (e.g. HP/UX), you can get Xsource for whois via anonymous FTP from nic.ddn.mil, file /netprog/whois.c. X XA Macintosh MacTCP version of whois and finger is available as the file Xinternet-finger-client.hqx at the following FTP sites (and perhaps others): X (host) (directory) X ucselx.sdsu.edu /pub/mac X orion.oac.uci.edu /ntslib/mac/comm X akiu.gw.tohoku.ac.jp /pub/mac/comm/MacTCP X ifi.informatik.uni-stuttgart.de /pub/mnt/mac/com X XWhen Horton wants to update its idea of what hosts should be Xpolled to generate the whois database, it runs a probe script Xwhich fingers and sends mail thru each site; the sites that Xrespond to both requests are placed in the list of sites to poll, Xand their postmasters are notified that they are being polled. X XHorton understands the idea of e-mail clusters, so if your machine remote Xmounts /var/spool/mail from some other machine, please contact the Horton Xadministrator at the address below and tell them the hostnames of your mail Xserver and its mail clients. X(On SunOS 4.x systems, typing 'showmount -a | grep mail' on the mail Xserver lists the server's mail clients.) XThis helps reduce the ambiguity of the directory. X XTo prevent Horton from probing your machine, to be removed from Xthe e-mail directory, or to report any problems, contact the XHorton administrator ADMINISTRATOR by e-mail at E-MAIL-ADR Xor by phone at TELEPHONE_NUMBER. X X@(#)dot.plan 2.2 8/1/92 END_OF_FILE if test 1857 -ne `wc -c <'dot.plan'`; then echo shar: \"'dot.plan'\" unpacked with wrong size! fi # end of 'dot.plan' fi if test -f 'probe.mail' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'probe.mail'\" else echo shar: Extracting \"'probe.mail'\" \(492 characters\) sed "s/^X//" >'probe.mail' <<'END_OF_FILE' XThis is an automatically generated letter to test your mail system. XIt uses RFC822 source routing <@yourhost:user@thishost> to route Xmail back to this host. These probes should occur about monthly. XAny error messages may indicate a problem with your mail system, Xbut can be safely ignored if you don't care much about e-mail. XFor info on the e-mail directory service, or to avoid future probes, Xfinger the user that sent this and contact the person listed there. X@(#)probe.mail 2.1 7/31/92 END_OF_FILE if test 492 -ne `wc -c <'probe.mail'`; then echo shar: \"'probe.mail'\" unpacked with wrong size! fi # end of 'probe.mail' fi if test -f 'privacy.mail' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'privacy.mail'\" else echo shar: Extracting \"'privacy.mail'\" \(873 characters\) sed "s/^X//" >'privacy.mail' <<'END_OF_FILE' XPostmaster: X XThe automatic e-mail directory daemon (Horton) on this computer Xhas found that your computer allows outside finger queries and Xhandles e-mail well, and has therefore been added to the e-mail directory. XThe daemon will be polling your computer approximately hourly with Finger Xto keep the e-mail directory up to date. X XThe e-mail directory may be accessed directly with the 'whois' command or X'telnet thiscomputer 43'. A more convenient method is 'uwho', a program Xwhich knows about all of the public whois e-mail directories on the Internet. X XIf you object to the loss of privacy that inclusion in the e-mail Xdirectory entails, contact the Horton administrator (see below); your Xcomputer or network can be easily be excluded from the directory. X XFor help, finger the user that sent this message. XThe current help file follows. X@(#)privacy.mail 2.2 8/1/92 X END_OF_FILE if test 873 -ne `wc -c <'privacy.mail'`; then echo shar: \"'privacy.mail'\" unpacked with wrong size! fi # end of 'privacy.mail' fi if test -f 'hosts.xlat' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'hosts.xlat'\" else echo shar: Extracting \"'hosts.xlat'\" \(166 characters\) sed "s/^X//" >'hosts.xlat' <<'END_OF_FILE' X# Translation table from hostname to mailhost name X# i.e. to send mail to somebody logged in at host, X# send it to mailhost. X#host mailhost Xdummy_host dummy_mailhost END_OF_FILE if test 166 -ne `wc -c <'hosts.xlat'`; then echo shar: \"'hosts.xlat'\" unpacked with wrong size! fi # end of 'hosts.xlat' fi if test -f 'hosts.exclude' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'hosts.exclude'\" else echo shar: Extracting \"'hosts.exclude'\" \(10 characters\) sed "s/^X//" >'hosts.exclude' <<'END_OF_FILE' Xlocalhost END_OF_FILE if test 10 -ne `wc -c <'hosts.exclude'`; then echo shar: \"'hosts.exclude'\" unpacked with wrong size! fi # end of 'hosts.exclude' fi if test ! -d 'popmods' ; then echo shar: Creating directory \"'popmods'\" mkdir 'popmods' fi if test -f 'popmods/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'popmods/README'\" else echo shar: Extracting \"'popmods/README'\" \(1299 characters\) sed "s/^X//" >'popmods/README' <<'END_OF_FILE' XThis directory contains modifications to the Berkeley popper POP server Xwhich cause POP logins to be recorded in /var/adm/lastlog. X XThese changes have only been tested on a SunOS 4.1.1 system. XThey consist of a completely new file, pop_lastlog.c, and a replacement Xfor an old file, pop_pass.c. X XThis is taken advantage of by Horton if you enable the Xlocal finger code in hourly.sh by changing the 0 to 1: X X # Only enable this section if running on host that has e-mail users X # that show up in utmp but never log in. X if (0) then X # Also scan localhost with finger, to catch people who log in with POP X # (requires Dan Kegel's mods to pop server) X # Caution: contains literal TAB character in sed command. X set host = `hostname` X foreach user (`ypcat passwd | sed 's/:.*//' `) X finger $user | awk -f toshort.awk | \ X sed 's/ /@'$host' /' >> $TMPFILE X end X endif X XNote that this only lets Horton see pop users that log in to the Horton Xserver with pop; if you want to handle other pop servers, you'll have to Xrun a small subset of hourly.sh on those servers, then merge the data Xin with the Horton server's data somehow (perhaps by placing it in Xthe remote server's horton .plan file, and having the main hourly.sh Xgrab it with finger). X X- Dan Kegel (dank@blacks.jpl.nasa.gov) END_OF_FILE if test 1299 -ne `wc -c <'popmods/README'`; then echo shar: \"'popmods/README'\" unpacked with wrong size! fi # end of 'popmods/README' fi if test -f 'popmods/pop_lastlog.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'popmods/pop_lastlog.c'\" else echo shar: Extracting \"'popmods/pop_lastlog.c'\" \(853 characters\) sed "s/^X//" >'popmods/pop_lastlog.c' <<'END_OF_FILE' X/*-------------------------------------------------------------------------- X Update the system's idea of when each POP user last logged in. X This is done by creating an entry in /var/adm/lastlog. X--------------------------------------------------------------------------*/ X X#include X#include X#include X#include X Xpop_lastlog(pid, hostname) X unsigned int pid; X char *hostname; X{ X int fd; X struct lastlog entry; X long pos; X X time(&entry.ll_time); X strcpy(entry.ll_line, "POP"); X strncpy(entry.ll_host, hostname, sizeof(entry.ll_host)); X X fd = open("/var/adm/lastlog", O_RDWR); X if (fd == -1) { X perror("/var/log/lastlog"); X return; X } X pos = (long) pid * sizeof(entry); X if (lseek(fd, pos, 0) != pos) { X perror("/var/log/lastlog seek"); X close(fd); X return; X } X write(fd, &entry, sizeof(entry)); X close(fd); X} END_OF_FILE if test 853 -ne `wc -c <'popmods/pop_lastlog.c'`; then echo shar: \"'popmods/pop_lastlog.c'\" unpacked with wrong size! fi # end of 'popmods/pop_lastlog.c' fi if test -f 'popmods/pop_pass.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'popmods/pop_pass.c'\" else echo shar: Extracting \"'popmods/pop_pass.c'\" \(2036 characters\) sed "s/^X//" >'popmods/pop_pass.c' <<'END_OF_FILE' X/* X * Copyright (c) 1989 Regents of the University of California. X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X */ X X#ifndef lint Xstatic char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; Xstatic char SccsId[] = "@(#)@(#)pop_pass.c 2.3 2.3 4/2/91"; X#endif not lint X X#include X#include X#include X#include X#include "popper.h" X X/* X * pass: Obtain the user password from a POP client X */ X Xint pop_pass (p) XPOP * p; X{ X register struct passwd * pw; X char *crypt(); X X /* Look for the user in the password file */ X if ((pw = getpwnam(p->user)) == NULL) X return (pop_msg(p,POP_FAILURE, X "Password supplied for \"%s\" is incorrect.",p->user)); X X /* We don't accept connections from users with null passwords */ X if (pw->pw_passwd == NULL) X return (pop_msg(p,POP_FAILURE, X "Password supplied for \"%s\" is incorrect.",p->user)); X X /* Compare the supplied password with the password file entry */ X if (strcmp (crypt (p->pop_parm[1], pw->pw_passwd), pw->pw_passwd) != 0) X return (pop_msg(p,POP_FAILURE, X "Password supplied for \"%s\" is incorrect.",p->user)); X X /* dank@blacks: update lastlog */ X pop_lastlog(pw->pw_uid, p->client); X X /* Build the name of the user's maildrop */ X (void)sprintf(p->drop_name,"%s/%s",POP_MAILDIR,p->user); X X /* Make a temporary copy of the user's maildrop */ X /* and set the group and user id */ X if (pop_dropcopy(p,pw) != POP_SUCCESS) return (POP_FAILURE); X X /* Get information about the maildrop */ X if (pop_dropinfo(p) != POP_SUCCESS) return(POP_FAILURE); X X /* Initialize the last-message-accessed number */ X p->last_msg = 0; X X /* Authorization completed successfully */ X return (pop_msg (p,POP_SUCCESS, X "%s has %d message(s) (%d octets).", X p->user,p->msg_count,p->drop_size)); X} END_OF_FILE if test 2036 -ne `wc -c <'popmods/pop_pass.c'`; then echo shar: \"'popmods/pop_pass.c'\" unpacked with wrong size! fi # end of 'popmods/pop_pass.c' fi echo shar: End of archive 1 \(of 4\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0