]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/pppd.8
use strlcpy, strlcat, slprintf everywhere
[ppp.git] / pppd / pppd.8
index 4a1fecb077048d7bdf1bd62a96af742df114ea63..b4bbdb035e5798114657d896fd81bb7e0ad26bdb 100644 (file)
@@ -1,5 +1,5 @@
 .\" manual page [] for pppd 2.3
-.\" $Id: pppd.8,v 1.21 1996/08/28 06:41:53 paulus Exp $
+.\" $Id: pppd.8,v 1.34 1999/03/12 06:07:19 paulus Exp $
 .\" SH section heading
 .\" SS subsection heading
 .\" LP paragraph
@@ -35,10 +35,10 @@ Control Protocol, IPCP).
 .I <tty_name>
 Communicate over the named device.  The string "/dev/" is prepended if
 necessary.  If no device name is given, or if the name of the terminal
-connected to the standard input is given, pppd
-will use that terminal, and will not fork to put itself in the
-background.  This option is privileged if the \fInoauth\fR option is
-used.
+connected to the standard input is given, pppd will use that terminal,
+and will not fork to put itself in the background.  A value for this
+option from a privileged source cannot be overridden by a
+non-privileged user.
 .TP
 .I <speed>
 Set the baud rate to <speed> (a decimal number).  On systems such as
@@ -60,25 +60,49 @@ characters, use the \fIescape\fR option.
 .TP
 .B auth
 Require the peer to authenticate itself before allowing network
-packets to be sent or received.
+packets to be sent or received.  This option is the default if the
+system has a default route.  If neither this option nor the
+\fInoauth\fR option is specified, pppd will only allow the peer to use
+IP addresses to which the system does not already have a route.
 .TP
 .B call \fIname
 Read options from the file /etc/ppp/peers/\fIname\fR.  This file may
 contain privileged options, such as \fInoauth\fR, even if pppd
 is not being run by root.  The \fIname\fR string may not begin with /
-or include .. as a pathname component.
+or include .. as a pathname component.  The format of the options file
+is described below.
 .TP
 .B connect \fIscript
 Use the executable or shell command specified by \fIscript\fR to set
 up the serial line.  This script would typically use the chat(8)
-program to dial the modem and start the remote ppp session.  This
-option is privileged if the \fInoauth\fR option is used.
+program to dial the modem and start the remote ppp session.  A value
+for this option from a privileged source cannot be overridden by a
+non-privileged user.
 .TP
 .B crtscts
-Use hardware flow control (i.e. RTS/CTS) to control the flow of data
-on the serial port.  If neither the \fIcrtscts\fR nor the
-\fI\nocrtscts\fR option is given, the hardware flow control setting
-for the serial port is left unchanged.
+Use hardware flow control (i.e. RTS/CTS) to control the flow of
+data on the serial port.  If neither the \fIcrtscts\fR, the
+\fInocrtscts\fR, the \fIcdtrcts\fR nor the \fInocdtrcts\fR option
+is given, the hardware flow control setting for the serial port is
+left unchanged.
+Some serial ports (such as Macintosh serial ports) lack a true
+RTS output. Such serial ports use this mode to implement
+unidirectional flow control. The serial port will
+suspend transmission when requested by the modem (via CTS)
+but will be unable to request the modem stop sending to the
+computer. This mode retains the ability to use DTR as
+a modem control line.
+.TP
+.B cdtrcts
+Use a non-standard hardware flow control (i.e. DTR/CTS) to control
+the flow of data on the serial port.  If neither the \fIcrtscts\fR,
+the \fInocrtscts\fR, the \fIcdtrcts\fR nor the \fInocdtrcts\fR
+option is given, the hardware flow control setting for the serial
+port is left unchanged.
+Some serial ports (such as Macintosh serial ports) lack a true
+RTS output. Such serial ports use this mode to implement true
+bi-directional flow control. The sacrifice is that this flow
+control mode does not permit using DTR as a modem control line.
 .TP
 .B defaultroute
 Add a default route to the system routing tables, using the peer as
@@ -91,8 +115,8 @@ Run the executable or shell command specified by \fIscript\fR after
 pppd has terminated the link.  This script could, for example, issue
 commands to the modem to cause it to hang up if hardware modem control
 signals were not available.  The disconnect script is not run if the
-modem has already hung up.  This option is privileged if the
-\fInoauth\fR option is used.
+modem has already hung up.  A value for this option from a privileged
+source cannot be overridden by a non-privileged user.
 .TP
 .B escape \fIxx,yy,...
 Specifies that certain characters should be escaped on transmission
@@ -146,6 +170,22 @@ will not accept a different value from the peer in the IPCP
 negotiation, unless the \fIipcp-accept-local\fR and/or
 \fIipcp-accept-remote\fR options are given, respectively.
 .TP
