v29i132: pidentd-2.7 - Portable Ident Daemon, V2.7, Part09/09

3 views
Skip to first unread message

Peter Eriksson

unread,
Sep 8, 1996, 3:00:00 AM9/8/96
to

Submitted-By: pe...@ifm.liu.se (Peter Eriksson)
Posting-Number: Volume 29, Issue 132
Archive-Name: pidentd-2.7/part09

#!/bin/sh
# This is part 09 of a multipart archive.
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh08724; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= pidentd-2.7/identd.8 ==============
if test ! -d 'pidentd-2.7'; then
$echo 'x -' 'creating directory' 'pidentd-2.7'
mkdir 'pidentd-2.7'
fi
if test -f 'pidentd-2.7/identd.8' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'pidentd-2.7/identd.8' '(file already exists)'
else
$echo 'x -' extracting 'pidentd-2.7/identd.8' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'pidentd-2.7/identd.8' &&
X.\" @(#)identd.8 1.9 92/02/11 Lysator
X.\" Copyright (c) 1992 Peter Eriksson, Lysator, Linkoping University.
X.\" This software has been released into the public domain.
X.\"
X.TH IDENTD 8 "27 May 1992"
X.SH NAME
identd, in.identd \- TCP/IP IDENT protocol server
X.SH SYNOPSIS
X.B /usr/local/sbin/[in.]identd
X.RB [ \-i | \-w | \-b ]
X.RB [ \-t<seconds> ]
X.RB [ \-u<uid> ]
X.RB [ \-g<gid> ]
X.RB [ \-p<port> ]
X.RB [ \-a<address> ]
X.RB [ \-c<charset> ]
X.RB [ \-C [ <keyfile> ]]
X.RB [ \-o ]
X.RB [ \-e ]
X.RB [ \-l ]
X.RB [ \-V ]
X.RB [ \-m ]
X.RB [ \-N ]
X.RB [ \-d ]
X.RB [ \-F<format> ]
X.RB [ "kernelfile" [ "kmemfile" ] ]
X.SH DESCRIPTION
X.IX "identd daemon" "" \fLidentd\fP daemon"
X.B identd
is a server which implements the
X.SM TCP/IP
proposed standard
X.SM IDENT
user identification protocol as specified in the
X.SM RFC\s0 1413
document.
X.PP
X.B identd
operates by looking up specific
X.SM TCP/IP
connections and returning the user name of the
process owning the connection. It can optionally
return other information instead of a user name.
X.SH ARGUMENTS
The
X.B \-i
flag, which is the default mode, should be used when starting the
daemon from
X.B inetd
with the "nowait" option in the
X.B /etc/inetd.conf
file. Use of this mode will make
X.B inetd
start one
X.B identd
daemon for each connection request.
X.PP
The
X.B \-w
flag should be used when starting the daemon from
X.B inetd
with the "wait" option in the
X.B /etc/inetd.conf
file . This is the prefered mode of
operation since that will start a copy of
X.B identd
at the first connection request and then
X.B identd
will handle subsequent requests
without having to do the nlist lookup in the kernel file for
every request as in the
X.B \-i
mode above. The
X.B identd
daemon will run either forever, until a bug
makes it crash or a timeout, as specified by the
X.B \-t
flag, occurs.
X.PP
The
X.B \-b
flag can be used to make the daemon run in standalone mode without
the assistance from
X.BR inetd.
This mode is the least prefered mode since
a bug or any other fatal condition in the server will make it terminate
and it will then have to be restarted manually. Other than that it has the
same advantage as the
X.B \-w
mode in that it parses the nlist only once.
X.PP
The
X.B \-t<seconds>
option is used to specify the timeout limit. This is the number
of seconds a server started with the
X.B \-w
flag will wait for new connections before terminating. The server is
automatically restarted by
X.B inetd
whenever a new connection is requested
if it has terminated. A suitable value for this is 120 (2 minutes), if
used. It defaults to no timeout (i.e. will wait forever, or until a
fatal condition occurs in the server).
X.PP
The
X.B \-u<uid>
option is used to specify a user id number which the
X.BR ident
server should
switch to after binding itself to the
X.SM TCP/IP
port if using the
X.B \-b
mode of operation.
X.PP
The
X.B \-g<gid>
option is used to specify a group id number which the
X.BR ident
server should
switch to after binding itself to the
X.SM TCP/IP
port if using the
X.B \-b
mode of operation.
X.PP
The
X.B \-p<port>
option is used to specify an alternative port number to bind to if using
the
X.B \-b
mode of operation. It can be specified by name or by number. Defaults to the
X.SM IDENT
port (113).
X.PP
The
X.B \-a<address>
option is used to specify the local address to bind the socket to if using
the
X.B \-b
mode of operation. Can only be specified by IP address and not by domain
name. Defaults to the
X.SM INADDR_ANY
address which normally means all local addresses.
X.PP
The
X.B \-V
flag makes
X.B identd
display the version number and then exit.
X.PP
The
X.B \-l
flag tells
X.B identd
to use the System logging daemon
X.B syslogd
for logging purposes.
X.PP
The
X.B \-o
flag tells
X.B identd
to not reveal the operating system type it is run on and to instead
always return "OTHER".
X.PP
The
X.B \-e
flag tells
X.B identd
to always return "UNKNOWN-ERROR" instead of the "NO-USER" or
"INVALID-PORT" errors.
X.PP
The
X.B \-c<charset>
flags tells
X.B identd
to add the optional (according to the IDENT protocol) character set
designator to the reply generated.
X.I charset
should be a valid character set as described in the MIME RFC in upper
case characters.
X.PP
The
X.BR \-C [ <keyfile> ]
option tells
X.B identd
to return encrypted tokens instead of user names.
The local and remote IP
addresses and TCP port numbers, the local user's uid number, a timestamp,
a random number, and a checksum, are all encrypted using DES
with a secret key derived from the first line of the
X.I keyfile
(using
X.BR des_string_to_key (3)).
The encrypted binary information is then encoded in a base64 string
(32 characters in length) and enclosed in square brackets to produce
a token that is transmitted to the remote client.
The encrypted token can later be decrypted by
X.BR idecrypt (8).
There may not be a space between the
X.B \-C
and the name of the
X.IR keyfile .
If the
X.I keyfile
is not specified, it defaults to
X.BR /etc/identd.key .
X.PP
The
X.B \-n
flag tells
X.B identd
to always return user numbers instead of user names if you wish to
keep the user names a secret.
The
X.B \-N
flag makes
X.B identd
check for a file ".noident" in each homedirectory for a user which the
daemon is about to return the user name for. It that file exists then the
daemon will give the error
X.B HIDDEN-USER
instead of the normal USERID response.
X.PP
X.B \-m
flag makes
X.B identd
use a mode of operation that will allow multiple requests to be
processed per session. Each request is specified one per line and
the responses will be returned one per line. The connection will not
be closed until the connecting part closes it's end of the line.
PLEASE NOTE THAT THIS MODE VIOLATES THE PROTOCOL SPECIFICATION AS
IT CURRENTLY STANDS.
X.PP
The
X.B \-d
flag enables some debugging code that normally should NOT
be enabled since that breaks the protocol and may reveal information
that should not be available to outsiders.
X.PP
The
X.B \-F<format>
option makes
X.B identd
use the specified format to display info. The allowed format specifiers are:
X.in +.5i
X.nf
%u print user name
%U print user number
%g print (primary) group name
%G print (primary) group number
%l print list of all groups by name
%L print list of all groups by number
%p print process ID of running process
%c print command name
%C print command and arguments
X.in -.5i
X.fi
The lists of groups (%l, %L) are comma-separated, and start with the primary
group which is not repeated. The %p and the %c and %C formats are not
supported on all architecture implementations (printing 0 or empty string
instead).
X.br
Any other characters (preceded by %, and those not preceded by it) are
printed literally. The "default" format is %u, and you should not use
anything else without the
X.B \-o
flag.
X.br
Not implemented yet, but on my wish-list are the following:
X.in +.5i
X.nf
%w print working (current) directory
%h print home (login, naming) directory
%e print the environment
X.in -.5i
X.fi
X.PP
X.B kernelfile
defaults to the normally running kernel file.
X.PP
X.B kmemfile
defaults to the memory space of the normally running kernel.
X.SH UNDOCUMENTED FLAGS
The
X.B \-v
flag enables more verbose output or messages. (Further occurences of the
X.B -v
flag make things even more verbose.) Currently not used: ignored.
X.PP
The
X.B \-f<config-file>
option causes
X.B identd
to use the named config file (instead of the default /etc/identd.conf ?).
Currently not used: ignored, no config files are used.
X.PP
The
X.B \-r<indirect_host>
option is used in some way (for proxy queries?).
X.PP
The
X.B \-C<keyfile>
option is used in some way for DES encryption.
X.SH INSTALLATION
X.B identd
is invoked either by the internet server (see
X.BR inetd (8C)
) for requests to connect to the
X.SM IDENT
port as indicated by the
X.B /etc/services
file (see
X.BR services (5)
) when using the
X.B \-w
or
X.B \-i
modes of operation or started manually by using the
X.B \-b
mode of operation.
X.SH EXAMPLES
Assuming the server is located in
X.B /usr/etc/in.identd
one can put either:
X.PP
ident stream tcp wait sys /usr/etc/in.identd in.identd -w -t120
X.PP
or:
X.PP
ident stream tcp nowait sys /usr/etc/in.identd in.identd -i
X.PP
into the
X.B /etc/inetd.conf
file. User "sys" should have enough rights to READ the kernel
but NOT to write to it.
X.PP
To start it using the
X.B \-b
mode of operation one can put a line like this into the
X.B /etc/rc.local
file:
X.PP
/usr/etc/in.identd -b -u2 -g2
X.PP
This will make it run in the background as user 2, group 2 (user "sys",
group "kmem" on SunOS 4.1.1).
X.SH NOTES
The username (or UID) returned ought to be the login name. However it
(probably, for most architecture implementations) is the "real user ID" as
stored with the process; there is no provision for returning the "effective
user ID". Thus the UID returned may be different from the login name for
setuid programs (or those running as root) which done a
X.BR setuid (3)
call and their children. For example, it may (should?) be wrong for an
incoming
X.B ftpd
; and we are probably interested in the running shell, not the
X.B telnetd
for an incoming telnet session. (But of course
X.B identd
returns info for outgoing connections, not incoming ones.)
X.PP
The group or list of groups returned (with the
X.B \-F
option) are as looked up in the
X.B /etc/passwd
and
X.B /etc/group
files, based on the UID returned. Thus these may not relate well to the
group(s) of the running process for setuid or setgid programs or their
children.
X.PP
The command names returned with formats %c and %C may be different, use
one or the other or both.
X.SH FILES
X.TP
X.B /usr/local/etc/identd.conf
This file is as yet un-used, but will eventually contain configuration
options for
X.B identd
X.TP
X.B /usr/local/etc/identd.key
If compiled with
X.I \-ldes
this file can be used to specify a secret key for encrypting replies.
X.SH "SEE ALSO"
X.BR authuser (3)
,
X.BR inetd.conf (5)
,
X.BR idecrypt (8)
X.SH BUGS
The handling of fatal errors could be better.
SHAR_EOF
$shar_touch -am 0811230996 'pidentd-2.7/identd.8' &&
chmod 0644 'pidentd-2.7/identd.8' ||
$echo 'restore of' 'pidentd-2.7/identd.8' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'pidentd-2.7/identd.8:' 'MD5 check failed'
f4a4a0b17431f6b04b923b7391d3d433 pidentd-2.7/identd.8
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pidentd-2.7/identd.8'`"
test 9931 -eq "$shar_count" ||
$echo 'pidentd-2.7/identd.8:' 'original size' '9931,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh08724
exit 0

Reply all
Reply to author
Forward
0 new messages