This file is indexed.

/usr/sbin/pppoe-setup is in pppoe 3.8-3ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
#!/bin/sh
#***********************************************************************
#
# pppoe-setup
#
# All-purpose slicing/dicing shell script to configure rp-pppoe.
#
# LIC: GPL
#
# Copyright (C) 2000 Roaring Penguin Software Inc.
#
# $Id: pppoe-setup.in,v 1.2 2005/08/10 00:25:18 dfs Exp $
#***********************************************************************

# From AUTOCONF
prefix=/usr
exec_prefix=${prefix}

# Paths to programs
IFCONFIG=/sbin/ifconfig
PPPD=/usr/sbin/pppd
PPPOE=${exec_prefix}/sbin/pppoe
ECHO=/bin/echo
LOGGER="/usr/bin/logger -t `basename $0`"

# Set to "C" locale so we can parse messages from commands
LANG=C
export LANG

CONFIG=/etc/ppp/pppoe.conf

# Protect created files
umask 077

copy() {
    cp $1 $2
    if [ "$?" != 0 ] ; then
	$ECHO "*** Error copying $1 to $2"
	$ECHO "*** Quitting."
	exit 1
    fi
}

$ECHO "Welcome to the Roaring Penguin PPPoE client setup.  First, I will run"
$ECHO "some checks on your system to make sure the PPPoE client is installed"
$ECHO "properly..."
$ECHO ""

# Must be root
if [ "`/usr/bin/id -u`" != 0 ] ; then
    $ECHO "$0: Sorry, you must be root to run this script"
    exit 1
fi

# Prototype config file must exist
if [ ! -r "$CONFIG" ] ; then
    $ECHO "Oh, dear, I don't see the file '$CONFIG' anywhere.  Please"
    $ECHO "re-install the PPPoE client."
    exit 1
fi

# Must have pppd
if [ ! -x $PPPD ] ; then
    $ECHO "Oops, I can't execute the program '$PPPD'.  You"
    $ECHO "must install the PPP software suite, version 2.3.10 or later."
    exit 1
fi
export CONFIG
. $CONFIG

if [ "$DEMAND" = "" ] ; then
    DEMAND=no
fi

# pppoe must exist
if [ ! -x "$PPPOE" ] ; then
    $ECHO "Oh, dear, I can't execute the program '$PPPOE'.  Please"
    $ECHO "re-install the rp-pppoe client."
    exit 1
fi

$ECHO "Looks good!  Now, please enter some information:"

