$Id: INSTALL,v 1.4 1995/08/28 05:19:20 maf Exp $

Current working (or at one time working) platforms:

    SunOS   - should always work, its my development platform.
    AIX     - contributed patches
    HP/UX   - contributed patches
    IRIX    - it compiles, serial device io untested though.
    Solaris - it compiles, serial device io untested though.
    NetBSD  - contributed patches
    BSDI    - contributed patches

sendpage is still in its alpha testing stage, please send any
ideas/bug reports/confirmation it actually works, etc to
maf@net.ohio-state.edu

The ixo list (ixo@plts.org subscribe at majordomo@plts.org) is a good
place to find out about pagers, other pager software, and changes to
sendpage.  Also the pager FAQ @ ftp://ftp.airnote.net:/pub/paging-info or
http://www.airnote.net/ww/paging.html

todo is my list of things to add/fix/finish.

First, you need the berkeley db library available from
    ftp.cs.berkeley.edu:/ucb/4bsd/db.1.85.tar.gz.  There's also a copy
    on ftp.net.ohio-state.edu:/pub/pagers/db.1.85.tar.gz.

    This is easy to install, atleast under SunOS:
        cd PORT/sunos4.1.3
        make
        cp libdb.a /usr/local/lib
        cp include/db.h /usr/local/include
        ranlib /usr/local/lib/libdb.a
        mkdir /usr/local/include/sys
        cp include/cdefs.h /usr/local/include/sys/cdefs.h

Paging central is the box at the paging company that answers with a modem
and sends out the ID= string.  To use this software, your paging central
needs to speak the PET protocol as defined in "Programmers Guide to Paging
Data Interface Modules" Motorola, 12/88.  You'll need the phone number, the
rate it answers at, and you might need the password.  Normally it will
accept anything for a password.  1200bps seems to be standard.  First
try connecting through your modem to paging central.  It should answer
with an ID= prompt (press CR to activate it).  If you don't get the
ID= prompt, it may be using a different protocol, and sendpage currently
only speaks PET.  Ask your page vendor for details.

Configure

o
    edit sendpage.h.  You'll definately need to change
    FROM_HEADER.  Leave the queue and config file in /tmp for testing now.

    make sure the queue directory is created and writeable by the uid
    your testing this under (/tmp/pqueue works well)

o
    make

o
    copy the sendpage.cf file to wherever it was configured to go
        (sendpage.h)  You'll need to customize this to your local
        paging central numbers and users.

o
    start the daemon in debug mode in one window:
        % ./sendpage -d99 -bd

    you should see:
        sendpage: info(6):   daemon started
         sendpage: info(6):   /tmp/sendpage.cf: read 1 aliases, 1 pet
        sendpage: info(6):   pause()ing

    send it a HUP signal, it should reread the config file

        % kill -HUP `cat /tmp/sendpage.pid`

    you should see:
        sendpage: info(6):   /tmp/sendpage.cf: read 1 aliases, 1 pet
        sendpage: info(6):   pause()ing

    HUP     rereads the config file
    USR1    forces a delivery run
    QUIT    graceful exit

o
    try sending a page that will fail - you should get an e-mail response,
    and see the daemon window send the mail.

        % ./sendpage foobar
            message
            ^D   <- type control d
        Entry queued for delivery

    you should see:
        sendpage: info(6):   sendpage789336845014819: from=maf, size=7,
            to=foobar, status=2, msg=message
        sendpage: info(6):   Adding "sendpage789336845014819" to error list
            (foobar)
        sendpage: error(3):  sendpage789336845014819: Unknown recipient
        sendpage: info(6):   Mail sent to maf for sendpage789336845014819
        sendpage: info(6):   pause()ing

o
    try sending a page to the null device.  This should just result
    in an e-mail reply.

    sendpage.cf should have:
        pc      name=test protocol=null phone=123456 maxmsgsize=5

    % echo 'foobar' | ./sendpage test
    Entry queued for delivery

    you should see:

        sendpage: info(6):   daemon started
        sendpage: info(6):   /tmp/sendpage.cf: read 2 aliases, 3 pet
        sendpage: info(6):   begin QueueRun
        sendpage: info(6):   sleeping for 300
        sendpage: info(6):   begin QueueRun
        sendpage: info(6):   sendpageQ801115244007031: from=maf, size=6, to=test, status=2, msg=foobar
        sendpage: info(6):   Adding "sendpageQ801115244007031" to delivery list (12345.test 3)
        sendpage: info(6):   Mail sent to maf for sendpageQ801115244007031
        sendpage: info(6):   sleeping for 300


