Commit Graph

121 Commits

Author SHA1 Message Date
Eivind Næss
2883dd0710 Use autoconf/automake to configure and make ppp
This change brings in autoconf/automake scripts to configure the ppp project. Current change doesn't eliminate the previous build system, but the new script autogen.sh will overwrite configure, and generate the basic Makefile.in and Makefile files.

Features can now be enabled by command line:

  * Microsoft Extensions,
    - MSCHAP
    - MPPE
    - MS LAN Manager support
  * IPXCP protocol
  * CBCP protocol
  * PAM support
  * EAP-TLS support
  * EAP-SRP support
  * Max session lifetime by byte count
  * Plugins
  * Packet activity filter support
  * Multilink
  * IPv6 support

Control linkage with
  * OpenSSL (-lssl -lcrypto)
  * systemd (-lsystemd)
  * libatm (-latm)
  * libsrp (-lsrp)
  * pam (-lpam)

Also, the configure script is made sensitive to features of OpenSSL. Like the presence or absence of DES, SHA, MD4 and MD5 crypto support. In the cases where either of these are missing, the support will be directly compiled into pppd and plugins.

In addition, package maintainers can now control the installation paths with standard --prefix=, or --localstatedir=, or --sysconfdir= to configure. On top of that, they can now control the following directories:
  * runtime directory w/--with-runtime-dir
  * logfile directory w/--with-logfile-dir
  * plugin directory w/--with-plugin-dir

In the case where automake isn't the right solution, namely: SunOS kernel module build, the original Makefile infrastructure is preserved and reused.

Care was taken to only cosmetically touchup the source files in this change. This means:
  * Insert HAVE_CONFIG_H and include config.h in all .c files.
  * Change HAS_SHADOW to HAVE_SHADOW_H
  * Change HAVE_LOGWTMP to HAVE_UTMP_H
  * Introduce HAVE_CRYPT_H into the source code where appropriate
  * Added ifdef MPPE where appropriate
  * USE_SRP required a few changes as it didn't compile
  * Touchup some compile warning in pppstats directory on SunOS

