Add a default ppp.conf (mode 600).

Originally submitted by: Wayne Self <wself@cdrom.com>

Allow a ppp startup option in rc.conf.

Adjust sysinstall so that it appends to the end of ppp.conf
and uses the generated profile to start ppp in auto mode on
boot.

Submitted by: Josef L. Karthauser <joe@uk.FreeBSD.org>
This commit is contained in:
brian 1999-07-26 10:49:37 +00:00
parent c8bc216749
commit 03ab8a3b7f
16 changed files with 226 additions and 23 deletions

View File

@ -1,5 +1,5 @@
# from: @(#)Makefile 5.11 (Berkeley) 5/21/91
# $Id: Makefile,v 1.200 1999/07/09 05:30:33 obrien Exp $
# $Id: Makefile,v 1.201 1999/07/10 18:02:12 iwasaki Exp $
SUBDIR= sendmail
@ -24,6 +24,7 @@ MTREE= BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
BSD.var.dist BSD.x11.dist
NAMEDB= PROTO.localhost.rev named.conf named.root make-localhost
PPPCNF= ppp.deny ppp.shells.sample
PPPCF2= ppp.conf
NOSPAM= Makefile README
@ -79,6 +80,8 @@ distribution:
${NAMEDB} ${DESTDIR}/etc/namedb
cd ${.CURDIR}/ppp; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
${PPPCNF} ${DESTDIR}/etc/ppp
cd ${.CURDIR}/ppp; ${INSTALL} -c -o root -g ${BINGRP} -m 600 \
${PPPCF2} ${DESTDIR}/etc/ppp
cd ${.CURDIR}/mail; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
${NOSPAM} ${DESTDIR}/etc/mail
${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \

View File

@ -9,7 +9,7 @@
#
# All arguments must be in double or single quotes.
#
# $Id: rc.conf,v 1.21 1999/07/16 09:26:53 jkh Exp $
# $Id: rc.conf,v 1.22 1999/07/18 09:58:01 jkh Exp $
##############################################################
### Important initial Boot-time options ####################
@ -58,6 +58,13 @@ sppp_interfaces="" # List of sppp interfaces.
#sppp_interfaces="isp0" # example: sppp over ISDN
#spppconfig_isp0="authproto=chap myauthname=foo myauthsecret='top secret' hisauthname=some-gw hisauthsecret='another secret'"
# Use ppp configuration.
ppp_enable="NO" # Start user-ppp (or NO).
ppp_mode="auto" # Choice of "auto", "ddial", "direct" or "dedicated".
# For details see man page for ppp(8). Default is auto.
ppp_alias="YES" # Packet aliasing (NAT/masquerading) or NO.
ppp_profile="papchap" # Which profile to use from /etc/ppp/ppp.conf.
### Network daemon (miscellaneous) & NFS options: ###
syslogd_enable="YES" # Run syslog daemon (or NO).
syslogd_flags="" # Flags to syslogd (if enabled).

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $Id: rc.network,v 1.49 1999/07/08 18:56:02 peter Exp $
# $Id: rc.network,v 1.50 1999/07/16 09:26:52 jkh Exp $
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
# Note that almost all the user-configurable behavior is no longer in
@ -144,6 +144,23 @@ network_pass1() {
fi
fi
# Warm up user ppp if required.
if [ "X$ppp_enable" = X"YES" ]; then
# Establish ppp mode.
if [ "X$ppp_mode" != X"ddial" -a "X$ppp_mode" != X"direct" \
-a "X$ppp_mode" != X"dedicated" ]; then \
ppp_mode="auto";
fi
ppp_command="-${ppp_mode} ";
# Switch on alias mode?
if [ "X$ppp_alias" = X"YES" ]; then
ppp_command="${ppp_command} -alias";
fi
echo -n 'Starting ppp: '; ppp ${ppp_command} ${ppp_profile}
fi
# Additional ATM interface configuration
if [ -n "${atm_pass1_done}" ]; then
atm_pass2

36
etc/ppp/ppp.conf Normal file
View File

@ -0,0 +1,36 @@
#################################################################
# PPP Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by wself@cdrom.com
#
# $Id$
#################################################################
default:
#
# Make sure that "device" references the correct serial port
# for your modem. (cuaa0 = COM1, cuaa1 = COM2)
#
set device /dev/cuaa1
set log Phase Chat LCP IPCP CCP tun command
set speed 115200
set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
set timeout 120
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
add default HISADDR
enable dns
papchap:
#
# edit the next three lines and replace the items in caps with
# the values which have been assigned by your ISP.
#
set phone PHONE_NUM
set authname USERNAME
set authkey PASSWORD

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $Id: rc.network,v 1.49 1999/07/08 18:56:02 peter Exp $
# $Id: rc.network,v 1.50 1999/07/16 09:26:52 jkh Exp $
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
# Note that almost all the user-configurable behavior is no longer in
@ -144,6 +144,23 @@ network_pass1() {
fi
fi
# Warm up user ppp if required.
if [ "X$ppp_enable" = X"YES" ]; then
# Establish ppp mode.
if [ "X$ppp_mode" != X"ddial" -a "X$ppp_mode" != X"direct" \
-a "X$ppp_mode" != X"dedicated" ]; then \
ppp_mode="auto";
fi
ppp_command="-${ppp_mode} ";
# Switch on alias mode?
if [ "X$ppp_alias" = X"YES" ]; then
ppp_command="${ppp_command} -alias";
fi
echo -n 'Starting ppp: '; ppp ${ppp_command} ${ppp_profile}
fi
# Additional ATM interface configuration
if [ -n "${atm_pass1_done}" ]; then
atm_pass2

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $Id: rc.network,v 1.49 1999/07/08 18:56:02 peter Exp $
# $Id: rc.network,v 1.50 1999/07/16 09:26:52 jkh Exp $
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
# Note that almost all the user-configurable behavior is no longer in
@ -144,6 +144,23 @@ network_pass1() {
fi
fi
# Warm up user ppp if required.
if [ "X$ppp_enable" = X"YES" ]; then
# Establish ppp mode.
if [ "X$ppp_mode" != X"ddial" -a "X$ppp_mode" != X"direct" \
-a "X$ppp_mode" != X"dedicated" ]; then \
ppp_mode="auto";
fi
ppp_command="-${ppp_mode} ";
# Switch on alias mode?
if [ "X$ppp_alias" = X"YES" ]; then
ppp_command="${ppp_command} -alias";
fi
echo -n 'Starting ppp: '; ppp ${ppp_command} ${ppp_profile}
fi
# Additional ATM interface configuration
if [ -n "${atm_pass1_done}" ]; then
atm_pass2

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $Id: rc.network,v 1.49 1999/07/08 18:56:02 peter Exp $
# $Id: rc.network,v 1.50 1999/07/16 09:26:52 jkh Exp $
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
# Note that almost all the user-configurable behavior is no longer in
@ -144,6 +144,23 @@ network_pass1() {
fi
fi
# Warm up user ppp if required.
if [ "X$ppp_enable" = X"YES" ]; then
# Establish ppp mode.
if [ "X$ppp_mode" != X"ddial" -a "X$ppp_mode" != X"direct" \
-a "X$ppp_mode" != X"dedicated" ]; then \
ppp_mode="auto";
fi
ppp_command="-${ppp_mode} ";
# Switch on alias mode?
if [ "X$ppp_alias" = X"YES" ]; then
ppp_command="${ppp_command} -alias";
fi
echo -n 'Starting ppp: '; ppp ${ppp_command} ${ppp_profile}
fi
# Additional ATM interface configuration
if [ -n "${atm_pass1_done}" ]; then
atm_pass2

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $Id: rc.network,v 1.49 1999/07/08 18:56:02 peter Exp $
# $Id: rc.network,v 1.50 1999/07/16 09:26:52 jkh Exp $
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
# Note that almost all the user-configurable behavior is no longer in
@ -144,6 +144,23 @@ network_pass1() {
fi
fi
# Warm up user ppp if required.
if [ "X$ppp_enable" = X"YES" ]; then
# Establish ppp mode.
if [ "X$ppp_mode" != X"ddial" -a "X$ppp_mode" != X"direct" \
-a "X$ppp_mode" != X"dedicated" ]; then \
ppp_mode="auto";
fi
ppp_command="-${ppp_mode} ";
# Switch on alias mode?
if [ "X$ppp_alias" = X"YES" ]; then
ppp_command="${ppp_command} -alias";
fi
echo -n 'Starting ppp: '; ppp ${ppp_command} ${ppp_profile}
fi
# Additional ATM interface configuration
if [ -n "${atm_pass1_done}" ]; then
atm_pass2

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $Id: rc.network,v 1.49 1999/07/08 18:56:02 peter Exp $
# $Id: rc.network,v 1.50 1999/07/16 09:26:52 jkh Exp $
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
# Note that almost all the user-configurable behavior is no longer in
@ -144,6 +144,23 @@ network_pass1() {
fi
fi
# Warm up user ppp if required.
if [ "X$ppp_enable" = X"YES" ]; then
# Establish ppp mode.
if [ "X$ppp_mode" != X"ddial" -a "X$ppp_mode" != X"direct" \
-a "X$ppp_mode" != X"dedicated" ]; then \
ppp_mode="auto";
fi
ppp_command="-${ppp_mode} ";
# Switch on alias mode?
if [ "X$ppp_alias" = X"YES" ]; then
ppp_command="${ppp_command} -alias";
fi
echo -n 'Starting ppp: '; ppp ${ppp_command} ${ppp_profile}
fi
# Additional ATM interface configuration
if [ -n "${atm_pass1_done}" ]; then
atm_pass2

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $Id: rc.network,v 1.49 1999/07/08 18:56:02 peter Exp $
# $Id: rc.network,v 1.50 1999/07/16 09:26:52 jkh Exp $
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
# Note that almost all the user-configurable behavior is no longer in
@ -144,6 +144,23 @@ network_pass1() {
fi
fi
# Warm up user ppp if required.
if [ "X$ppp_enable" = X"YES" ]; then
# Establish ppp mode.
if [ "X$ppp_mode" != X"ddial" -a "X$ppp_mode" != X"direct" \
-a "X$ppp_mode" != X"dedicated" ]; then \
ppp_mode="auto";
fi
ppp_command="-${ppp_mode} ";
# Switch on alias mode?
if [ "X$ppp_alias" = X"YES" ]; then
ppp_command="${ppp_command} -alias";
fi
echo -n 'Starting ppp: '; ppp ${ppp_command} ${ppp_profile}
fi
# Additional ATM interface configuration
if [ -n "${atm_pass1_done}" ]; then
atm_pass2

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: network.c,v 1.36 1999/05/19 10:49:43 jkh Exp $
* $Id: network.c,v 1.37 1999/07/18 10:18:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -246,7 +246,7 @@ startPPP(Device *devp)
close(fd2);
}
if (!Fake)
fp = fopen("/etc/ppp/ppp.conf", "w");
fp = fopen("/etc/ppp/ppp.conf", "a");
else
fp = fopen("/dev/stderr", "w");
if (!fp) {
@ -268,7 +268,7 @@ startPPP(Device *devp)
dialog_clear_norefresh();
pulse = dialog_yesno("", "Does your telephone line support tone dialing?", -1, -1);
}
fprintf(fp, "default:\n");
fprintf(fp, "\ninstall:\n");
fprintf(fp, " set speed %s\n", speed);
fprintf(fp, " set device %s\n", devp->devname);
fprintf(fp, " set ifaddr %s %s\n", myaddr, provider);
@ -282,10 +282,14 @@ startPPP(Device *devp)
fprintf(fp, " set authkey %s\n", authkey);
fprintf(fp, " set phone %s\n", phone);
}
if (fchmod(fileno(fp), 0640) != 0)
if (fchmod(fileno(fp), 0600) != 0)
msgConfirm("Warning: Failed to fix permissions on /etc/ppp/ppp.conf !");
fclose(fp);
/* Make the ppp config persistent */
variable_set2(VAR_PPP_ENABLE, "YES", 0);
variable_set2(VAR_PPP_PROFILE, "install", 0);
if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
return 0;
@ -318,7 +322,7 @@ startPPP(Device *devp)
}
else
msgDebug("ppp: Unable to get the terminal attributes!\n");
execlp("ppp", "ppp", (char *)NULL);
execlp("ppp", "ppp", "install", (char *)NULL);
msgDebug("PPP process failed to exec!\n");
exit(1);
}

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.170 1999/07/18 10:18:06 jkh Exp $
* $Id: sysinstall.h,v 1.171 1999/07/19 10:06:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -148,6 +148,8 @@
#define VAR_PCNFSD "pcnfsd"
#define VAR_PKG_TMPDIR "PKG_TMPDIR"
#define VAR_PORTS_PATH "ports"
#define VAR_PPP_ENABLE "ppp_enable"
#define VAR_PPP_PROFILE "ppp_profile"
#define VAR_RELNAME "releaseName"
#define VAR_ROOT_SIZE "rootSize"
#define VAR_ROUTER "router"

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: rc.conf.5,v 1.35 1999/07/12 19:24:53 mpp Exp $
.\" $Id: rc.conf.5,v 1.36 1999/07/16 09:22:01 jkh Exp $
.\"
.Dd April 26, 1997
.Dt RC.CONF 5
@ -218,6 +218,30 @@ ifconfig_ed0_alias4="inet 127.0.0.254 netmask 0xffffffff"
.Ed
Then note that alias4 would \fBnot\fR be added since the search would
stop with the missing alias3 entry.
.It Ar ppp_enable
(bool) If set to
.Ar YES ,
run the
.Xr ppp 8
daemon.
.It Ar ppp_mode
(str) Mode in which to run the
.Xr ppp 8
daemon. Accepted modes are
.Ar auto , ddial , direct
and
.Ar dedicated .
See the manual for a full description.
.It Ar ppp_alias
(bool) If set to
.Ar YES ,
enables packet aliasing. Used in conjunction with
.Ar gateway_enable
allows hosts on private network addresses access to the Internet using
this host as a network address translating router.
.It Ar ppp_profile
(str) The name of the profile to use from
.Ar /etc/ppp/ppp.conf .
.It Ar rc_conf_files
(str) This option is used to specify a list of files that will override
the settings in

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.170 1999/07/18 10:18:06 jkh Exp $
* $Id: sysinstall.h,v 1.171 1999/07/19 10:06:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -148,6 +148,8 @@
#define VAR_PCNFSD "pcnfsd"
#define VAR_PKG_TMPDIR "PKG_TMPDIR"
#define VAR_PORTS_PATH "ports"
#define VAR_PPP_ENABLE "ppp_enable"
#define VAR_PPP_PROFILE "ppp_profile"
#define VAR_RELNAME "releaseName"
#define VAR_ROOT_SIZE "rootSize"
#define VAR_ROUTER "router"

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: network.c,v 1.36 1999/05/19 10:49:43 jkh Exp $
* $Id: network.c,v 1.37 1999/07/18 10:18:05 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -246,7 +246,7 @@ startPPP(Device *devp)
close(fd2);
}
if (!Fake)
fp = fopen("/etc/ppp/ppp.conf", "w");
fp = fopen("/etc/ppp/ppp.conf", "a");
else
fp = fopen("/dev/stderr", "w");
if (!fp) {
@ -268,7 +268,7 @@ startPPP(Device *devp)
dialog_clear_norefresh();
pulse = dialog_yesno("", "Does your telephone line support tone dialing?", -1, -1);
}
fprintf(fp, "default:\n");
fprintf(fp, "\ninstall:\n");
fprintf(fp, " set speed %s\n", speed);
fprintf(fp, " set device %s\n", devp->devname);
fprintf(fp, " set ifaddr %s %s\n", myaddr, provider);
@ -282,10 +282,14 @@ startPPP(Device *devp)
fprintf(fp, " set authkey %s\n", authkey);
fprintf(fp, " set phone %s\n", phone);
}
if (fchmod(fileno(fp), 0640) != 0)
if (fchmod(fileno(fp), 0600) != 0)
msgConfirm("Warning: Failed to fix permissions on /etc/ppp/ppp.conf !");
fclose(fp);
/* Make the ppp config persistent */
variable_set2(VAR_PPP_ENABLE, "YES", 0);
variable_set2(VAR_PPP_PROFILE, "install", 0);
if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
return 0;
@ -318,7 +322,7 @@ startPPP(Device *devp)
}
else
msgDebug("ppp: Unable to get the terminal attributes!\n");
execlp("ppp", "ppp", (char *)NULL);
execlp("ppp", "ppp", "install", (char *)NULL);
msgDebug("PPP process failed to exec!\n");
exit(1);
}

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.170 1999/07/18 10:18:06 jkh Exp $
* $Id: sysinstall.h,v 1.171 1999/07/19 10:06:17 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -148,6 +148,8 @@
#define VAR_PCNFSD "pcnfsd"
#define VAR_PKG_TMPDIR "PKG_TMPDIR"
#define VAR_PORTS_PATH "ports"
#define VAR_PPP_ENABLE "ppp_enable"
#define VAR_PPP_PROFILE "ppp_profile"
#define VAR_RELNAME "releaseName"
#define VAR_ROOT_SIZE "rootSize"
#define VAR_ROUTER "router"