+.B active-filter \fIfilter-expression
+Specifies a packet filter to be applied to data packets to determine
+which packets are to be regarded as link activity, and therefore reset
+the idle timer, or cause the link to be brought up in demand-dialling
+mode.  This option is useful in conjunction with the
+\fBidle\fR option if there are packets being sent or received
+regularly over the link (for example, routing information packets)
+which would otherwise prevent the link from ever appearing to be idle.
+The \fIfilter-expression\fR syntax is as described for tcpdump(1),
+except that qualifiers which are inappropriate for a PPP link, such as
+\fBether\fR and \fBarp\fR, are not permitted.  Generally the filter
+expression should be enclosed in single-quotes to prevent whitespace
+in the expression from being interpreted by the shell. This option
+is currently only available under NetBSD, and then only
+if both the kernel and pppd were compiled with PPP_FILTER defined.
+.TP
 .B bsdcomp \fInr,nt
 Request that the peer compress packets that it sends, using the
 BSD-Compress scheme, with a maximum code size of \fInr\fR bits, and
@@ -155,7 +195,8 @@ given for \fInr\fR.  Values in the range 9 to 15 may be used for
 \fInr\fR and \fInt\fR; larger values give better compression but
 consume more kernel memory for compression dictionaries.
 Alternatively, a value of 0 for \fInr\fR or \fInt\fR disables
-compression in the corresponding direction.
+compression in the corresponding direction.  Use \fInobsdcomp\fR or
+\fIbsdcomp 0\fR to disable BSD-Compress compression entirely.
 .TP
 .B chap-interval \fIn
 If this option is given, pppd will rechallenge the peer every \fIn\fR
@@ -170,7 +211,7 @@ Set the CHAP restart interval (retransmission timeout for challenges)
 to \fIn\fR seconds (default 3).
 .TP
 .B debug
-Increase debugging level.
+Enables connection debugging facilities.
 If this option is given, pppd will log the contents of all
 control packets sent or received in a readable form.  The packets are
 logged through syslog with facility \fIdaemon\fR and level
@@ -195,9 +236,10 @@ the value given for \fInr\fR.  Values in the range 8 to 15 may be used
 for \fInr\fR and \fInt\fR; larger values give better compression but
 consume more kernel memory for compression dictionaries.
 Alternatively, a value of 0 for \fInr\fR or \fInt\fR disables
-compression in the corresponding direction.  (Note: pppd requests
-Deflate compression in preference to BSD-Compress if the peer can do
-either.)
+compression in the corresponding direction.  Use \fInodeflate\fR or
+\fIdeflate 0\fR to disable Deflate compression entirely.  (Note: pppd
+requests Deflate compression in preference to BSD-Compress if the peer
+can do either.)
 .TP
 .B demand
 Initiate the link only on demand, i.e. when data traffic is present.
@@ -223,6 +265,10 @@ specify \fIdomain Quotron.COM\fR.  Pppd would then use the name
 and as the default name to send to the peer when authenticating itself
 to the peer.  This option is privileged.
 .TP
+.B hide-password
+When logging the contents of PAP packets, this option causes pppd to
+exclude the password string from the log.
+.TP
 .B holdoff \fIn
 Specifies how many seconds to wait before re-initiating the link after
 it terminates.  This option only has any effect if the \fIpersist\fR
@@ -234,11 +280,9 @@ Specifies that pppd should disconnect if the link is idle for \fIn\fR
 seconds.  The link is idle when no data packets (i.e. IP packets) are
 being sent or received.  Note: it is not advisable to use this option
 with the \fIpersist\fR option without the \fIdemand\fR option.
-.TP
-.B ipx
-Enable the IPXCP and IPX protocols.  Under Linux, this is the default
-condition if your kernel supports IPX.  This option is presently only
-supported under Linux.
+If the \fBactive-filter\fR
+option is given, data packets which are rejected by the specified
+activity filter also count as the link being idle.
 .TP
 .B ipcp-accept-local
 With this option, pppd will accept the peer's idea of our local IP
@@ -269,6 +313,11 @@ Provides an extra parameter to the ip-up and ip-down scripts.  If this
 option is given, the \fIstring\fR supplied is given as the 6th
 parameter to those scripts.
 .TP
+.B ipx
+Enable the IPXCP and IPX protocols.  This option is presently only
+supported under Linux, and only if your kernel has been configured to
+include IPX support.
+.TP
 .B ipx-network \fIn
 Set the IPX network number in the IPXCP configure request frame to
 \fIn\fR, a hexadecimal number (without a leading 0x).  There is no
@@ -333,7 +382,9 @@ Enable debugging code in the kernel-level PPP driver.  The argument
 \fIn\fR is a number which is the sum of the following values: 1 to
 enable general debug messages, 2 to request that the contents of
 received packets be printed, and 4 to request that the contents of
-transmitted packets be printed.
+transmitted packets be printed.  On most systems, messages printed by
+the kernel are logged by syslog(1) to a file as directed in the
+/etc/syslog.conf configuration file.
 .TP
 .B lcp-echo-failure \fIn
 If this option is given, pppd will presume the peer to be dead
@@ -375,12 +426,14 @@ not change the state of the DTR (Data Terminal Ready) signal.
 .TP
 .B login
 Use the system password database for authenticating the peer using