Introduced a new pppdconf.h file that exports the appropriate defines to a module that wants to provide a module that pppd can dynamically load. This will define/undef features like MPPE, CHAPMS such that the project doesn't have to guess what features pppd is compiled with.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
2021-07-20 08:24:08 -07:00
Samuel Thibault
861202529f
pppd: Export $CALL_FILE to the link scripts (#196)
From https://bugs.debian.org/51880

“
This would make it much easier for me, and cleaner too, to handle
multiple, mutually exclusive, dialout internet service providers.
”

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Co-authored-by: Marco d'Itri <md@linux.it>
2020-12-31 15:50:46 +11:00
Russell Coker
7afd9fdfe0 Add option to specify ip-up script
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=101587

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2020-12-30 11:42:17 +01:00
Paul Mackerras
75870d7b55 Convert to ANSI C
This gets rid of the __P and __V macros that were used so that the
code was in theory compilable by a K&R C compiler, and converts the
function definitions to ANSI C style.  In fact there were already
quite a few function definitions in the ANSI C style, so it would not
have been compilable by a K&R C compiler in fact.

The Solaris and BSD kernel code modules have had __P removed but the
function definitions have not been converted.

There are some other minor changes here to remove warnings.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2020-12-29 16:08:24 +11:00
Lars Wendler
6b014be066
pppd: Print version information to stdout instead of stderr (#133)
This makes it easier for scripts to parse the output if necessary

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2020-03-21 17:42:47 +11:00
Paul Mackerras
ae54fcfade pppd: Obfuscate password argument string
After processing the argument to the 'password' option, this
overwrites the original argument on the stack with '?' characters,
and for good measure makes the argument pointer point to a constant
string "********" so as not to reveal the length of the password.
This is so that tools such as ps don't show the actual password
when displaying the process arguments.  Nevertheless, it is still
better to get the password from a file, since there is inevitably
still a window of time when the password would be visible.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2020-03-21 15:13:42 +11:00
Paul Mackerras
c10c3c7cb3 pppd: Make sure word read from options file is null-terminated
If a word read from an options file was longer than MAXWORDLEN,
we could pass it to option_error() without null termination,
which could have lead to an out-of-bounds access in vslprintf.
Make sure word[] is null terminated in all cases.

Reported-by: Florian Kohnhäuser <florian@kohnhaeuser.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2019-12-30 09:32:18 +11:00
Kurt Van Dijck
d8e8d7a74b pppd: Remove unused rcsid variables
Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2019-10-02 08:47:40 +10:00
Paul Mackerras
292c35d97e pppd: Fix compile warning due to comparing pointer to NUL character
Evidently this means to check for arg pointing to an empty string,
not arg being NULL, since the ensuing error talks about the variable
name being missing.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2018-06-23 16:40:27 +10:00
Vegard Nossum
3b409a8e29 pppd: Fix printing call in print_option()
print_option() was in this case passing p/opt->addr2 as the format string
instead of the string to be printed (as a quoted string). That could lead
to a nasty crash.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2018-06-23 14:42:50 +10:00
Jacob Floyd
d34159f417 Use systemd's sd_notify with option up_sdnotify
This adds an up_sdnotify option so that systemd services of
Type=notify can have pppd send the READY=1 signal to systemd
once a network protocol (typically IP) is up.

To use up_sdnotify, pppd must be compiled with SYSTEMD=y.

up_sdnotify is safe as a non-priveleged option because systemd will
ignore any notifications that it is not expecting. If systemd starts
pppd in a unit-file that is Type=notify, then (and only then) will it
handle the READY=1 signal. If systemd didn't start the process, it
ignroes any notifications unless the signaling process was started by a
service that systemd is monitoring (directly or indirectly, such as a
grandchild process in the same cgroup as a process that systemd started)
AND that service is Type=notify, AND that service is explicitly
configured to allow other processes to send a notification on behalf of
that service by setting NotifyAccess=all.

Also, the socket used is defined in an environment variable provided and
deleted by systemd, allowing system and user services to use a different
socket. I really don't think there's any way to use that socket (even via
the sd_notify api of their library) to gain elevated privileges.

Another reason that up_sdnotify is a non-priveleged option is for cases
where ppp should be started as a system service under a non-priveleged
account. There may be other issues with running ppp under other
accounts, but systemd does not require root--or other privileged--access
in order to use the notification feature. Instead the security for this
feature is provided at the process level in that systemd knows which
processes it did and did not start, and which processes those processes
started (ie other processes in the systemd unit's cgroup), as explained
above.

Signed-off-by: Jacob Floyd <cognifloyd@gmail.com>
2018-02-27 13:22:23 -06:00
Paul Mackerras
bbcdc4366b pppd: allow use of arbitrary interface names
This is a modified version of a patch from openSUSE that enables PPP interfaces
to be called arbitrary names, rather than simply pppX where X is the unit
number.

The modifications from the stock openSUSE patch are:
- refresh patch on top of 018_ip-up_option.diff
- fix a printf format-string vulnerability in pppd/main.c:set_ifunit()
- clarify the pppd.8 manpage additions
- patch pppstats/pppstats.c to query renamed interfaces without complaint

Origin: SUSE
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=458646
Forwarded: no
Reviewed-by: Chris Boot <bootc@debian.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2016-08-23 16:10:21 +10:00
Paul Mackerras
3a5c9a8fbc Merge branch 'master' of https://github.com/ncopa/ppp
This merges in one commit, which adds the new "defaultroute-metric" option.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2015-08-14 20:13:41 +10:00
Natanael Copa
35e5a569c9 pppd: add support for defaultroute-metric option
This allows user to specify the 'metric' (or 'prio') for the default
route set by pppd. This is useful in multi-ISP setups where there
might be more than one default gateway.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2014-08-15 07:26:16 +00:00
Paul Mackerras
b94b7fbbaa pppd: Eliminate memory leak with multiple instances of a string option
This eliminates the memory leak which occurs when a user gives the
same string option multiple times.  Although the leak is trivial under
normal conditions, the fact that it can be triggered by the user
means that it may be of interest to attackers, so let's plug the leak.

This also means that any o_string option without OPT_STATIC set needs
to have opt->addr pointing to a pointer which starts out NULL.  That
is the case for all current uses of o_string.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-08-01 21:36:51 +10:00
Paul Mackerras
7658e82571 pppd: Eliminate potential integer overflow in option parsing
When we are reading in a word from an options file, we maintain a count
of the length we have seen so far in 'len', which is an int.  When len
exceeds MAXWORDLEN - 1 (i.e. 1023) we cease storing characters in the
buffer but we continue to increment len.  Since len is an int, it will
wrap around to -2147483648 after it reaches 2147483647.  At that point
our test of (len < MAXWORDLEN-1) will succeed and we will start writing
characters to memory again.

This may enable an attacker to overwrite the heap and thereby corrupt
security-relevant variables.  For this reason it has been assigned a
CVE identifier, CVE-2014-3158.

This fixes the bug by ceasing to increment len once it reaches MAXWORDLEN.

Reported-by: Lee Campbell <leecam@google.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-08-01 21:36:48 +10:00
Paul Mackerras
398ed25856 pppd: Add master_detach option
This adds a new option, master_detach, to allow pppd to detach from
the controlling terminal when it is the multilink bundle master but
its own link has terminated, even if the nodetach option has been
given.

Requested-by: Stephen Marron <sfm@boxfusion.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-03-02 20:25:28 +11:00
James Carlson
3089132cdf Fix quote handling in configuration files to be more like shell quoting.
The specific case that confused a user was:
	ROUTES="216.220.192.0/20 10.0.100.0/24"
which was interpreted as two separate words, merely because the first quote
mark was in the middle of a word.
2010-08-23 10:03:07 -04:00
James Carlson
2b6310fd24 Add set and reset options to control environment variables for scripts. 2010-08-23 09:59:56 -04:00
Paul Mackerras
8f09b151a3 Make pppd use blank username/password when explicitly specified
Patch from Jon Dubovsky.

Previously pppd would use its default strategies for working out a
username and password/secret to use if the user gave the empty string
to the user and/or password options.  Now we set a flag when an
explicit username is given, and don't do the default username
calculation if the flag is set.  Similarly for the password.
2008-06-15 06:53:06 +00:00
Paul Mackerras
24e466be14 Rewrite some code to avoid a type-punned pointer warning. 2008-06-03 12:07:13 +00:00
Paul Mackerras
3d05bed743 Restore original EUID rather than 0 during option processing.
When dropping and regaining privileges during option processing,
the seteuid to regain privileges is now the original EUID rather
than a constant zero.  This means that `pppd --version' run without
root privilege prints the version number and exits rather than
giving an "unable to regain privileges" error.
2006-06-18 11:26:00 +00:00
Paul Mackerras
bf69479845 Check the result of seteuid(), just to be paranoid. 2006-06-04 07:04:57 +00:00
Paul Mackerras
b53fa92729 Change DLT_PPP_WITHDIRECTION to DLT_PPP_PPPD since that seems
to be what libpcap has finally settled on.
2005-07-13 12:31:36 +00:00
Paul Mackerras
0b6b481854 Fix the return value from setpassfilter and setactivefilter - it
should be 1 if the value was OK or 0 if it wasn't.
2005-07-09 04:58:36 +00:00
Paul Mackerras
781f954217 DLT_PPP_WITH_DIRECTION should be DLT_PPP_WITHDIRECTION.
Thanks to Stefan Petersen for pointing this out.
2004-12-31 06:19:27 +00:00
Paul Mackerras
298bda129d Arrange for holdoff_specified to be set if the holdoff option
is used; make child-timeout option use OPT_PRIO.
2004-11-09 22:33:35 +00:00
Paul Mackerras
36e867a96f Add a timeout when waiting for child processes to exit before pppd
exits.  Send a SIGTERM to the child processes if the timeout expires
or if pppd gets a SIGTERM or SIGINT itself.
2004-11-04 09:46:50 +00:00
Paul Mackerras
6794beb707 Make the filtering stuff work with recent versions of libpcap. 2004-10-28 00:15:08 +00:00
Paul Mackerras
739c7d957d Invoke options.ttyxx even if the dev directory isn't at the root
(e.g. if the tty device is /ram1/dev/ttyS0).  Patch sent in by
Marco d'Itri.
2004-01-13 04:02:07 +00:00
Paul Mackerras
cb67581446 A bunch of fixes mostly aimed at fixing the problems we have been
having with leaking fds and with fatal errors occurring when the link
goes down.
Updated patchlevel.h to 2.4.2b2.
Moved open of /dev/ppp to generic_establish_ppp; we now close the
ppp_dev_fd in generic_disestablish_ppp rather than trying to use
PPPIOCDETACH.
*_send_config and *_recv_config now return 0 for success or -1 for
error, rather than calling fatal() when an error occurs.
Added a notifier for when we fork so plugins can close their fds in
the child.
Added a safe_fork() which does a fork and then closes stuff in the
child; the parent waits until the child has done that.
On detach, the parent rewrites the pid files rather than the child,
and the child waits for the parent to die.
Fixed some potential FILE * leaks.
Also moved auth_number() check into auth_check_options.
2003-03-03 05:11:46 +00:00
Paul Mackerras
f53a48eb9d Update copyrights. The new CMU copyright notice is from CMU and now
explicitly allows modifications.  I have an acknowledgement from ANU
that the work I have done on pppd belongs to me and not to ANU, so I
have changed the ANU copyright notices to reflect this.  I have emails
from Pedro Roque Marques, Tommi Komulainen and Eric Rosenquist giving
me permission to change their copyright notices to be similar to the
CMU notice.
2002-12-04 23:03:33 +00:00
Frank Cusack
aefcf5ac90 Set current_option for error reporting. Bug and fix by Clive Nicolson. 2002-10-27 13:00:13 +00:00
Frank Cusack
d192a0b4b5 Lose the poorly thought out OPT_A3OR option flag. Fix a CHAP negotiation bug
along the way -- if the peer nak'd with an chap digest we didn't support, we
would continue to offer our first choice digest.
2002-09-24 11:35:22 +00:00
Russell Coker
51dfbde005 Fix a SEGV on printing options error (previously a MTU of 65535 in the options
file would cause a SEGV).
2002-09-14 08:05:27 +00:00
James Carlson
fcec736c61 Added ability to detect and use either gcc or Sun WorkShop C compiler
on Solaris.  Added support for Solaris 10.  Quieted down warning in
ppp_comp.c due to bad preprocessor usage.  Quieted WorkShop warnings
in options.c (casting of void * to function) and pppd.h (constant too
large).  Tested in 32 and 64 bit modes with gcc and WorkShop.
2002-09-07 05:15:25 +00:00
David F. Skoll
63e139d8f7 Fixed typo in options.c so it compiles. 2002-07-18 15:25:04 +00:00
Alexandr D. Kanevskiy
b2f8595268 Experemental per session traffic limiting.
Usefull for VPN with per megabyte billing.
(Works for me)
2002-07-13 06:24:36 +00:00
David F. Skoll
b38527fb14 First large MPPE patch from Frank Cusack. 2002-04-02 13:55:00 +00:00
David F. Skoll
c062322f9e Large patch from Frank Cusack <fcusack@fcusack.com> to add proper
support for MS-CHAP (client and server are now supported.)

Allow another plugin to select a different RADIUS server.

Modified radiusclient library to include two new APIs:
rc_acct_using_server and rc_auth_using_server in which caller specifies
which RADIUS servers to use, instead of using the default ones in the
config file.  The /etc/radiusclient/servers file must still contain
secrets for those servers.
2002-03-01 14:39:19 +00:00
Russell Coker
e635acbbac Stop it dumping random data to syslog on plugin version mismatch. 2002-01-11 18:11:51 +00:00
Paul Mackerras
e3c0701e74 remove oops message when a bool option has been turned off by other
logic; fix silly bug in options_from_list
2001-03-12 22:56:12 +00:00
Paul Mackerras
37a8acc7ee New options system with priorities for option values, with options
grouped into groups where necessary, so the command line overrides
the per-tty options file, plus the ability to print out the set of
options currently in effect.  Some options moved from lcp.c to tty.c.
2001-03-08 05:11:16 +00:00
Paul Mackerras
f7ee87797a Rework options processing stuff to implement option priorities
so the per-tty options file gets processed correctly.
Moved stuff out of options.c into other files (e.g. setipaddr)
2001-02-22 03:15:21 +00:00
Paul Mackerras
c7cc972ace Increase the size of the buffer for option error messages 2000-12-27 23:25:55 +00:00
Paul Mackerras
c65dfbde7e add stuff for packet filtering
remove IPV6 stuff because it was GPL'd
2000-08-01 01:38:30 +00:00
Paul Mackerras
52a17b6d41 Move the tty-related stuff out to tty.c as far as possible. 2000-06-30 04:54:23 +00:00
Adi Masputra
5b7a245572 Some tiny fixes (minor castings) to remove annoying compiler warnings 2000-04-15 01:27:13 +00:00
Paul Mackerras
3c0c031beb don't stop logging on detach if we use logfd or logfile option 2000-04-13 12:05:16 +00:00
Paul Mackerras
0b3acd3a11 Multilink support.
We now put details of each connection in a tdb database.
At present the values we put in the database are just
the same as the environment strings.
2000-04-04 07:06:53 +00:00