o
    try sending a page that should not fail.  /etc/sendpage.cf will
    minimally need to have a paging central definition.

    % ./sendpage yourpin.yourcentral
        or if you have an alias
    % ./sendpage youralias

    If this doesn't work, you'll need to look at the debugging output
    of the daemon.  There's also a smaller 'testpet' program that doesn't
     do anything but dial and try to send a message.  I've only tested this
    with Columbus Ohio's usamobile system.

o
    Configuring sendmail:

    This is optional, but I think it provides a good generic interface
    built on software that's allready proven to work.

    Go to the top of the file, find a unused class, I used G (if G is
    unused, there won't be a line starting with CG).  add:

    CGpage.net.ohio-state.edu       # or whatever you want to call it.

x
    Find where the mailer specification section is in sendmail.cf
    (lines starting with Mlocal, Mprog)
    add:

    Msendpage,   P=/usr/local/bin/sendpage, F=lsPn, M=999,
    	A=sendpage -m 2 -f $f -s $u
    ^^^ tab

x
    Find ruleset 0 (line begins with S0)
    add (if you didn't use G, substitute the G below with what you did use)

    # Pager gateway
    R$+<@$=G.>	$#sendpage $@:prog $:$1
              ^^ that must be a tab, others are spaces.

    in the sendmail 8.6.12 config file, it can go after the lines
    # handle local hacks
    R$*	$: $>98 $1
       ^ tab

    Unfortunately, depending on who wrote your sendmail.cf file, this
    may or may not work.  Consult your local sendmail.cf person.

    If using the 8.6.x M4 templates to generate sendmail.cf files use:

    # for experimental pager gateway
    CGpage.net.ohio-state.edu

    # at the bottom
    LOCAL_RULE_0
    R$+<@$=G.>  $#sendpage $@:prog $:$1

    Msendpage,   P=/usr/local/sendpage/bin/sendpage, F=lsPn, M=999,
    	A=sendpage -m 2 -f $f -s $u

x

    start sendmail in address test mode.  user@page.net.ohio-state.edu
    should resolv to the sendpage mailer.

    % sendmail -bv

    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > 3,0 test@page.net.ohio-state.edu
    rewrite: ruleset  3   input: maf @ page . net . ohio-state . edu
    rewrite: ruleset 96   input: maf < @ page . net . ohio-state . edu >
    rewrite: ruleset 96 returns: maf < @ page . net . ohio-state . edu . >
    rewrite: ruleset  3 returns: maf < @ page . net . ohio-state . edu . >
    rewrite: ruleset  0   input: maf < @ page . net . ohio-state . edu . >
    rewrite: ruleset 98   input: maf < @ page . net . ohio-state . edu . >
    rewrite: ruleset 98 returns: maf < @ page . net . ohio-state . edu . >
    rewrite: ruleset  0 returns: $# sendpage $@ : prog $: maf
    >

x

    add a MX or A record for whatever you called your page gateway.

o

    Install sendpage.  It needs to run setuid something, NOT setuid root!
    ie. create a dummy user sendpage and have /usr/local/bin/sendpage
    owned by that user, and setuid (chmod 4755) to that user.  The queue
    directory will need to be read/write for user sendpage, and your modem
    device (/dev/ttyb?) will need to be read/write for user sendpage.

    In rc.local (or your init file), remove the pid file, and start
    sendpage as sendpage -bd:
        if [ -f /usr/local/bin/sendpage ]; then
            su -c sendpage rm -f /var/run/sendpage.pid
            echo -n 'starting sendpage...'
            su -c sendpage /usr/local/bin/sendpage -bd && echo done
        fi


    Please do not run sendpage setuid root.  It's not designed, and has
    no need to be run as a "the" priviliged user.

---

tips:

    modem won't respond -> use a simpler init string

    pages sometimes work -> define PET_LESS_STRICT_LOOKUP (this is
        now defined by default)

	
