1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
|
.\" Copyright (c) 1983 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)telnetd.8 6.8 (Berkeley) 4/20/91
.\" $Id: telnetd.8,v 1.5 2006-09-24 00:48:31 ianb Exp $
.\"
.Dd December 29, 1996
.Dt TELNETD 8
.Os "Linux NetKit (0.17)"
.Sh NAME
.Nm telnetd
.Nd DARPA
.Tn telnet
protocol server
.Sh SYNOPSIS
.Nm /usr/sbin/in.telnetd
.Op Fl hnNs
.Op Fl a Ar authmode
.Op Fl D Ar debugmode
.Op Fl L Ar loginprg
.Op Fl S Ar tos
.Op Fl X Ar authtype
.Op Fl edebug
.Op Fl debug Ar port
.Op Fl z Ar sslopt
.Sh DESCRIPTION
The
.Nm telnetd
program is a server which supports the
.Tn DARPA
.Tn telnet
interactive communication protocol.
.Nm Telnetd
is normally invoked by the internet server (see
.Xr inetd 8 )
for requests to connect to the
.Tn telnet
port as indicated by the
.Pa /etc/services
file (see
.Xr services 5 ) .
The
.Fl debug
option may be used to start up
.Nm telnetd
manually, instead of through
.Xr inetd 8 .
If started up this way,
.Ar port
may be specified to run
.Nm telnetd
on an alternate
.Tn TCP
port number.
.Pp
The
.Nm telnetd
program accepts the following options:
.Bl -tag -width "-a authmode"
.It Fl a Ar authmode
This option may be used for specifying what mode should
be used for authentication.
Note that this option is only useful if
.Nm telnetd
has been compiled with support for authentication, which is not
available in the current version. The following values of
.Ar authmode
are understood:
.Bl -tag -width debug
.It debug
Turns on authentication debugging code.
.It user
Only allow connections when the remote user can provide valid
authentication information to identify the remote user, and is allowed
access to the specified account without providing a password.
.It valid
Only allow connections when the remote user can provide valid
authentication information to identify the remote user. The
.Xr login 1
command will provide any additional user verification needed if the
remote user is not allowed automatic access to the specified account.
.It other
Only allow connections that supply some authentication information.
This option is currently not supported by any of the existing
authentication mechanisms, and is thus the same as specifying
.Cm valid .
.It none
This is the default state. Authentication information is not
required. If no or insufficient authentication information is
provided, then the
.Xr login 1
program will provide the necessary user verification.
.It off
This disables the authentication code. All user verification will
happen through the
.Xr login 1
program.
.El
.It Fl D Ar debugmode
This option may be used for debugging purposes. It allows
.Nm telnetd
to print out debugging information to the connection, allowing the
user to see what
.Nm telnetd
is doing. Repeated use of the option arranges composite debug reports.
There are several possible values for
.Ar debugmode:
.Bl -tag -width exercise
.It Cm options
Prints information about the negotiation of
.Tn telnet
options.
.It Cm report
Prints the
.Cm options
information, plus some additional information about what processing is
going on.
.It Cm netdata
Displays the data stream received by
.Nm telnetd.
.It Cm ptydata
Displays data written to the pty.
.It Cm exercise
Has not been implemented yet.
.El
.It Fl edebug
If
.Nm telnetd
has been compiled with support for encryption, then the
.Fl edebug
option may be used to enable encryption debugging code.
.It Fl h
Disables the printing of host-specific information before
login has been completed.
.It Fl L Ar loginprg
This option may be used to specify a different login program.
By default,
.Pa /usr/lib/telnetlogin
is used.
.It Fl n
Disable
.Dv TCP
keep-alives. Normally
.Nm telnetd
enables the
.Tn TCP
keep-alive mechanism to probe connections that
have been idle for some period of time to determine
if the client is still there, so that idle connections
from machines that have crashed or can no longer
be reached may be cleaned up.
.It Fl N
Disable reverse DNS lookups and use the numeric IP address in logs
and REMOTEHOST environment variable.
.It Fl s
This option is only enabled if
.Nm telnetd
is compiled with support for
.Tn SecurID
cards.
It causes the
.Fl s
option to be passed on to
.Xr login 1 ,
and thus is only useful if
.Xr login 1
supports the
.Fl s
flag to indicate that only
.Tn SecurID
validated logins are allowed. This is usually useful for controlling
remote logins from outside of a firewall.
.It Fl S Ar tos
Sets the IP type-of-service (TOS) option for the telnet
connection to the value
.Ar tos .
.It Fl X Ar authtype
This option is only valid if
.Nm telnetd
has been built with support for the authentication option.
It disables the use of
.Ar authtype
authentication, and
can be used to temporarily disable
a specific authentication type without having to recompile
.Nm telnetd .
.It Fl z Ar SSL-parameter
This option is only valid if
.Nm telnetd
has been built with SSL (Secure Socket Layer) support.
.Bl -tag -width Fl
.It Ic debug
Enable SSL related debugging.
.It Ic debug= Ns Ar log_file
Select in addition a specific location
.Ar log_file
for collecting debug output, thus overriding the default file
.Ar /var/tmp/telnetd.log .
.It Ic ssl
Negotiate SSL at first, then use telnet protocol. In this mode telnetd
only accepts connections from SSL enhanced telnet with option
.Ic -z ssl
.It Ic nossl, !ssl
switch off SSL negotiation
.It Ic certsok
Look username up in
.Pa /etc/ssl.users .
The format of this file is lines of the form:
.Ar user1,user2:/C=US/.....
where user1 and user2 are usernames and /C=US/... is the subject name of
the certificate. Use
.Ar openssl x509 -subject -noout
to extract the subject name.
If client certificate is valid,
authenticate without password.
.It Ic certrequired
client certificate is mandatory
.It Ic secure
Don't switch back to unencrypted mode (no SSL) if SSL is not available.
.It Ic verify=int
Set the SSL verify flags. (See SSL_VERIFY_* in
.Ar openssl/ssl.h
).
.It Ic cacert= Ns Ar CA_file
A collection of trusted authority certificates for verification of
whatever the clients care to send as identifiers.
.It Ic cert= Ns Ar cert_file
Present the certificate(s) in
.Ar cert_file
to any client. They are in PEM-format, and the first certificate
identifies the server itself.
.It Ic key= Ns Ar key_file
Use the key(s) in
.Ar key_file
in case a key is not stored together with the certificate.
.It Ic cipher= Ns Ar ciph_list
Set the preferred ciphers to
.Ar ciph_list .
.\" TODO: possible values; comma-separated list?
The environment variable SSL_CIPHER serves the same purpose.
(See
.Ar openssl/ssl.h
).
.El
.El
.Pp
If the file
.Pa /etc/issue.net
is present,
.Nm telnetd
will display its contents before the login prompt of a telnet session (see
.Xr issue.net 5 ) .
.Pp
.Nm Telnetd
operates by allocating a pseudo-terminal device (see
.Xr pty 4 )
for a client, then creating a login process which has
the slave side of the pseudo-terminal as
.Dv stdin ,
.Dv stdout ,
and
.Dv stderr .
.Nm Telnetd
manipulates the master side of the pseudo-terminal,
implementing the
.Tn telnet
protocol and passing characters
between the remote client and the login process.
.Pp
When a
.Tn telnet
session is started up,
.Nm telnetd
sends
.Tn telnet
options to the client side indicating
a willingness to do the
following
.Tn telnet
options, which are described in more detail below:
.Bd -literal -offset indent
DO AUTHENTICATION
WILL ENCRYPT
DO TERMINAL TYPE
DO TSPEED
DO XDISPLOC
DO NEW-ENVIRON
WILL SUPPRESS GO AHEAD
DO ECHO
DO LINEMODE
DO NAWS
WILL STATUS
DO LFLOW
DO TIMING-MARK
.Ed
.Pp
The pseudo-terminal allocated to the client is configured
to operate in \(Lqcooked\(Rq mode, and with
.Dv XTABS
.Dv CRMOD
enabled (see
.Xr tty 4 ) .
.Pp
.Nm Telnetd
has support for enabling locally the following
.Tn telnet
options:
.Bl -tag -width "DO AUTHENTICATION"
.It "WILL ECHO"
When the
.Dv LINEMODE
option is enabled, a
.Dv WILL ECHO
or
.Dv WONT ECHO
will be sent to the client to indicate the
current state of terminal echoing.
When terminal echo is not desired, a
.Dv WILL ECHO
is sent to indicate that
.Tn telnetd
will take care of echoing any data that needs to be
echoed to the terminal, and then nothing is echoed.
When terminal echo is desired, a
.Dv WONT ECHO
is sent to indicate that
.Tn telnetd
will not be doing any terminal echoing, so the
client should do any terminal echoing that is needed.
.It "WILL BINARY"
Indicates that the client is willing to send a
8 bits of data, rather than the normal 7 bits
of the Network Virtual Terminal.
.It "WILL SGA"
Indicates that it will not be sending
.Dv IAC GA,
go ahead, commands.
.It "WILL STATUS"
Indicates a willingness to send the client, upon
request, of the current status of all
.Tn TELNET
options.
.It "WILL TIMING-MARK"
Whenever a
.Dv DO TIMING-MARK
command is received, it is always responded
to with a
.Dv WILL TIMING-MARK
.It "WILL LOGOUT"
When a
.Dv DO LOGOUT
is received, a
.Dv WILL LOGOUT
is sent in response, and the
.Tn TELNET
session is shut down.
.It "WILL ENCRYPT"
Only sent if
.Nm telnetd
is compiled with support for data encryption, and
indicates a willingness to decrypt
the data stream.
.El
.Pp
.Nm Telnetd
has support for enabling remotely the following
.Tn TELNET
options:
.Bl -tag -width "DO AUTHENTICATION"
.It "DO BINARY"
Sent to indicate that
.Tn telnetd
is willing to receive an 8 bit data stream.
.It "DO LFLOW"
Requests that the client handle flow control
characters remotely.
.It "DO ECHO"
This is not really supported, but is sent to identify a 4.2BSD
.Xr telnet 1
client, which will improperly respond with
.Dv WILL ECHO.
If a
.Dv WILL ECHO
is received, a
.Dv DONT ECHO
will be sent in response.
.It "DO TERMINAL-TYPE"
Indicates a desire to be able to request the
name of the type of terminal that is attached
to the client side of the connection.
.It "DO SGA"
Indicates that it does not need to receive
.Dv IAC GA,
the go ahead command.
.It "DO NAWS"
Requests that the client inform the server when
the window (display) size changes.
.It "DO TERMINAL-SPEED"
Indicates a desire to be able to request information
about the speed of the serial line to which
the client is attached.
.It "DO XDISPLOC"
Indicates a desire to be able to request the name
of the X windows display that is associated with
the telnet client.
.It "DO NEW-ENVIRON"
Indicates a desire to be able to request environment
variable information, as described in RFC 1572.
.It "DO LINEMODE"
Only sent if
.Nm telnetd
is compiled with support for linemode, and
requests that the client do line by line processing.
.It "DO TIMING-MARK"
Only sent if
.Nm telnetd
is compiled with support for both linemode and
kludge linemode, and the client responded with
.Dv WONT LINEMODE.
If the client responds with
.Dv WILL TM,
the it is assumed that the client supports
kludge linemode.
Note that the
.Op Fl k
option can be used to disable this.
.It "DO AUTHENTICATION"
Only sent if
.Nm telnetd
is compiled with support for authentication, and
indicates a willingness to receive authentication
information for automatic login.
.It "DO ENCRYPT"
Only sent if
.Nm telnetd
is compiled with support for data encryption, and
indicates a willingness to decrypt
the data stream.
.El
.Sh FILES
.Pa /etc/services ,
.Pa /etc/issue.net ,
.Pa /etc/ssl.users
.Sh "SEE ALSO"
.Xr telnet 1 ,
.Xr login 1 ,
.Xr issue.net 5 ,
.Sh STANDARDS
.Bl -tag -compact -width RFC-1572
.It Cm RFC-854
.Tn TELNET
PROTOCOL SPECIFICATION
.It Cm RFC-855
TELNET OPTION SPECIFICATIONS
.It Cm RFC-856
TELNET BINARY TRANSMISSION
.It Cm RFC-857
TELNET ECHO OPTION
.It Cm RFC-858
TELNET SUPPRESS GO AHEAD OPTION
.It Cm RFC-859
TELNET STATUS OPTION
.It Cm RFC-860
TELNET TIMING MARK OPTION
.It Cm RFC-861
TELNET EXTENDED OPTIONS - LIST OPTION
.It Cm RFC-885
TELNET END OF RECORD OPTION
.It Cm RFC-1073
Telnet Window Size Option
.It Cm RFC-1079
Telnet Terminal Speed Option
.It Cm RFC-1091
Telnet Terminal-Type Option
.It Cm RFC-1096
Telnet X Display Location Option
.It Cm RFC-1123
Requirements for Internet Hosts -- Application and Support
.It Cm RFC-1184
Telnet Linemode Option
.It Cm RFC-1372
Telnet Remote Flow Control Option
.It Cm RFC-1416
Telnet Authentication Option
.It Cm RFC-1411
Telnet Authentication: Kerberos Version 4
.It Cm RFC-1412
Telnet Authentication: SPX
.It Cm RFC-1571
Telnet Environment Option Interoperability Issues
.It Cm RFC-1572
Telnet Environment Option
.El
.Sh BUGS
Some
.Tn TELNET
commands are only partially implemented.
.Pp
Because of bugs in the original 4.2 BSD
.Xr telnet 1 ,
.Nm telnetd
performs some dubious protocol exchanges to try to discover if the remote
client is, in fact, a 4.2 BSD
.Xr telnet 1 .
.Pp
Binary mode
has no common interpretation except between similar operating systems
(Unix in this case).
.Pp
The terminal type name received from the remote client is converted to
lower case.
.Pp
.Nm Telnetd
never sends
.Tn TELNET
.Dv IAC GA
(go ahead) commands.
.Pp
The source code is not comprehensible.
|