FUNET-NJE on UNIX(8)

NAME
funetnje - Bitnet NJE server on UNIX

SYNOPSIS
funetnje [loglevel] [debugflag]

DESCRIPTION

funetnje is name for main program which does BITNET-II/VMNET-compatible communication using IBM developed NJE protocol.

loglevel is defaulted from configuration file (see below), but can be given at startup too: 2..5 are supported, and usually not needed.

`debugflag' is used when funetnje is wanted to stay connected with controlling terminal for some debugging purposes. Default for program is to detach itself from controlling terminal and then to continue without connection anywhere. (Usually /dev/console gets connection, but that is for output only.)

Value of `debugflag' is any non-void text or character. When argc of program exceeds 2, that fullfills `debugflag'.

Location of configuration file is usually /etc/funetnje.cf (It is defined in consts.h source file.)

Sample configuration file:

*
*       Configuration file for FUNET-NJE program
*

* BITNET name of node:
NAME            FINFILES
* My Internet view of things
*IPADDRESS      nic.funet.fi
IPADDRESS       128.214.6.100
* Directory for in & outbound traffics
* Protection 2775 (or 2770), group "huji"
QUEUE           /usr/spool/bitnet
* AF_UNIX "command mailbox" -channel.
CMDMAILBOX      /usr/spool/bitnet/.cmdpipe
* AF_INET "command mailbox" -host (IP address!)
*CMDMAILBOX     123.45.67.89
* Logging file
LOG             /usr/adm/bitnet.log
* Optional RSCSv1 style accounting log.  Needed only on
* international EARN nodes, though..
*RSCSACCT       /var/log/bitacct
* this table is a binary file, and generated with
* njeroutes(8) program
TABLE           /usr/local/lib/huji/nje.routes
* EBCDIC<->ASCII tables, (optional), see ebcdictbl(5)
*EBCDICTBL      /usr/local/lib/huji/ebcdictbl
* Send information of wierd happenings to:
INFORM          MEA@FINFILES
* File containing user exits for files
FILEEXITS       /usr/local/lib/huji/file-exit.cf
* File containing user exits for messages (unimplemented)
MSGEXITS        /usr/local/lib/huji/msg-exit.cf
* Logging Level (smaller value, less logs)
LLEVEL  2
* System-wide default value for FORM.
DEFFORM         STANDARD
* Default route when routing table isn't complete for
* some reason.
*DEFAULT-ROUTE   FIGBOX

* LINE, line number, remote node name
LINE 0 FIGBOX
 * TYPE UNIX_TCP (only available)
 TYPE           UNIX_TCP
 * BUFSIZE of single NJE transaction
 BUFSIZE        1024
 * TIMEOUT of something odd, 3 works well.
 TIMEOUT        3
 * IPPORT is usually fixed 175, unless opposite can't
 *         manage it (which is true with VMS UCX + JNET
 *         systems)
 IPPORT         500
 * TCPNAME gives opposite end IP address (numeric form
 *         is fastest to resolve)
 * TCPNAME       figbox.funet.fi
 TCPNAME        128.214.6.7
 * TCP-SIZE tells how much can be lumped into single TCP
 *          block to be sent out.
 TCP-SIZE       8192
 * MAX-STREAMS gives the number of outgoing streams that can
 *             be used against opposite.  Real IBM takes 7.
 MAX-STREAMS    1

 * Define another link to an IBM system
LINE 1  SEARN
 TYPE           UNIX_TCP
 BUFSIZE        1024
 TIMEOUT        3
 IPPORT         175
 *TCPNAME       searn.sunet.se
 TCPNAME        192.36.125.4
 TCP-SIZE       8192
 MAX-STREAMS     7

 * Define a link to another HUJINJE/FUNETNJE system
LINE 1  ALIJKU65
 TYPE           UNIX_TCP
 BUFSIZE        1024
 TIMEOUT        3
 IPPORT         175
 *TCPNAME       alijku65.edvz.uni-linz.ac.at
 TCPNAME        140.78.3.34
 TCP-SIZE       8192
 MAX-STREAMS     7
* End of definitions

Sample file processing exit file:

# FILE-EXIT.CF -- File disposition/processing exit file

# Rule for spool disposition path, defines also system default
# user spool directory for those who don't have specially set
# something else.
# Possibilities:  ~/bitspool  -- real user's only! (~/ == users home)
#                 /usr/path/path/ -- append 'touser' as subdir,
#                                     it is spool dir.
#                                    Valid for Exits and real users.
#                 /usr/path/path  -- explicite directory.
#                 /dev/null       -- explicite file (special case).
#       When directory isn't present, it is built from upmost present
#       level down to users bottommost level hmm...
# Question about ownership of directory/files...
#   Real users:  real protections, programs start with setuid() user.
#   Exit users:  POSTMAST  (exits start as root anyway.)
#   Exited reals: real protections, programs start with setuid() user.