-PAP, and record the user in the system wtmp file.  Note that if the
-/etc/ppp/pap-secrets file exists, the peer must have an entry in that
-file as well as the system password database to be allowed access.
+PAP, and record the user in the system wtmp file.  Note that the peer
+must have an entry in the /etc/ppp/pap-secrets file as well as the
+system password database to be allowed access.
 .TP
 .B maxconnect \fIn
-Terminate the connection after \fIn\fR seconds.
+Terminate the connection when it has been available for network
+traffic for \fIn\fR seconds (i.e. \fIn\fR seconds after the first
+network control protocol comes up).
 .TP
 .B modem
 Use the modem control lines.  This option is the default.  With this
@@ -396,7 +449,15 @@ If pppd is acting as a server for Microsoft Windows clients, this
 option allows pppd to supply one or two DNS (Domain Name Server)
 addresses to the clients.  The first instance of this option specifies
 the primary DNS address; the second instance (if given) specifies the
-secondary DNS address.
+secondary DNS address.  (This option was present in some older
+versions of pppd under the name \fBdns-addr\fR.)
+.TP
+.B ms-wins \fI<addr>
+If pppd is acting as a server for Microsoft Windows or "Samba"
+clients, this option allows pppd to supply one or two WINS (Windows
+Internet Name Services) server addresses to the clients.  The first
+instance of this option specifies the primary WINS address; the second
+instance (if given) specifies the secondary WINS address.
 .TP
 .B name \fIname
 Set the name of the local system for authentication purposes to
@@ -405,7 +466,8 @@ use lines in the secrets files which have \fIname\fR as the second
 field when looking for a secret to use in authenticating the peer.  In
 addition, unless overridden with the \fIuser\fR option, \fIname\fR
 will be used as the name to send to the peer when authenticating the
-local system to the peer.
+local system to the peer.  (Note that pppd does not append the domain
+name to \fIname\fR.)
 .TP
 .B netmask \fIn
 Set the interface netmask to \fIn\fR, a 32 bit netmask in "decimal dot"
@@ -414,7 +476,9 @@ specified is ORed with the default netmask.  The default netmask is
 chosen based on the negotiated remote IP address; it is the
 appropriate network mask for the class of the remote IP address, ORed
 with the netmasks for any non point-to-point network interfaces in the
-system which are on the same network.
+system which are on the same network.  (Note: on some platforms, pppd
+will always use 255.255.255.255 for the netmask, if that is the only
+appropriate value for a point-to-point interface.)
 .TP
 .B noaccomp
 Disable Address/Control compression in both directions (send and
@@ -422,7 +486,7 @@ receive).
 .TP
 .B noauth
 Do not require the peer to authenticate itself.  This option is
-privileged if the \fIauth\fR option is specified in /etc/ppp/options.
+privileged.
 .TP
 .B nobsdcomp
 Disables BSD-Compress compression; \fBpppd\fR will not request or
@@ -434,10 +498,14 @@ should only be required if the peer is buggy and gets confused by
 requests from pppd for CCP negotiation.
 .TP
 .B nocrtscts
-Disable hardware flow control (i.e. RTS/CTS) on the serial port.  If
-neither the \fIcrtscts\fR nor the \fI\nocrtscts\fR option is given,
-the hardware flow control setting for the serial port is left
-unchanged.
+Disable hardware flow control (i.e. RTS/CTS) on the serial port.
+If neither the \fIcrtscts\fR nor the \fInocrtscts\fR nor the
+\fIcdtrcts\fR nor the \fInodtrcts\fR option is given, the hardware
+flow control setting for the serial port is left unchanged.
+.TP
+.B nodtrcts
+This option is a synonym for \fInocrtscts\fR. Either of these options will
+disable both forms of hardware flow control.
 .TP
 .B nodefaultroute
 Disable the \fIdefaultroute\fR option.  The system administrator who
@@ -520,6 +588,23 @@ seconds (default 3).
 Set the maximum time that pppd will wait for the peer to authenticate
 itself with PAP to \fIn\fR seconds (0 means no limit).
 .TP
+.B pass-filter \fIfilter-expression
+Specifies a packet filter to applied to data packets being sent or
+received to determine which packets should be allowed to pass.
+Packets which are rejected by the filter are silently discarded.  This
+option can be used to prevent specific network daemons (such as
+routed) using up link bandwidth, or to provide a basic firewall
+capability.
+The \fIfilter-expression\fR syntax is as described for tcpdump(1),
+except that qualifiers which are inappropriate for a PPP link, such as
+\fBether\fR and \fBarp\fR, are not permitted.  Generally the filter
+expression should be enclosed in single-quotes to prevent whitespace
+in the expression from being interpreted by the shell.  Note that it
+is possible to apply different constraints to incoming and outgoing
+packets using the \fBinbound\fR and \fBoutbound\fR qualifiers. This
+option is currently only available under NetBSD, and then only if both
+the kernel and pppd were compiled with PPP_FILTER defined.
+.TP
 .B persist
 Do not exit after a connection is terminated; instead try to reopen
 the connection.
