dtelnetd utility

The Deterministic Telnet Server Utility

The Deterministic Telnet Server Utility (dtelnetd) is a modified version of the Berkeley telnetd server that functions similarly in most respects. However, dtelnetd allows you to specify which PTY device to use for an incoming telnet connection, rather than arbitrarily picking a PTY device as the BSD server does. This functionality is useful: 1) for host applications that require users to be logged in on the same PTY device during every session and 2) when it is desirable to associate remote physical port server ports with specific local PTY devices.

The dtelnetd utility works by establishing a mapping of TCP port numbers to PTY device names. It runs through the standard UNIX inetd service and therefore invokes dtelnetd servers on-demand (as opposed to RTN services which are always running). Since dtelnetd is less resource intensive than RTN, it is preferable in situations where the port server can initiate telnet sessions. For applications where the UNIX host must initiate sessions, you must use RTN.

Requirements and System Specific Information

In order to use the dtelnetd server, your host system must be configured to emulate BSD-style ptys which adhere to the BSD naming conventions (see step 2 under "Configuring dtelnetd" below). Many UNIX operating systems are already configured to emulate both STREAMs and BSD-style PTYs. Special cases that need to be configured for BSD emulation are listed here:

  • Motorola System V/88 Release 4.0

This SVR4 based OS has a STREAMS-based pty subsystem which can be configured to emulate BSD-style ptys (called BCS pseudo-terminals) by adding the following line to the /stand/system configuration file:
INCLUDE:BCSPTS

The system must be rebooted for changes to take effect.

    Configuring dtelnetd

    Configuring the dtelnetd server is a four-step process:

    1. Add network service identifiers in /etc/services.

    Each pty slave mapping requires its own separate service definition in the /etc/services file. These definitions have the following format:<service name> <TCP port>/tcp

    An example of three definitions, along with suggested values, is:

    dtd-9000 9000/tcp
    dtd-9001 9001/tcp
    dtd-9002 9002/tcp

    2. Add definitions to inetd.conf to establish port to pty mapping.

    On most systems, the inetd.conf file is found in /etc. However, some systems (notably Motorola SVR3.2 implementations) store inetd.conf in /usr/etc.

    Each of the service identifiers (see step 1) requires a corresponding entry in the inetd.conf file in order to have inetd listen for connections on those ports. Use the format below that is appropriate for your system.

    MOTOROLA SYSTEM V/88 R4.0
    DIGITAL UNIX (Formerly DEC OSF/1)
    AIX 4.x <service name> stream tcp nowait root /usr/sbin/dtelnetd dtelnetd -p <pty slave>
    MOTOROLA SYSTEM V/88 R3.2 <service name> stream tcp nowait root /usr/etc/inet/dtelnetd dtelnetd -p <pty slave>
    NOVELL UnixWare 2.x <service name> stream tcp nowait root /usr/sbin/in.dtelnetd in.dtelnetd -p <pty slave>
    SCO SYSTEM V R3 <service name> stream tcp nowait NOLUID /etc/dtelnetd dtelnetd -p <pty slave> where <service name> corresponds to the service port definition from step 1 (above). <pty slave> corresponds to the name of the slave-side pty node which will be mapped to this particular port. This name must be a valid BSD-style pty node of the following format: /dev/tty[p-za-l][0-9a-f]

    If your system is not listed above, you can generally look at the entry for the standard telnet service running on port 23. The inetd entry for dtelnetd will be the same as the telnet entry, except for the service name and the addition of the '-p' option.

    The -p is necessary to provide the name of the slave device, but any other standard telnetd options may be added as necessary.

    Any connections to the specified port will be made over the specified slave pty. The name of this pty can then be obtained using ttyname() or other equivalent methods once the user is logged in. The following examples of the inetd.conf entries use the services defined in step 1 (Motorola System V/88 R40):

    dtd-9000 stream tcp nowait root /usr/sbin/dtelnetd dtelnetd -p /dev/ttyp0 dtd-9001 stream tcp nowait root /usr/sbin/dtelnetd dtelnetd -p /dev/ttyp1 dtd-9002 stream tcp nowait root /usr/sbin/dtelnetd dtelnetd -p /dev/ttyp2

    3. Place the dtelnetd server binary in the appropriate directory.

    This directory is the one specified in the inetd.conf file above. Find the appropriate directory for your system and place the file there.

    4. Activate the new services through inetd.

    Before the changes made to the above files become effective, inetd must be restarted.
    This is usually accomplished by sending a SIGHUP to the inetd processes (which will then be automatically respawned).
    This can be done as follows:

    kill -1 <inetd pid>

    Using Command-Override

    By default, the dtelnetd daemon will spawn the command, login, whenever it receives a new connection request. The default command can be overridden by using the -c option for command override. Add the -c option to the end of the dtelnetd configuration line in the inetd.conf file, as in the following example:

    • dtd-9000 stream tcp nowait root /usr/sbin/dtelnetd dtelnetd \
      -p /dev/ttyp0 -c mylogin ttyp0 arg2 arg3
    • NOTE: The above example should be entered as a single line

    The entry will execute the command "mylogin ttyp0 arg2 arg2" instead of the standard login command. The -c option and its associated arguments must be the last option on the command line in inetd. In addition, inetd does not support quoting or other shell-related features. Some versions of inetd impose a limit on the number of arguments which may be supplied. See your operating system documentation for more information.

    Configuring the port server

    To configure the port server to use the dtelnetd services you have configured, set up a custom configuration for each port that needs to be mapped to a pty port. The custom configuration options that are most pertinent are sessions and wait for keyboard hit.

    One session should be configured which contains the following command line:   telnet { host } { dtelnetd port } where   host IP address or hostname of the dtelnetd host. dtelnetd port TCP port of the PTY device you want to map to. Wait for Keyboard Hit 

    This option determines whether the above telnet session will be started immediately or whether it will be delayed until a terminal attached to the port server serial port gets a keyboard hit. If possible, this option should be set to yes to prevent the telnet session from starting until a user initiates it from the terminal