Spool-Dir:      /usr/spool/bitspool/
Postmast-Dir:   /usr/spool/bitspool/POSTMAST

# Now list of things to match and then what to do
# To do keywords:       DISCARD  to /dev/null.
#                       KEEP     just so.  Into default
#                                directory, or given spool.
#                       NOTIFY   KEEP, and send a NJE message
#                                to somebody.
#                       RUN      starts arbitary program with
#                                arbitary arguments telling
#                                about file location and its
#                                properties.
#                                If fails, well..
#
# Defining  SpoolDir  must be done with explicite trailing "/":
#         /usr/spool/bitnet/SYSIN-JOB/

# Exit table begin keyword:
Exit-Table:

# Args:
# (Note: folding is for document only, real input must be wide.
#        Continuation lines are prefixed with `+'.)
# touser8 tonode8 fname8   ftype8  pun? class fruser8  frnode8 \
+             dist8     SpoolDir                     action    \
+    ExtraArgument
# (Entry on  PUN?  can be one of:  *, PUN, PRT, SYSIN)
# (Entry on  EXTRAARGUMENT can be program path arguments for the
#  RUN  commands.  For TRANSFER it is the target address.    See
#  funetnje(8) man page for documentation about macro expansion.)
#
*        *        *        *        SYSIN *   *        *       \
+             *         /usr/spool/bitnet/SYSIN-JOB/ RUN       \
+    /usr/local/lib/huji/sysin $SPOOL
MEA      FINFILES *        *        *   *     HKS      SEARN   \
+             *         default                      DISCARD
MEA      FINFILES *        *        *   *     *        SEARN   \
+             *         default                      RUN       \
+    /usr/local/lib/huji/transfer MEA@FIRIEN $SPOOL
MAILER   FINFILES *        *        PUN M     *        *       \
+             *         default                      RUN       \
+    /usr/local/lib/huji/mailify $SPOOL
NOBODY   FINFILES *        *        *   *     *        *       \
+             *         default                      DISCARD
#FOOBAT  FINFILES *        *        *   *     *        *       \
+             *         default                      RUN       \
+    /usr/local/lib/huji/transfer touser@whatnode $SPOOL
#
# NETINIT is pseudo id for automatically re-generating routing tables
# This is done with cron-driven  netinit.sh  which must be configured
# by hand.
#
NETINIT  FINFILES *        *        *   *     *        *       \
+             *         default                      KEEP
*        *        *        *        *   *     *        *       \
+             *         default                      KEEP

Sample message processing exit file:

#
# Some first ideas about patterns, et.al.:
#
# Actions:  CMD: BUILTIN, RUN
#           MSG: BRCAST, DISCARD, RUN, PIPE
#

CmdHelpFile: /usr/local/lib/huji/cmd-help.txt

#$TOUSER $TONODE  $FRUSER  $FRNODE  C pattern  ACTION args
.        FINFILES *        *        C "H*ELP"  BUILTIN HELP
.        FINFILES *        *        C "FINGER *" RUN     \
+ /usr/local/lib/huji/nje-finger $FRUSER $FRNODE $TEXT
#
#$TOUSER $TONODE  $FRUSER  $FRNODE  M ACTION args
#                 "." == FRUSER is blank
MAILER   *        *        *        M  DISCARD
MAILSERV FINFILES .        *        M  DISCARD
MAILSERV FINFILES *        *        M  RUN               \
+ /usr/local/lib/mailserver/nje-msg $FRUSER $FRNODE $TEXT
ECHO     FINFILES .        *        M  DISCARD
ECHO     FINFILES *        *        M  RUN               \
+ /usr/local/bin/send -u echo $FRUSER@$FRNODE *Got Message: $TEXT
#
# The default
*        *        *        *        M  BRCAST

MACROES ON FILE-EXIT CONFIGURATION

On overall, following macro identifiers can be placed on the argument string.

$SPOOL
    When no argument string is defined, this defaults as the only argument. If this is not defined in the argument string, it defaults to be the last one.

$$  Expands to decimal process-id string, like in: "/tmp/temp$$file"

$FID
    The original spoolid on form of a string of 4 digits: 0001 - 9900

$TOUSER
    Destination user name.

$TONODE
    Destination node name.

$FNAME
    RSCS file name.

$FTYPE
    RSCS file extension.