@@ -530,6 +615,13 @@ compression, and agree to compress transmitted frames with Predictor-1
 if requested.  This option has no effect unless the kernel driver
 supports Predictor-1 compression.
 .TP
+.B privgroup \fIgroup-name
+Allows members of group \fIgroup-name\fR to use privileged options.
+This is a privileged option.  Use of this option requires care as
+there is no guarantee that members of \fIgroup-name\fR cannot use pppd
+to become root themselves.  Consider it equivalent to putting the
+members of \fIgroup-name\fR in the kmem or disk group.
+.TP
 .B proxyarp
 Add an entry to this system's ARP [Address Resolution Protocol] table
 with the IP address of the peer and the Ethernet address of this
@@ -564,7 +656,8 @@ the `passive' option with ancient versions of pppd).
 .B usehostname
 Enforce the use of the hostname (with domain name appended, if given)
 as the name of the local system for authentication purposes (overrides
-the \fIname\fR option).
+the \fIname\fR option).  This option is not normally needed since the
+\fIname\fR option is privileged.
 .TP
 .B user \fIname
 Sets the name used for authenticating the local system to the peer to
@@ -578,8 +671,8 @@ must be between 2 and 16 (inclusive).
 .B welcome \fIscript
 Run the executable or shell command specified by \fIscript\fR before
 initiating PPP negotiation, after the connect script (if any) has
-completed.  This option is privileged if the \fInoauth\fR option is
-used.
+completed.  A value for this option from a privileged source cannot be
+overridden by a non-privileged user.
 .TP
 .B xonxoff
 Use software flow control (i.e. XON/XOFF) to control the flow of data on
@@ -596,10 +689,34 @@ the initial /dev/ is removed from the terminal name, and any remaining
 .PP
 An options file is parsed into a series of words, delimited by
 whitespace.  Whitespace can be included in a word by enclosing the
-word in quotes (").  A backslash (\\) quotes the following character.
+word in double-quotes (").  A backslash (\\) quotes the following character.
 A hash (#) starts a comment, which continues until the end of the
-line.
-.SH PRIVILEGED OPTIONS
+line.  There is no restriction on using the \fIfile\fR or \fIcall\fR
+options within an options file.
+.SH SECURITY
+.I pppd
+provides system administrators with sufficient access control that PPP
+access to a server machine can be provided to legitimate users without
+fear of compromising the security of the server or the network it's
+on.  This control is provided through restrictions on which IP
+addresses the peer may use, based on its authenticated identity (if
+any), and through restrictions on which options a non-privileged user
+may use.  Several of pppd's options are privileged, in particular
+those which permit potentially insecure configurations; these options
+are only accepted in files which are under the control of the system
+administrator, or if pppd is being run by root.
+.PP
+The default behaviour of pppd is to allow an unauthenticated peer to
+use a given IP address only if the system does not already have a
+route to that IP address.  For example, a system with a
+permanent connection to the wider internet will normally have a
+default route, and thus all peers will have to authenticate themselves
+in order to set up a connection.  On such a system, the \fIauth\fR
+option is the default.  On the other hand, a system where the
+PPP link is the only connection to the internet will not normally have
+a default route, so the peer will be able to use almost any IP address
+without authenticating itself.
+.PP
 As indicated above, some security-sensitive options are privileged,
 which means that they may not be used by an ordinary non-privileged
 user running a setuid-root pppd, either on the command line, in the
@@ -609,50 +726,79 @@ an options file read using the \fIcall\fR option.  If pppd is being
 run by the root user, privileged options can be used without
 restriction.
 .PP
-The normal way that pppd should be set up is to have the \fIauth\fR
-option in the /etc/ppp/options file.  (This may become the default in
-later releases.)  If users wish to use pppd to dial out to a peer
-which will refuse to authenticate itself (such as an internet service
-provider), the system administrator should create an options file
-under /etc/ppp/peers containing the \fInoauth\fR option, the name of
-the serial port to use, and the \fIconnect\fR option (if required),
-plus any other appropriate options.  In this way, pppd can be set up
-to allow non-privileged users to make unauthenticated connections only
-to trusted peers.
+When opening the device, pppd uses either the invoking user's user ID
+or the root UID (that is, 0), depending on whether the device name was
+specified by the user or the system administrator.  If the device name
+comes from a privileged source, that is, /etc/ppp/options or an
+options file read using the \fIcall\fR option, pppd uses full root
+privileges when opening the device.  Thus, by creating an appropriate
+file under /etc/ppp/peers, the system administrator can allow users to
+establish a ppp connection via a device which they would not normally
+have permission to access.  Otherwise pppd uses the invoking user's
+real UID when opening the device.
 .SH AUTHENTICATION
-.I pppd
-provides system administrators with sufficient access control that PPP
-access to a server machine can be provided to legitimate users without
-fear of compromising the security of the server or the network it's
-on.  In part this is provided by the /etc/ppp/options file, where the
-administrator can place options to restrict the ways in which pppd can
-be used, and in part by the PAP and CHAP secrets files, where the
-administrator can restrict the set of IP addresses which individual
-users may use.
+Authentication is the process whereby one peer convinces the other of
+its identity.  This involves the first peer sending its name to the
+other, together with some kind of secret information which could only
+come from the genuine authorized user of that name.  In such an
+exchange, we will call the first peer the "client" and the other the
+"server".  The client has a name by which it identifies itself to the
+server, and the server also has a name by which it identifies itself
+to the client.  Generally the genuine client shares some secret (or
+password) with the server, and authenticates itself by proving that it
+knows that secret.  Very often, the names used for authentication
+correspond to the internet hostnames of the peers, but this is not
+essential.
+.LP
+At present, pppd supports two authentication protocols: the Password
+Authentication Protocol (PAP) and the Challenge Handshake
+Authentication Protocol (CHAP).  PAP involves the client sending its
+name and a cleartext password to the server to authenticate itself.
+In contrast, the server initiates the CHAP authentication exchange by
+sending a challenge to the client (the challenge packet includes the
+server's name).  The client must respond with a response which
+includes its name plus a hash value derived from the shared secret and
+the challenge, in order to prove that it knows the secret.
+.LP
+The PPP protocol, being symmetrical, allows both peers to require the
+other to authenticate itself.  In that case, two separate and
+independent authentication exchanges will occur.  The two exchanges
+could use different authentication protocols, and in principle,
+different names could be used in the two exchanges.
 .LP
 The default behaviour of pppd is to agree to authenticate if
 requested, and to not require authentication from the peer.  However,
 pppd will not agree to authenticate itself with a particular protocol
 if it has no secrets which could be used to do so.
 .LP
-Authentication is based on secrets, which are selected from secrets
+Pppd stores secrets for use in authentication in secrets
 files (/etc/ppp/pap-secrets for PAP, /etc/ppp/chap-secrets for CHAP).
-Both secrets files have the same format, and both can store secrets
-for several combinations of server (authenticating peer) and client
-(peer being authenticated).  Note that pppd can be both a server and
-client, and that different protocols can be used in the two directions
-if desired.
+Both secrets files have the same format.  The secrets files can
+contain secrets for pppd to use in authenticating itself to other
+systems, as well as secrets for pppd to use when authenticating other
+systems to itself.
+.LP
+Each line in a secrets file contains one secret.  A given secret is
+specific to a particular combination of client and server - it can
+only be used by that client to authenticate itself to that server.
+Thus each line in a secrets file has at least 3 fields: the name of
+the client, the name of the server, and the secret.  These fields may
+be followed by a list of the IP addresses that the specified client
+may use when connecting to the specified server.
 .LP
-A secrets file is parsed into words as for a options file.  A secret
-is specified by a line containing at least 3 words, in the order
-client name, server name, secret.  Any following words on the same
-line are taken to be a list of acceptable IP addresses for that
-client.  If there are only 3 words on the line, it is assumed that any
-IP address is OK; to disallow all IP addresses, use "-".  A word
-starting with "!" indicates that the specified address is \fInot\fR
-acceptable.  An address may be followed by "/" and a number \fIn\fR,
-to indicate a whole subnet, i.e. all addresses which have the same
-value in the most significant \fIn\fR bits.
+A secrets file is parsed into words as for a options file, so the
+client name, server name and secrets fields must each be one word,
+with any embedded spaces or other special characters quoted or
+escaped.  Any following words on the same line are taken to be a list
+of acceptable IP addresses for that client.  If there are only 3 words
+on the line, or if the first word is "-", then all IP addresses are
+disallowed.  To allow any address, use "*".
+A word starting with "!" indicates that the
+specified address is \fInot\fR acceptable.  An address may be followed
+by "/" and a number \fIn\fR, to indicate a whole subnet, i.e. all
+addresses which have the same value in the most significant \fIn\fR
+bits.  Note that case is significant in the client and server names
+and in the secret.
 .LP
 If the secret starts with an `@', what follows is assumed to be the
 name of a file from which to read the secret.  A "*" as the client or