while [ true ] ; do
    $ECHO ""
    $ECHO "USER NAME"
    $ECHO ""
    printf "%s" ">>> Enter your PPPoE user name (default $USER): "
    read U

    if [ "$U" = "" ] ; then
	U="$USER"
    fi

    # Under Linux, "fix" the default interface if eth1 is not available
    if test `uname -s` = "Linux" ; then
	$IFCONFIG $ETH > /dev/null 2>&1 || ETH=eth0
    fi
    $ECHO ""
    $ECHO "INTERFACE"
    $ECHO ""
    $ECHO ">>> Enter the Ethernet interface connected to the DSL modem"
    $ECHO "For Solaris, this is likely to be something like /dev/hme0."
    $ECHO "For Linux, it will be ethn, where 'n' is a number."
    printf "%s" "(default $ETH): "
    read E

    if [ "$E" = "" ] ; then
	E="$ETH"
    fi

    $ECHO ""
    $ECHO "Do you want the link to come up on demand, or stay up continuously?"
    $ECHO "If you want it to come up on demand, enter the idle time in seconds"
    $ECHO "after which the link should be dropped.  If you want the link to"
    $ECHO "stay up permanently, enter 'no' (two letters, lower-case.)"
    $ECHO "NOTE: Demand-activated links do not interact well with dynamic IP"
    $ECHO "addresses.  You may have some problems with demand-activated links."
    printf "%s" ">>> Enter the demand value (default $DEMAND): "
    read D
    if [ "$D" = "" ] ; then
	D=$DEMAND
    fi

    $ECHO ""
    $ECHO "DNS"
    $ECHO ""
    $ECHO "Please enter the IP address of your ISP's primary DNS server."
    $ECHO "If your ISP claims that 'the server will provide DNS addresses',"
    $ECHO "enter 'server' (all lower-case) here."
    $ECHO "If you just press enter, I will assume you know what you are"
    $ECHO "doing and not modify your DNS setup."
    printf "%s" ">>> Enter the DNS information here: "

    read DNS1


    if [ "$DNS1" != "" ] ; then
        if [ "$DNS1" != "server" ] ; then
	    $ECHO "Please enter the IP address of your ISP's secondary DNS server."
	    $ECHO "If you just press enter, I will assume there is only one DNS server."
	    printf "%s" ">>> Enter the secondary DNS server address here: "
	    read DNS2
	fi
    fi

    while [ true ] ; do
	$ECHO ""
	$ECHO "PASSWORD"
	$ECHO ""
	stty -echo
	printf "%s" ">>> Please enter your PPPoE password:    "
	read PWD1
	$ECHO ""
	printf "%s" ">>> Please re-enter your PPPoE password: "
	read PWD2
	$ECHO ""
	stty echo
	if [ "$PWD1" = "$PWD2" ] ; then
	    break
	fi

	printf "%s" ">>> Sorry, the passwords do not match.  Try again? (y/n)"
	read ANS
	case "$ANS" in
	    N|No|NO|Non|n|no|non)
		$ECHO "OK, quitting.  Bye."
		exit 1
	esac
    done

    # Firewalling
    $ECHO ""
    $ECHO "FIREWALLING"
    $ECHO ""
    if test `uname -s` != "Linux" ; then
	$ECHO "Sorry, firewalling is only supported under Linux.  Consult"
	$ECHO "your operating system manuals for details on setting up"
	$ECHO "packet filters for your system."
	FIREWALL=NONE
    else
	$ECHO "Please choose the firewall rules to use.  Note that these rules are"
	$ECHO "very basic.  You are strongly encouraged to use a more sophisticated"
	$ECHO "firewall setup; however, these will provide basic security.  If you"
	$ECHO "are running any servers on your machine, you must choose 'NONE' and"
	$ECHO "set up firewalling yourself.  Otherwise, the firewall rules will deny"
	$ECHO "access to all standard servers like Web, e-mail, ftp, etc.  If you"
	$ECHO "are using SSH, the rules will block outgoing SSH connections which"
	$ECHO "allocate a privileged source port."
	$ECHO ""
	while [ true ] ; do
	    $ECHO "The firewall choices are:"
	    $ECHO "0 - NONE: This script will not set any firewall rules.  You are responsible"
	    $ECHO "          for ensuring the security of your machine.  You are STRONGLY"
	    $ECHO "          recommended to use some kind of firewall rules."
	    $ECHO "1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation"
	    $ECHO "2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway"
	    $ECHO "                for a LAN"
	    printf "%s" ">>> Choose a type of firewall (0-2): "
	    read a
	    if [ "$a" = 0 -o "$a" = 1 -o "$a" = 2 ] ; then
		break
	    fi
	    $ECHO "Please enter a number from 0 to 2"
	done

	case "$a" in
	    0)
		FIREWALL=NONE
		;;
	    1)
		FIREWALL=STANDALONE
		;;
	    2)
		FIREWALL=MASQUERADE
		;;
	esac
    fi

    $ECHO ""
    $ECHO "** Summary of what you entered **"
    $ECHO ""
    $ECHO "Ethernet Interface: $E"
    $ECHO "User name:          $U"
    if [ "$D" = "no" ] ; then
	$ECHO "Activate-on-demand: No"
    else
	$ECHO "Activate-on-demand: Yes; idle timeout = $D seconds"
    fi

    if [ "$DNS1" != "" ] ; then
        if [ "$DNS1" = "server" ] ; then
	    $ECHO "DNS addresses:      Supplied by ISP's server"
        else
	    $ECHO "Primary DNS:        $DNS1"
	    if [ "$DNS2" != "" ] ; then
		$ECHO "Secondary DNS:      $DNS2"
	    fi
        fi
    else
	$ECHO "DNS:                Do not adjust"
    fi
    $ECHO "Firewalling:        $FIREWALL"
    $ECHO ""
    while [ true ] ; do
        printf "%s" '>>> Accept these settings and adjust configuration files (y/n)? '
        read ANS
	case "ANS" in
	    Y|y|yes|Yes|oui|Oui)
		ANS=y
		;;
            N|n|no|No|non|Non)
		ANS=n
		;;
	esac
	if [ "$ANS" = "y" -o "$ANS" = "n" ] ; then
	    break
        fi
    done
    if [ "$ANS" = "y" ] ; then
	break
    fi