$CLASS
    Spool file class

$FRUSER
    Originating user name.

$FRNODE
    Originating node name.

$SPTYPE
    Spool file type, one of: PUNCH, PRINT, SYSIN.

$TAG
    The RSCS tag. Often 0-size string..

$DIST
    Possibly defined RSCS DIST data.

$DEST
    Possibly defined RSCS DEST data. (Not implemented yet!)

Argument string chopping is done before macro expansion. Thus if a macro expression expands to a string with blanks in it, the resulting argument segment will then contain those blanks.

FILES
There are two hardwired files which control the behaviour of the rest of the system:

/etc/funetnje.pid
    The "pid file" giving easy pointer to the running program.

/etc/funetnje.cf
    The configuration file described above.

Rest of these are configured in the above-mentioned file, or in its exit extensions.

/usr/spool/bitnet
    Configured `QUEUE' directory of transport routing. Protection 2770 (or only mildly more open) Group must be the same as set-gid programs of FUNET-NJE have for accessing the intermodule communication channel.
    This directory gets also file `.socket.key', which contains the security code for all communications via `CMDMAILBOX' channel.
    Another file that goes into there is a database file containing system spoolids.
     A number in range 1 to 9900, inclusive. File `.spoolid.htdb' contains a HeapTree database which is essentially an array implementation of (partially) ordered tree, using userids as keys, and spoolids as data. Content of data on that database is machine specific, but on the other hand, nobody is supposed to need to share them...

/usr/spool/bitnet/.cmdpipe
    Configured `CMDMAILBOX' of FUNET-NJE intermodule communication channel FIFO. Protected 660, and in principle those who need to communicate via it must to so either by being superusers, using setgid programs, or having the groupid that the `QUEUE' has.

/usr/spool/bitnet/.spoolid
    A special file saving last used outbound spoolid in binary format. Transporter internal usage. Recipient spool directories have also these .spoolid files, and their function is similar; keep status log.

/usr/spool/bitspool/
    Configured (via exit files) `Spool-Dir:' under which local recipients will get their own subdirectories.. Directory protection to be 111 or somewhat more open (like 555.)

SEE ALSO
send(1), sendfile(1), bmail(8), bitspool(5), ebcdictbl(5), mailify(8), sysin(8), qrdr(8), rdrlist(8), njeroutes(8), receive(1), ucp(8), ygone(1), transfer(1)

BUGS

Some of then, see BUGS.FUNET for a list of open issues.

DIAGNOSTICS
Plenty, obtainable into configurable file, example gives LOG file value /usr/adm/bitnet.log. Amount of log is controllable with LLEVEL in the configuration file, startup time loglevel option, and ucp(8) `"LOGLEVEL nn"' control commands.

WARNING
Updating routing tables (see njeroutes(8)) without proper care (shutdown of server), may cause routing data corruption, and/or crash of the router. Very least the new routes will not get proper attention.

NOTES
The following signals have the specified effect when sent to the server process using the kill(1) command.

SIGHUP
    Causes server to reread configuration file (usually /etc/funetnje.cf) and exits specified in it. This does not reinitiate link-setups/tear old ones down. Use only for re-reading in the exits.

This will also close, and reopen routes database.

SIGTERM
    Causes server to dump statistics counters to log file, and to do shutdown. (Compare with ucp shut.)

SIGUSR1
    Dumps statistics counters to log file.

FUNET's UNIX-version is somewhat different from the HUJI's VMS version, when it comes to handling of files destined to local channel, as well as when sending something out.

HUJI's version opens NETDATA encodings (if present), and usually translates file contents to ASCII (class N netdata is not translated, assuming it to be binary). Also handling of file conversion to mail is done inside the transport system.

FUNET's style is to let user and user programs to handle all such details, and just to provide the raw datafile to them. Also there the user (or his programs) must create the spool-files containing RSCS PUNCH/PRINT line images. See bitspool(5), bmail(8), sendfile(1).

AUTHORS

Yehavi Bourvine, Hebrew University of Yerusalem, Israel <yehavi@hujivms.bitnet>.

Matti Aarnio, Finnish University and Research Network - FUNET, Finland <mea@nic.funet.fi> <mea@finfiles.bitnet>.

Gerald Hanusch, Johannes Kepler Universitaet/Universitaet Linz, Austria <k000165@alijku11.bitnet>.

Original (VMS oriented package) software by Yehavi Bourvine, UNIX features, plenty of modifications, file handling exits, man-pages by Matti Aarnio. Batch (SYSIN) facilities, and bug fixes prompted by Gerald Hanusch, and in large part implemented by Matti Aarnio.