@@ -663,39 +809,44 @@ Thus a secrets file contains both secrets for use in authenticating
 other hosts, plus secrets which we use for authenticating ourselves to
 others.  When pppd is authenticating the peer (checking the peer's
 identity), it chooses a secret with the peer's name in the first
-column and the name of the local system in the second column.  The
+field and the name of the local system in the second field.  The
 name of the local system defaults to the hostname, with the domain
 name appended if the \fIdomain\fR option is used.  This default can be
-overridden with the \fIname\fR option (unless the \fIusehostname\fR
-option is used.)
+overridden with the \fIname\fR option, except when the
+\fIusehostname\fR option is used.
 .LP
 When pppd is choosing a secret to use in authenticating itself to the
-peer, it looks for a secret with the local name in the first column
-and the name of the remote system in the second column.  The local
-name is determined as described in the previous paragraph, except that
-it may be overridden with the \fIuser\fR option.  The remote name will
-have been received from the peer if CHAP authentication is being
-used.  However, with PAP, pppd does not know the remote name at the
-time when it has to look for the secret.  In this case, it will use
-the value given for the \fIremotename\fR option if specified.  Failing
-that, if the remote IP address was given as a name (rather than in
-numeric form), it will use that name.  Failing that, it will use the
-empty string.
+peer, it first determines what name it is going to use to identify
+itself to the peer.  This name can be specified by the user with the
+\fIuser\fR option.  If this option is not used, the name defaults to
+the name of the local system, determined as described in the previous
+paragraph.  Then pppd looks for a secret with this name in the first
+field and the peer's name in the second field.  Pppd will know the
+name of the peer if CHAP authentication is being used, because the
+peer will have sent it in the challenge packet.  However, if PAP is being
+used, pppd will have to determine the peer's name from the options
+specified by the user.  The user can specify the peer's name directly
+with the \fIremotename\fR option.  Otherwise, if the remote IP address
+was specified by a name (rather than in numeric form), that name will
+be used as the peer's name.  Failing that, pppd will use the null
+string as the peer's name.
 .LP
