1.\" $NetBSD: telnetd.8,v 1.20 1999/07/02 06:32:08 itojun Exp $ 2.\" 3.\" Copyright (c) 1983, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" from: @(#)telnetd.8 8.3 (Berkeley) 3/1/94 35.\" 36.Dd March 1, 1994 37.Dt TELNETD 8 38.Os 39.Sh NAME 40.Nm telnetd 41.Nd DARPA 42.Tn TELNET 43protocol server 44.Sh SYNOPSIS 45.Nm /usr/libexec/telnetd 46.Op Fl Uhlkns46 47.Op Fl D Ar debugmode 48.Op Fl I Ns Ar initid 49.Op Fl S Ar tos 50.Op Fl X Ar authtype 51.Op Fl a Ar authmode 52.Op Fl edebug 53.Op Fl g Ar gettyent 54.Op Fl r Ns Ar lowpty-highpty 55.Op Fl u Ar len 56.Op Fl debug Op Ar port 57.Sh DESCRIPTION 58The 59.Nm 60command is a server which supports the 61.Tn DARPA 62standard 63.Tn TELNET 64virtual terminal protocol. 65.Nm 66is normally invoked by the internet server (see 67.Xr inetd 8 ) 68for requests to connect to the 69.Tn TELNET 70port as indicated by the 71.Pa /etc/services 72file (see 73.Xr services 5 ) . 74The 75.Fl debug 76option may be used to start up 77.Nm 78manually, instead of through 79.Xr inetd 8 . 80If started up this way, 81.Ar port 82may be specified to run 83.Nm 84on an alternate 85.Tn TCP 86port number. 87.Pp 88The 89.Nm 90command accepts the following options: 91.Bl -tag -width "-a authmode" 92.It Fl a Ar authmode 93This option may be used for specifying what mode should 94be used for authentication. 95Note that this option is only useful if 96.Nm 97has been compiled with support for the 98.Dv AUTHENTICATION 99option. 100There are several valid values for 101.Ar authmode: 102.Bl -tag -width debug 103.It debug 104Turns on authentication debugging code. 105.It user 106Only allow connections when the remote user 107can provide valid authentication information 108to identify the remote user, 109and is allowed access to the specified account 110without providing a password. 111.It valid 112Only allow connections when the remote user 113can provide valid authentication information 114to identify the remote user. 115The 116.Xr login 1 117command will provide any additional user verification 118needed if the remote user is not allowed automatic 119access to the specified account. 120.It other 121Only allow connections that supply some authentication information. 122This option is currently not supported 123by any of the existing authentication mechanisms, 124and is thus the same as specifying 125.Fl a 126.Cm valid . 127.It none 128This is the default state. 129Authentication information is not required. 130If no or insufficient authentication information 131is provided, then the 132.Xr login 1 133program will provide the necessary user 134verification. 135.It off 136This disables the authentication code. 137All user verification will happen through the 138.Xr login 1 139program. 140.El 141.It Fl D Ar debugmode 142This option may be used for debugging purposes. 143This allows 144.Nm 145to print out debugging information 146to the connection, allowing the user to see what 147.Nm 148is doing. 149There are several possible values for 150.Ar debugmode: 151.Bl -tag -width exercise 152.It Cm options 153Prints information about the negotiation of 154.Tn TELNET 155options. 156.It Cm report 157Prints the 158.Cm options 159information, plus some additional information 160about what processing is going on. 161.It Cm netdata 162Displays the data stream received by 163.Nm "" . 164.It Cm ptydata 165Displays data written to the pty. 166.It Cm exercise 167Has not been implemented yet. 168.El 169.It Fl debug 170Enables debugging on each socket created by 171.Nm 172(see 173.Dv SO_DEBUG 174in 175.Xr socket 2 ) . 176.It Fl edebug 177If 178.Nm 179has been compiled with support for data encryption, then the 180.Fl edebug 181option may be used to enable encryption debugging code. 182.It Fl g Ar gettyent 183Specifies which entry from 184.Pa /etc/gettytab 185should be used to get banner strings, login program and 186other information. The default entry is 187.Dv default. 188.It Fl h 189Disables the printing of host-specific information before 190login has been completed. 191.It Fl I Ar initid 192This option is only applicable to 193.Tn UNICOS 194systems prior to 7.0. 195It specifies the 196.Dv ID 197from 198.Pa /etc/inittab 199to use when init starts login sessions. The default 200.Dv ID 201is 202.Dv fe. 203.It Fl k 204This option is only useful if 205.Nm 206has been compiled with both linemode and kludge linemode 207support. If the 208.Fl k 209option is specified, then if the remote client does not 210support the 211.Dv LINEMODE 212option, then 213.Nm 214will operate in character at a time mode. 215It will still support kludge linemode, but will only 216go into kludge linemode if the remote client requests 217it. 218(This is done by by the client sending 219.Dv DONT SUPPRESS-GO-AHEAD 220and 221.Dv DONT ECHO . ) 222The 223.Fl k 224option is most useful when there are remote clients 225that do not support kludge linemode, but pass the heuristic 226(if they respond with 227.Dv WILL TIMING-MARK 228in response to a 229.Dv DO TIMING-MARK) 230for kludge linemode support. 231.It Fl l 232Specifies line mode. Tries to force clients to use line- 233at-a-time mode. 234If the 235.Dv LINEMODE 236option is not supported, it will go 237into kludge linemode. 238.It Fl n 239Disable 240.Dv TCP 241keep-alives. Normally 242.Nm 243enables the 244.Tn TCP 245keep-alive mechanism to probe connections that 246have been idle for some period of time to determine 247if the client is still there, so that idle connections 248from machines that have crashed or can no longer 249be reached may be cleaned up. 250.It Fl r Ar lowpty-highpty 251This option is only enabled when 252.Nm 253is compiled for 254.Dv UNICOS. 255It specifies an inclusive range of pseudo-terminal devices to 256use. If the system has sysconf variable 257.Dv _SC_CRAY_NPTY 258configured, the default pty search range is 0 to 259.Dv _SC_CRAY_NPTY; 260otherwise, the default range is 0 to 128. Either 261.Ar lowpty 262or 263.Ar highpty 264may be omitted to allow changing 265either end of the search range. If 266.Ar lowpty 267is omitted, the - character is still required so that 268.Nm 269can differentiate 270.Ar highpty 271from 272.Ar lowpty . 273.It Fl s 274This option is only enabled if 275.Nm 276is compiled with support for secure logins. 277It causes the 278.Fl s 279option to be passed on to 280.Xr login 1 , 281and thus is only useful if 282.Xr login 1 283supports the 284.Fl s 285flag to indicate that only 286Kerberos or S/Key 287validated logins are allowed, and is 288usually useful for controlling remote logins 289from outside of a firewall. 290.It Fl S Ar tos 291.It Fl u Ar len 292This option is used to specify the size of the field 293in the 294.Dv utmp 295structure that holds the remote host name. 296If the resolved host name is longer than 297.Ar len , 298the dotted decimal value will be used instead. 299This allows hosts with very long host names that 300overflow this field to still be uniquely identified. 301Specifying 302.Fl u0 303indicates that only dotted decimal addresses 304should be put into the 305.Pa utmp 306file. 307.It Fl U 308This option causes 309.Nm 310to refuse connections from addresses that 311cannot be mapped back into a symbolic name 312via the 313.Xr gethostbyaddr 3 314routine. 315.It Fl X Ar authtype 316This option is only valid if 317.Nm 318has been built with support for the authentication option. 319It disables the use of 320.Ar authtype 321authentication, and 322can be used to temporarily disable 323a specific authentication type without having to recompile 324.Nm "" . 325.It Fl 4 326.It Fl 6 327Specifies address family to be used on 328.Fl debug 329mode. 330During normal operation 331.Po 332called from 333.Xr inetd 8 334.Pc 335.Nm 336will use the file descriptor passed from 337.Xr inetd 8 . 338.El 339.Pp 340.Nm 341operates by allocating a pseudo-terminal device (see 342.Xr pty 4 ) 343for a client, then creating a login process which has 344the slave side of the pseudo-terminal as 345.Dv stdin , 346.Dv stdout 347and 348.Dv stderr . 349.Nm 350manipulates the master side of the pseudo-terminal, 351implementing the 352.Tn TELNET 353protocol and passing characters 354between the remote client and the login process. 355.Pp 356When a 357.Tn TELNET 358session is started up, 359.Nm 360sends 361.Tn TELNET 362options to the client side indicating 363a willingness to do the 364following 365.Tn TELNET 366options, which are described in more detail below: 367.Bd -literal -offset indent 368DO AUTHENTICATION 369WILL ENCRYPT 370DO TERMINAL TYPE 371DO TSPEED 372DO XDISPLOC 373DO NEW-ENVIRON 374DO ENVIRON 375WILL SUPPRESS GO AHEAD 376DO ECHO 377DO LINEMODE 378DO NAWS 379WILL STATUS 380DO LFLOW 381DO TIMING-MARK 382.Ed 383.Pp 384The pseudo-terminal allocated to the client is configured 385to operate in \*(lqcooked\*(rq mode, and with 386.Dv XTABS and 387.Dv CRMOD 388enabled (see 389.Xr tty 4 ) . 390.Pp 391.Nm 392has support for enabling locally the following 393.Tn TELNET 394options: 395.Bl -tag -width "DO AUTHENTICATION" 396.It "WILL ECHO" 397When the 398.Dv LINEMODE 399option is enabled, a 400.Dv WILL ECHO 401or 402.Dv WONT ECHO 403will be sent to the client to indicate the 404current state of terminal echoing. 405When terminal echo is not desired, a 406.Dv WILL ECHO 407is sent to indicate that 408.Tn telnetd 409will take care of echoing any data that needs to be 410echoed to the terminal, and then nothing is echoed. 411When terminal echo is desired, a 412.Dv WONT ECHO 413is sent to indicate that 414.Tn telnetd 415will not be doing any terminal echoing, so the 416client should do any terminal echoing that is needed. 417.It "WILL BINARY" 418Indicates that the client is willing to send a 4198 bits of data, rather than the normal 7 bits 420of the Network Virtual Terminal. 421.It "WILL SGA" 422Indicates that it will not be sending 423.Dv IAC GA, 424go ahead, commands. 425.It "WILL STATUS" 426Indicates a willingness to send the client, upon 427request, of the current status of all 428.Tn TELNET 429options. 430.It "WILL TIMING-MARK" 431Whenever a 432.Dv DO TIMING-MARK 433command is received, it is always responded 434to with a 435.Dv WILL TIMING-MARK 436.It "WILL LOGOUT" 437When a 438.Dv DO LOGOUT 439is received, a 440.Dv WILL LOGOUT 441is sent in response, and the 442.Tn TELNET 443session is shut down. 444.It "WILL ENCRYPT" 445Only sent if 446.Nm 447is compiled with support for data encryption, and 448indicates a willingness to decrypt 449the data stream. 450.El 451.Pp 452.Nm 453has support for enabling remotely the following 454.Tn TELNET 455options: 456.Bl -tag -width "DO AUTHENTICATION" 457.It "DO BINARY" 458Sent to indicate that 459.Tn telnetd 460is willing to receive an 8 bit data stream. 461.It "DO LFLOW" 462Requests that the client handle flow control 463characters remotely. 464.It "DO ECHO" 465This is not really supported, but is sent to identify a 466.Bx 4.2 467.Xr telnet 1 468client, which will improperly respond with 469.Dv WILL ECHO. 470If a 471.Dv WILL ECHO 472is received, a 473.Dv DONT ECHO 474will be sent in response. 475.It "DO TERMINAL-TYPE" 476Indicates a desire to be able to request the 477name of the type of terminal that is attached 478to the client side of the connection. 479.It "DO SGA" 480Indicates that it does not need to receive 481.Dv IAC GA, 482the go ahead command. 483.It "DO NAWS" 484Requests that the client inform the server when 485the window (display) size changes. 486.It "DO TERMINAL-SPEED" 487Indicates a desire to be able to request information 488about the speed of the serial line to which 489the client is attached. 490.It "DO XDISPLOC" 491Indicates a desire to be able to request the name 492of the X windows display that is associated with 493the telnet client. 494.It "DO NEW-ENVIRON" 495Indicates a desire to be able to request environment 496variable information, as described in RFC 1572. 497.It "DO ENVIRON" 498Indicates a desire to be able to request environment 499variable information, as described in RFC 1408. 500.It "DO LINEMODE" 501Only sent if 502.Nm 503is compiled with support for linemode, and 504requests that the client do line by line processing. 505.It "DO TIMING-MARK" 506Only sent if 507.Nm 508is compiled with support for both linemode and 509kludge linemode, and the client responded with 510.Dv WONT LINEMODE. 511If the client responds with 512.Dv WILL TM, 513the it is assumed that the client supports 514kludge linemode. 515Note that the 516.Op Fl k 517option can be used to disable this. 518.It "DO AUTHENTICATION" 519Only sent if 520.Nm 521is compiled with support for authentication, and 522indicates a willingness to receive authentication 523information for automatic login. 524.It "DO ENCRYPT" 525Only sent if 526.Nm 527is compiled with support for data encryption, and 528indicates a willingness to decrypt 529the data stream. 530.El 531.Pp 532At the end of a login session, 533.Nm 534invokes the 535.Xr ttyaction 3 536facility with an action of "telnetd" and user "root" 537to execute site-specific commands. 538.Sh FILES 539.Pa /etc/services 540.br 541.Pa /etc/inittab 542(UNICOS systems only) 543.br 544.Pa /etc/iptos 545(if supported) 546.br 547.Sh SEE ALSO 548.Xr login 1 , 549.Xr skey 1 , 550.Xr telnet 1 , 551.Xr ttyaction 3 552.Sh STANDARDS 553.Bl -tag -compact -width RFC-1572 554.It Cm RFC-854 555.Tn TELNET 556PROTOCOL SPECIFICATION 557.It Cm RFC-855 558TELNET OPTION SPECIFICATIONS 559.It Cm RFC-856 560TELNET BINARY TRANSMISSION 561.It Cm RFC-857 562TELNET ECHO OPTION 563.It Cm RFC-858 564TELNET SUPPRESS GO AHEAD OPTION 565.It Cm RFC-859 566TELNET STATUS OPTION 567.It Cm RFC-860 568TELNET TIMING MARK OPTION 569.It Cm RFC-861 570TELNET EXTENDED OPTIONS - LIST OPTION 571.It Cm RFC-885 572TELNET END OF RECORD OPTION 573.It Cm RFC-1073 574Telnet Window Size Option 575.It Cm RFC-1079 576Telnet Terminal Speed Option 577.It Cm RFC-1091 578Telnet Terminal-Type Option 579.It Cm RFC-1096 580Telnet X Display Location Option 581.It Cm RFC-1123 582Requirements for Internet Hosts -- Application and Support 583.It Cm RFC-1184 584Telnet Linemode Option 585.It Cm RFC-1372 586Telnet Remote Flow Control Option 587.It Cm RFC-1416 588Telnet Authentication Option 589.It Cm RFC-1411 590Telnet Authentication: Kerberos Version 4 591.It Cm RFC-1412 592Telnet Authentication: SPX 593.It Cm RFC-1571 594Telnet Environment Option Interoperability Issues 595.It Cm RFC-1572 596Telnet Environment Option 597.El 598.Sh BUGS 599Some 600.Tn TELNET 601commands are only partially implemented. 602.Pp 603Because of bugs in the original 604.Bx 4.2 605.Xr telnet 1 , 606.Nm 607performs some dubious protocol exchanges to try to discover if the remote 608client is, in fact, a 609.Bx 4.2 610.Xr telnet 1 . 611.Pp 612Binary mode 613has no common interpretation except between similar operating systems 614.Po 615.Ux 616in this case 617.Pc . 618.Pp 619The terminal type name received from the remote client is converted to 620lower case. 621.Pp 622.Nm 623never sends 624.Tn TELNET 625.Dv IAC GA 626(go ahead) commands. 627