done

# Adjust configuration files.  First to $CONFIG

$ECHO "Adjusting $CONFIG"

copy $CONFIG $CONFIG-bak
if [ "$DNS1" = "server" ] ; then
    DNSTYPE=SERVER
    DNS1=""
    PEERDNS=yes
else
    PEERDNS=no
    if [ "$DNS1" = "" ] ; then
	DNSTYPE=NOCHANGE
    else
	DNSTYPE=SPECIFY
    fi
fi

# Where is pppd likely to put its pid?
if [ -d /var/run ] ; then
    VARRUN=/var/run
else
    VARRUN=/etc/ppp
fi

# Some #$(*& ISP's use a slash in the user name...
sed -e "s&^USER=.*&USER='$U'&" \
    -e "s&^ETH=.*&ETH='$E'&" \
    -e "s&^PIDFILE=.*&PIDFILE=\"$VARRUN/\$CF_BASE-pppoe.pid\"&" \
    -e "s/^FIREWALL=.*/FIREWALL=$FIREWALL/" \
    -e "s/^DEMAND=.*/DEMAND=$D/" \
    -e "s/^DNSTYPE=.*/DNSTYPE=$DNSTYPE/" \
    -e "s/^DNS1=.*/DNS1=$DNS1/" \
    -e "s/^DNS2=.*/DNS2=$DNS2/" \
    -e "s/^PEERDNS=.*/PEERDNS=$PEERDNS/" \
    < $CONFIG-bak > $CONFIG

if [ $? != 0 ] ; then
    $ECHO "** Error modifying $CONFIG"
    $ECHO "** Quitting"
    exit 1
fi

if [ "$DNS1" != "" ] ; then
    if [ "$DNS1" != "server" ] ; then
	$ECHO "Adjusting /etc/resolv.conf"
	if [ -r /etc/resolv.conf ] ; then
	    grep -s "MADE-BY-RP-PPPOE" /etc/resolv.conf > /dev/null 2>&1
	    if [ "$?" != 0 ] ; then
		$ECHO "  (But first backing it up to /etc/resolv.conf-bak)"
		copy /etc/resolv.conf /etc/resolv.conf-bak
	    fi
	fi
	$ECHO "# MADE-BY-RP-PPPOE" > /etc/resolv.conf
	$ECHO "nameserver $DNS1" >> /etc/resolv.conf
	if [ "$DNS2" != "" ] ; then
	    $ECHO "nameserver $DNS2" >> /etc/resolv.conf
	fi
    fi
fi

$ECHO "Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets"
if [ -r /etc/ppp/pap-secrets ] ; then
    $ECHO "  (But first backing it up to /etc/ppp/pap-secrets-bak)"
    copy /etc/ppp/pap-secrets /etc/ppp/pap-secrets-bak
else
    cp /dev/null /etc/ppp/pap-secrets-bak
fi
if [ -r /etc/ppp/chap-secrets ] ; then
    $ECHO "  (But first backing it up to /etc/ppp/chap-secrets-bak)"
    copy /etc/ppp/chap-secrets /etc/ppp/chap-secrets-bak
else
    cp /dev/null /etc/ppp/chap-secrets-bak
fi

egrep -v "^$U|^\"$U\"" /etc/ppp/pap-secrets-bak > /etc/ppp/pap-secrets
$ECHO "\"$U\"	*	\"$PWD1\"" >> /etc/ppp/pap-secrets
egrep -v "^$U|^\"$U\"" /etc/ppp/chap-secrets-bak > /etc/ppp/chap-secrets
$ECHO "\"$U\"	*	\"$PWD1\"" >> /etc/ppp/chap-secrets

$ECHO ""
$ECHO ""
$ECHO ""
$ECHO "Congratulations, it should be all set up!"
$ECHO ""
$ECHO "Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring"
$ECHO "it down.  Type 'pppoe-status' to see the link status."
exit 0