-When authenticating the peer with PAP, a secret of "" matches any
-password supplied by the peer.  If the password doesn't match the
-secret, the password is encrypted using crypt() and checked against
-the secret again; thus secrets for authenticating the peer can be
-stored in encrypted form.  If the \fIpapcrypt\fR option is given, the
-first (unencrypted) comparison is omitted, for better security.
+When authenticating the peer with PAP, the supplied password is first
+compared with the secret from the secrets file.  If the password
+doesn't match the secret, the password is encrypted using crypt() and
+checked against the secret again.  Thus secrets for authenticating the
+peer can be stored in encrypted form if desired.  If the
+\fIpapcrypt\fR option is given, the first (unencrypted) comparison is
+omitted, for better security.
 .LP
-If the \fIlogin\fR option was specified, the username and password are
-also checked against the system password database.  Thus, the system
-administrator can set up the pap-secrets file to allow PPP access only
-to certain users, and to restrict the set of IP addresses that each
-user can use.  Typically, when using the \fIlogin\fR option, the
-secret in /etc/ppp/pap-secrets would be "", to avoid the need to have
-the same secret in two places.
+Furthermore, if the \fIlogin\fR option was specified, the username and
+password are also checked against the system password database.  Thus,
+the system administrator can set up the pap-secrets file to allow PPP
+access only to certain users, and to restrict the set of IP addresses
+that each user can use.  Typically, when using the \fIlogin\fR option,
+the secret in /etc/ppp/pap-secrets would be "", which will match any
+password supplied by the peer.  This avoids the need to have the same
+secret in two places.
 .LP
 Authentication must be satisfactorily completed before IPCP (or any
 other Network Control Protocol) can be started.  If the peer is
@@ -721,9 +872,10 @@ This is sufficient to create a host route to the remote end of the
 link, which will enable the peers to exchange IP packets.
 Communication with other machines generally requires further
 modification to routing tables and/or ARP (Address Resolution
-Protocol) tables.  In some cases this will be done automatically
-through the actions of the \fIrouted\fR or \fIgated\fR daemons, but in
-most cases some further intervention is required.
+Protocol) tables.  In most cases the \fIdefaultroute\fR and/or
+\fIproxyarp\fR options are sufficient for this, but in some cases
+further intervention is required.  The /etc/ppp/ip-up script can be
+used for this.
 .LP
 Sometimes it is desirable to add a default route through the remote
 host, as in the case of a machine whose only connection to the
@@ -739,34 +891,91 @@ host (an interface supporting broadcast and ARP, which is up and not a
 point-to-point or loopback interface).  If found, pppd creates a
 permanent, published ARP entry with the IP address of the remote host
 and the hardware address of the network interface found.
+.LP
+When the \fIdemand\fR option is used, the interface IP addresses have
+already been set at the point when IPCP comes up.  If pppd has not
+been able to negotiate the same addresses that it used to configure
+the interface (for example when the peer is an ISP that uses dynamic
+IP address assignment), pppd has to change the interface IP addresses
+to the negotiated addresses.  This may disrupt existing connections,
+and the use of demand dialling with peers that do dynamic IP address
+assignment is not recommended.
 .SH EXAMPLES
 .LP
-In the simplest case, you can connect the serial ports of two machines
-and issue a command like
+The following examples assume that the /etc/ppp/options file contains
+the \fIauth\fR option (as in the default /etc/ppp/options file in the
+ppp distribution).
+.LP
+Probably the most common use of pppd is to dial out to an ISP.  This
+can be done with a command such as
 .IP
-pppd /dev/ttya 9600 passive
+pppd call isp
 .LP
-to each machine, assuming there is no \fIgetty\fR running on the
-serial ports.  If one machine has a \fIgetty\fR running, you can use
-\fIkermit\fR or \fItip\fR on the other machine to log in to the first
-machine and issue a command like
+where the /etc/ppp/peers/isp file is set up by the system
+administrator to contain something like this:
 .IP
-pppd passive
+ttyS0 19200 crtscts
+.br
+connect '/usr/sbin/chat -v -f /etc/ppp/chat-isp'
+.br
+noauth
 .LP
-Then exit from the communications program (making sure the connection
-isn't dropped), and issue a command like
+In this example, we are using chat to dial the ISP's modem and go
+through any logon sequence required.  The /etc/ppp/chat-isp file
+contains the script used by chat; it could for example contain
+something like this:
 .IP
-pppd /dev/ttya 9600
+ABORT "NO CARRIER"
+.br
+ABORT "NO DIALTONE"
+.br
+ABORT "ERROR"
+.br
+ABORT "NO ANSWER"
+.br
+ABORT "BUSY"
+.br
+ABORT "Username/Password Incorrect"
+.br
+"" "at"
+.br
+OK "at&d0&c1"
+.br
+OK "atdt2468135"
+.br
+"name:" "^Umyuserid"
+.br
+"word:" "\\qmypassword"
+.br
+"ispts" "\\q^Uppp"
+.br
+"~-^Uppp-~"
+.LP
+See the chat(8) man page for details of chat scripts.
+.LP
+Pppd can also be used to provide a dial-in ppp service for users.  If
+the users already have login accounts, the simplest way to set up the
+ppp service is to let the users log in to their accounts and run pppd
+(installed setuid-root) with a command such as
+.IP
+pppd proxyarp
 .LP
-The process of logging in to the other machine and starting \fIpppd\fR
-can be automated by using the \fIconnect\fR option to run \fIchat\fR,
-for example:
+To allow a user to use the PPP facilities, you need to allocate an IP
+address for that user's machine and create an entry in
+/etc/ppp/pap-secrets or /etc/ppp/chap-secrets (depending on which
+authentication method the PPP implementation on the user's machine
+supports), so that the user's
+machine can authenticate itself.  For example, if Joe has a machine
+called "joespc" which is to be allowed to dial in to the machine
+called "server" and use the IP address joespc.my.net, you would add an
+entry like this to /etc/ppp/pap-secrets or /etc/ppp/chap-secrets:
 .IP
-pppd /dev/ttya 38400 connect 'chat "" "" "login:" "username"
-"Password:" "password" "% " "exec pppd passive"'
+joespc server  "joe's secret"  joespc.my.net
 .LP
-(Note however that running chat like this will leave the password
-visible in the parameter list of pppd and chat.)
+Alternatively, you can create a username called (for example) "ppp",
+whose login shell is pppd and whose home directory is /etc/ppp.
+Options to be used when pppd is run this way can be put in
+/etc/ppp/.ppprc.
 .LP
 If your serial connection is any more complicated than a piece of
 wire, you may need to arrange for some control characters to be
@@ -788,16 +997,53 @@ to direct the messages to the desired output device or file.
 .LP
 The \fIdebug\fR option causes the contents of all control packets sent
 or received to be logged, that is, all LCP, PAP, CHAP or IPCP packets.
-This can be useful if the PPP negotiation does not succeed.
+This can be useful if the PPP negotiation does not succeed or if
+authentication fails.
 If debugging is enabled at compile time, the \fIdebug\fR option also
 causes other debugging messages to be logged.
 .LP
 Debugging can also be enabled or disabled by sending a SIGUSR1 signal
 to the pppd process.  This signal acts as a toggle.
-.SH FILES
-.TP
-.B /var/run/ppp\fIn\fB.pid \fR(BSD or Linux), \fB/etc/ppp/ppp\fIn\fB.pid \fR(others)
-Process-ID for pppd process on ppp interface unit \fIn\fR.
+.SH SCRIPTS
+Pppd invokes scripts at various stages in its processing which can be
+used to perform site-specific ancillary processing.  These scripts are
+usually shell scripts, but could be executable code files instead.
+Pppd does not wait for the scripts to finish.  The scripts are
+executed as root (with the real and effective user-id set to 0), so
+that they can do things such as update routing tables or run
+privileged daemons.  Be careful that the contents of these scripts do
+not compromise your system's security.  Pppd runs the scripts with
+standard input, output and error redirected to /dev/null, and with an
+environment that is empty except for some environment variables that
+give information about the link.  The environment variables that pppd
+sets are:
+.TP
+.B DEVICE
+The name of the serial tty device being used.
+.TP
+.B IFNAME
+The name of the network interface being used.
+.TP
+.B IPLOCAL
+The IP address for the local end of the link.  This is only set when
+IPCP has come up.
+.TP
+.B IPREMOTE
+The IP address for the remote end of the link.  This is only set when
+IPCP has come up.
+.TP
+.B PEERNAME
+The authenticated name of the peer.  This is only set if the peer
+authenticates itself.
+.TP
+.B SPEED
+The baud rate of the tty device.
+.TP
+.B ORIG_UID
+The real user-id of the user who invoked pppd.
+.P
+Pppd invokes the following scripts, if they exist.  It is not an error
+if they don't exist.
 .TP
 .B /etc/ppp/auth-up
 A program or script which is executed after the remote system
@@ -805,9 +1051,8 @@ successfully authenticates itself.  It is executed with the parameters
 .IP
 \fIinterface-name peer-name user-name tty-device speed\fR
 .IP
-and with its standard input, output and error redirected to
-/dev/null.  This program or script is executed with the real and
-effective user-IDs set to root, and with an empty environment.
+Note that this script is not executed if the peer doesn't authenticate
+itself, for example when the \fInoauth\fR option is used.
 .TP
 .B /etc/ppp/auth-down
 A program or script which is executed when the link goes down, if
@@ -821,25 +1066,13 @@ executed with the parameters
 .IP
 \fIinterface-name tty-device speed local-IP-address
 remote-IP-address ipparam\fR
-.IP
-and with its standard input,
-output and error streams redirected to /dev/null.
-.IP
-This program or script is executed with the real and effective
-user-IDs set to root.  This is so that it can be used to manipulate
-routes, run privileged daemons (e.g. \fIsendmail\fR), etc.  Be
-careful that the contents of the /etc/ppp/ip-up and /etc/ppp/ip-down
-scripts do not compromise your system's security.
-.IP
-This program or script is executed with an empty environment, so you
-must either specify a PATH or use full pathnames.
 .TP
 .B /etc/ppp/ip-down
 A program or script which is executed when the link is no longer
 available for sending and receiving IP packets.  This script can be
 used for undoing the effects of the /etc/ppp/ip-up script.  It is
 invoked in the same manner and with the same parameters as the ip-up
-script, and the same security considerations apply.
+script.
 .TP
 .B /etc/ppp/ipx-up
 A program or script which is executed when the link is available for
@@ -850,10 +1083,6 @@ executed with the parameters
 remote-IPX-node-address local-IPX-routing-protocol remote-IPX-routing-protocol
 local-IPX-router-name remote-IPX-router-name ipparam pppd-pid\fR 
 .IP
-and with its standard input,
-output and error streams redirected to /dev/null.
-.br
-.IP
 The local-IPX-routing-protocol and remote-IPX-routing-protocol field
 may be one of the following:
 .IP
@@ -864,27 +1093,28 @@ RIP       to indicate that RIP/SAP should be used
 NLSP      to indicate that Novell NLSP should be used
 .br
 RIP NLSP  to indicate that both RIP/SAP and NLSP should be used
-.br
-.IP
-This program or script is executed with the real and effective
-user-IDs set to root, and with an empty environment.  This is so
-that it can be used to manipulate routes, run privileged daemons (e.g.
-\fIripd\fR), etc.  Be careful that the contents of the /etc/ppp/ipx-up
-and /etc/ppp/ipx-down scripts do not compromise your system's
-security.
 .TP
 .B /etc/ppp/ipx-down
 A program or script which is executed when the link is no longer
 available for sending and receiving IPX packets.  This script can be
 used for undoing the effects of the /etc/ppp/ipx-up script.  It is
 invoked in the same manner and with the same parameters as the ipx-up
-script, and the same security considerations apply.
+script.
+.SH FILES
+.TP
+.B /var/run/ppp\fIn\fB.pid \fR(BSD or Linux), \fB/etc/ppp/ppp\fIn\fB.pid \fR(others)
+Process-ID for pppd process on ppp interface unit \fIn\fR.
 .TP
 .B /etc/ppp/pap-secrets
-Usernames, passwords and IP addresses for PAP authentication.
+Usernames, passwords and IP addresses for PAP authentication.  This
+file should be owned by root and not readable or writable by any other
+user.  Pppd will log a warning if this is not the case.
 .TP
 .B /etc/ppp/chap-secrets
-Names, secrets and IP addresses for CHAP authentication.
+Names, secrets and IP addresses for CHAP authentication.  As for
+/etc/ppp/pap-secrets, this file should be owned by root and not
+readable or writable by any other user.  Pppd will log a warning if
+this is not the case.
 .TP
 .B /etc/ppp/options
 System default options for pppd, read before user default options or
@@ -899,6 +1129,13 @@ System default options for the serial port being used, read after
 filename, an initial /dev/ is stripped from the port name (if
 present), and any slashes in the remaining part are converted to
 dots.
+.TP
+.B /etc/ppp/peers
+A directory containing options files which may contain privileged
+options, even if pppd was invoked by a user other than root.  The
+system administrator can create options files in this directory to
+permit non-privileged users to dial out without requiring the peer to
+authenticate, but only to certain trusted peers.
 .SH SEE ALSO
 .TP
 .B RFC1144
@@ -945,6 +1182,9 @@ serial device and start another connection (after the holdoff period).
 Otherwise pppd will exit.  If this signal is received during the
 holdoff period, it causes pppd to end the holdoff period immediately.
 .TP
+.B SIGUSR1
+This signal toggles the state of the \fIdebug\fR option.
+.TP
 .B SIGUSR2
 This signal causes pppd to renegotiate compression.  This can be
 useful to re-enable compression after it has been disabled as a result