/usr/sbin/pppoeconf is in pppoeconf 1.21.
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 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | #!/bin/sh
# (c) Eduard Bloch <blade@debian.org>, Gregory Colpart <reg@evolix.fr>
# LICENSE: GPL
# Purpose: initial PPPoE configuration on Debian
# Depends: ppp, whiptail, gettext, sed
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=pppoeconf
export OPTSFILE="/etc/ppp/peers/dsl-provider"
export REALINTFILE="/etc/network/interfaces"
# IMPORTANT: Do not use gdialog unless it has been fixed!
DIALOG=whiptail
# Get -nox option to force ncurses use
if [ "$1" = "-nox" ]; then
export NOX=true
shift
fi
# Set up (X)dialog - added by Fabian Franz <knx-ppp@fabian-franz.de>
XDIALOG_HIGH_DIALOG_COMPAT=1
export XDIALOG_HIGH_DIALOG_COMPAT
if [ -n "$DISPLAY" ] && [ -x /usr/bin/Xdialog ] && [ ! -n "$NOX" ]; then
DIALOG="Xdialog"
X11="-X"
fi
# SUID wrapper for KNOPPIX added by Klaus Knopper <knoppix@knopper.net>
# mod. by EB
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export PATH
. /usr/bin/gettext.sh
# for non-root, try to reexec with sudo, warn otherwise
if [ "`id -u`" != "0" ]; then
# sudo only
if which sudo >/dev/null && ( sudo -l -S </dev/null >/dev/null 2>&1 ) ; then
exec sudo "$0" "$@" || exit 1
elif which su-to-root >/dev/null; then
exec su-to-root $X11 -c "$0" "$@" || exit 1
elif [ -n "$X11" ] && which gksu >/dev/null; then
exec gksu "$0" "$@" || exit 1
else
gettext "Please become root before running pppoeconf!"
echo
gettext "Press return to continue..."
echo
read enter
exit 1
fi
fi
# EOF SUID wrapper
modprobe -q pppoe
# recent ppp packages have a PPPoE discovery helper program
if test -x /usr/sbin/pppoe-discovery && test -e /proc/net/pppoe ; then
kernel_pppoe=1
DISCOVERY_PROGRAM=pppoe-discovery
else
if test -x /usr/sbin/pppoe ; then
DISCOVERY_PROGRAM=pppoe
else
gettext "Please install ppp package and enable pppoe support in the kernel, or install pppoe package!"
echo
gettext "Press return to continue..."
echo
read enter
exit 1
fi
fi
export DISCOVERY_PROGRAM
# create a default peers file if there is none
if ! test -r $OPTSFILE ; then
fresh_optsfile=1
cat <<EOM > $OPTSFILE
# Minimalistic default options file for DSL/PPPoE connections
noipdefault
defaultroute
replacedefaultroute
hide-password
#lcp-echo-interval 30
#lcp-echo-failure 4
noauth
persist
#mtu 1492
#persist
#maxfail 0
#holdoff 20
EOM
fi
chmod 0640 $OPTSFILE
chown root:dip $OPTSFILE
# get all Ethernet interfaces
if test "$*" ; then
list="$*"
force_manual=1
else
list=$( LANG=C /bin/ip -f link -o addr list | awk '/^[0-9]*\:.*link\/ether/{print $2}' | grep -v irlan | cut -f1 -d: )
fi
if test "$list" ; then
test "$DIALOG" = "whiptail" && escmsg=$(gettext 'Or press ESC to abort here.')
number=`echo $list | wc -w| tr -d " "`
INTFILE="`mktemp -t interfaces.pppoeconf.XXXXXX`" || exit 1
export INTFILE
cp $REALINTFILE $INTFILE
# set up interfaces file if not present
if ! grep -q "^[[:space:]]*iface[[:space:]]\+dsl-provider" $INTFILE ; then
printf '\niface dsl-provider inet ppp\nprovider dsl-provider\n' >> $INTFILE
fi
umask 177
# make a secure directory
#TMP="`mktemp -d -p /etc/ppp`"
TMP="`mktemp -d`"
chmod 700 $TMP
export TMP
gettext '
Most providers send the needed login information per mail. Some providers describe it in odd ways, assuming the user to input the data in their "user-friendly" setup programs. But in fact, these applications generate usuall PPP user names and passwords from the entered data. You can find the real names too and input the correct data in the dialog box.
For example, this are methods used some german providers:
Sample username (alias "login" or "login name"): 11111111111
T-Online T-DSL:
additional data:
sample T-Onlinenummer: 222222222222
sample Mitbenutzer: 0001
complete username: 111111111111222222222222#0001@t-online.de
Telekom Business Online (DSL):
complete username: t-online-com/111111111111@t-online-com.de
1und1 uses another scheme (using above example):
complete username: 1und1/11111111111
Cyberfun:
complete username: sdt/11111111111
Komtel:
additional data:
downstream speed class: 768
complete username: 11111111111@FoniNet-768
Net Cologne:
complete username: 11111111111@netcologne.de
Q-DSL:
complete username: 11111111111@q-dsl.de
Versatel:
complete username: 11111111111@VersaNet-1024k
Webnetix:
complete username: sdt/11111111111
' > $TMP/namehelp.txt
sectempfile="`mktemp -p $TMP`"
export sectempfile
trap "rm -rf '$TMP'" 0 HUP INT TRAP TERM
# now, execute an AC lookup on each interface
for mmm in '' ' -U ' ; do
for iface in $list; do
# use the first candidate only, this is done anyways, below
if test -z "`grep -l AC $TMP/*.pppoe 2>/dev/null| cut -f1 -d"." | head -n1`" ; then
title=$(gettext 'SCANNING DEVICE')
text=$(eval_gettext 'Looking for PPPoE Access Concentrator on $iface...')
if test -n "$mmm" ; then
mmode=$(gettext '(multi-modem mode)')
fi
touch $TMP/pppoe.scan
ip link set $iface up
($DISCOVERY_PROGRAM $mmm -A -I $iface > $TMP/$iface.pppoe ; rm $TMP/pppoe.scan) &
( time=0 ; while test -f $TMP/pppoe.scan ; do time=`expr $time + 6`; echo $time; sleep 1; done ) | $DIALOG --title "$title" --gauge "$text $mmode" 10 60 0
true
fi
done
done
cd "$TMP"
if test "$force_manual" ; then
iface=$1
else
iface=`grep -l AC *.pppoe| sed "s/\.pppoe$//" | head -n1`
fi
ifacenocomma=$(echo $iface | sed -e 's/,/\\,/g')
if test -z "$iface" ; then
title=$(gettext 'NOT CONNECTED')
text=$(eval_ngettext \
'Sorry, I scanned $number interface, but the Access Concentrator of your provider did not respond. Please check your network and modem cables. Another reason for the scan failure may also be another running pppoe process which controls the modem.' \
'Sorry, I scanned $number interfaces, but the Access Concentrator of your provider did not respond. Please check your network and modem cables. Another reason for the scan failure may also be another running pppoe process which controls the modem.' \
$number)
$DIALOG --title "$title" --clear --msgbox "$text" 15 60
rm -rf "$TMP"
exit 1
fi
# title=$(gettext 'DSL CONNECTION FOUND')
# text=$(eval_gettext 'I found an Access Concentrator on $iface. Should I setup PPPOE for this connection?')
# $DIALOG --title "$title" --clear --yesno "$text" 15 60
# # STATUS: interface is $iface, we can continue
if ! test "$fresh_optsfile" ; then
title=$(gettext 'OKAY TO MODIFY')
text=$(eval_gettext 'If you continue with this program, these configuration files will be modified : $OPTSFILE $REALINTFILE and /etc/ppp/*-secrets. Please make sure that you have a backup copy before saying Yes.
Continue with configuration?')
$DIALOG --title "$title" --clear --yesno "$text" 22 70
case $? in
1)
rm -rf "$TMP"
exit 0
;;
255)
rm -rf "$TMP"
exit 1
esac
fi
if ! grep -q "^[[:space:]]*\(allow-\)\?\(auto\|hotplug\)[[:space:]]\+$iface" $INTFILE ; then
echo >> $INTFILE
echo "auto $iface" >> $INTFILE
fi
if ! grep -q "^[[:space:]]*iface[[:space:]]\+$iface" $INTFILE ; then
echo "iface $iface inet manual" >> $INTFILE
fi
# if test "$?" = "0"; then
if [ "$kernel_pppoe" ]; then
# interface activation code - this sucks here, pppd plugin should do it as needed
#sed -i -e "s,pre-up /sbin/ifconfig[[:space:]]\+[^[:space:]]\+[[:space:]]\+up.#.line.maintained.by.pppoeconf,pre-up /sbin/ifconfig $ifacenocomma up # line maintained by pppoeconf," $INTFILE
# FIXME: Make sure that it gets added to correct iface stanza! (Because it's not always added above)
PATTERN_PREUP_IFACE_LEGACY="pre-up /sbin/ifconfig[[:space:]]\+[^[:space:]]\+[[:space:]]\+up.#.line.maintained.by.pppoeconf"
PATTERN_PREUP_IFACE="pre-up /bin/ip link set[[:space:]]\+[^[:space:]]\+[[:space:]]\+up.#.line.maintained.by.pppoeconf"
REPLACE_PREUP_IFACE="pre-up /bin/ip link set $ifacenocomma up # line maintained by pppoeconf"
if grep -q "$PATTERN_PREUP_IFACE_LEGACY" $INTFILE; then
sed -i -e "s,$PATTERN_PREUP_IFACE_LEGACY,$REPLACE_PREUP_IFACE," $INTFILE
elif grep -q "$PATTERN_PREUP_IFACE" $INTFILE; then
sed -i -e "s,$PATTERN_PREUP_IFACE,$REPLACE_PREUP_IFACE," $INTFILE
else
sed -i -e "s,[^#]*\(iface dsl-provider.*\),\1\n$REPLACE_PREUP_IFACE," $INTFILE
fi
# change peers config file, sanity check first
# grep -q "^plugin.*rp-pppoe.so" $OPTSFILE || echo "plugin rp-pppoe.so $iface" >> $OPTSFILE
if [ "${iface##eth*}" = "" ]; then
# Name is eth*
grep -q "^[[:space:]]*plugin.*rp-pppoe.so" $OPTSFILE || echo "plugin rp-pppoe.so $iface" >> $OPTSFILE
else
grep -q "^[[:space:]]*plugin.*rp-pppoe.so" $OPTSFILE || echo "plugin rp-pppoe.so" >> $OPTSFILE
grep -q "^[[:space:]]*nic-$iface" $OPTSFILE || echo "nic-$iface" >> $OPTSFILE
fi
# disable the pppoe tunnel command
if grep -q '^[[:space:]]*pty' $OPTSFILE ; then
sed -i -e 's/^[[:space:]]*pty/#pty/' $OPTSFILE
fi
# set the interface
sed -i -e "s,^plugin.\+rp-pppoe.so[[:space:]]\+[^[:space:]]*,plugin rp-pppoe.so $ifacenocomma," $OPTSFILE
sed -i -e "s,^nic-[[:alnum:]]*,nic-$ifacenocomma," $OPTSFILE
else
# sanity check first, fix the config file
# disable all lines
sed -i -e 's/^pty/#&/' $OPTSFILE
# install alternative lines
grep -q '^[[:space:]]*#[[:space:]]*pty.*pppoe.*-m.*1452' $OPTSFILE || echo '#pty "pppoe -I eth0 -T 80 -m 1452"' >> $OPTSFILE
grep -q '^[[:space:]]*#[[:space:]]*pty.*pppoe.*-m.*1412' $OPTSFILE || echo '#pty "pppoe -I eth0 -T 80 -m 1412"' >> $OPTSFILE
# activate or install default line before the question
sed -i -e '/^[[:space:]]*#[[:space:]]*pty "pppoe -I.*-T 80"/d' $OPTSFILE
grep -q '^[[:space:]]*pty' $OPTSFILE || echo 'pty "pppoe -I eth0 -T 80"' >> $OPTSFILE
# set the interface
sed -i -e "s,-I[[:space:]]*[[:alnum:]]*,-I $ifacenocomma," $OPTSFILE
fi
# fix final newline
test -e /etc/ppp/pap-secrets && ( [ $(tail -1 /etc/ppp/pap-secrets | wc -l) -eq 0 ] || echo >> /etc/ppp/pap-secrets )
test -e /etc/ppp/chap-secrets && ( [ $(tail -1 /etc/ppp/chap-secrets | wc -l) -eq 0 ] || echo >> /etc/ppp/chap-secrets )
# else
# rm -rf "$TMP"
# exit 1
# fi
# ask about sane options
#$DIALOG --title $"POPULAR OPTIONS" --clear --yesno $"Most people using popular dialup providers prefer the options 'noauth' and 'defaultroute' in their configuration and remove the 'nodetach' option. Further, for busy providers the lcp-echo-interval could be increased. Should I check your configuration file and change these settings where neccessary?" 22 70
title=$(gettext 'POPULAR OPTIONS')
text=$(gettext "Most people using popular dialup providers prefer the options 'noauth' and 'defaultroute' in their configuration and remove the 'nodetach' option. Should I check your configuration file and change these settings where neccessary?")
$DIALOG --title "$title" --clear --yesno "$text" 22 70
case $? in
0)
grep -q '^[[:space:]]*noauth' $OPTSFILE || echo 'noauth' >> $OPTSFILE
grep -q '^[[:space:]]*defaultroute' $OPTSFILE || echo 'defaultroute' >> $OPTSFILE
sed -i -e "/^[[:space:]]*nodetach.*/d" $OPTSFILE
#sed -i -e "s/^lcp-echo-interval 20$/lcp-echo-interval 60/" $OPTSFILE
;;
255)
rm -rf "$TMP"
exit 1
;;
esac
user=`grep ^user $OPTSFILE|cut -f2 -d" " | tr -d '"'`
test -z "$user" && user="username"
while test "$goahead" != "yes" ; do
title=$(gettext 'ENTER USERNAME')
text=$(gettext 'Please enter the username which you usually need for the PPP login to your provider in the input box below. If you wish to see the help screen, delete the username and press OK.')
$DIALOG --nocancel --title "$title" --clear --inputbox "$text" 15 60 $user 2> "$sectempfile"
user=`cat "$sectempfile"`
case $? in
0)
if test -z "$user" ; then
$DIALOG --scrolltext --textbox "$TMP/namehelp.txt" 17 75
else
sed -i -e '/^user .*/d' $OPTSFILE
echo "user \"$user\"" >> $OPTSFILE
goahead="yes"
export goahead
fi
;;
*)
rm -rf "$TMP"
exit 1
;;
esac
done
title=$(gettext 'ENTER PASSWORD')
text=$(gettext 'Please enter the password which you usually need for the PPP login to your provider in the input box below.
NOTE: you can see the password in plain text while typing.')
$DIALOG --nocancel --title "$title" --clear --inputbox "$text" 15 60 2> "$sectempfile"
pass=`cat "$sectempfile"`
usernoslash=$(echo $user | sed -e 's,/,\\/,')
case $? in
0)
sed -i -e "s/^\(\"*$usernoslash\"* .*\)/#\1/" /etc/ppp/pap-secrets
echo "\"$user\" * \"$pass\"" >> /etc/ppp/pap-secrets
sed -i -e "s/^\(\"*$usernoslash\"* .*\)/#\1/" /etc/ppp/chap-secrets
echo "\"$user\" * \"$pass\"" >> /etc/ppp/chap-secrets
;;
*)
rm -rf "$TMP"
exit 1
;;
esac
# ask about DNS
title=$(gettext 'USE PEER DNS')
text=$(gettext 'You need at least one DNS IP address to resolve the normal host names. Normally your provider sends you addresses of useable servers when the connection is established. Would you like to add these addresses automatically to the list of nameservers in your local /etc/resolv.conf file? (recommended)')
$DIALOG --title "$title" --clear --yesno "$text" 15 60
case $? in
0)
grep -q "^[[:space:]]*usepeerdns" $OPTSFILE || echo "usepeerdns" >> $OPTSFILE
;;
1)
sed -i -e "/^[[:space:]]*usepeerdns/d" $OPTSFILE
;;
255)
rm -rf "$TMP"
exit 1
;;
esac
# ask about MSS limitation
title=$(gettext 'LIMITED MSS PROBLEM')
text=$(gettext "Many providers have routers that do not support TCP packets with a MSS higher than 1460. Usually, outgoing packets have this MSS when they go through one real Ethernet link with the default MTU size (1500). Unfortunately, if you are forwarding packets from other hosts (i.e. doing masquerading) the MSS may be increased depending on the packet size and the route to the client hosts, so your client machines won't be able to connect to some sites. There is a solution: the maximum MSS can be limited by pppoe. You can find more details about this issue in the pppoe documentation.
Should pppoe clamp MSS at 1452 bytes?
If unsure, say yes.
(If you still get problems described above, try setting to 1412 in the dsl-provider file.)")
$DIALOG --title "$title" --clear --yesno "$text" 22 70
case $? in
0)
if [ "$kernel_pppoe" ]; then
printf '#!/bin/sh\n# Enable MSS clamping (autogenerated by pppoeconf)\n\niptables -t mangle -o "$PPP_IFACE" --insert FORWARD 1 -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:65495 -j TCPMSS --clamp-mss-to-pmtu\n' > /etc/ppp/ip-up.d/0clampmss
printf '#!/bin/sh\n# Disable MSS clamping (autogenerated by pppoeconf)\n\niptables -t mangle -L -n -v --line-numbers | grep "TCPMSS.*$PPP_IFACE.*clamp" | cut -f1 -d " " | sort -r | xargs -n1 -r iptables -t mangle -D FORWARD\n' > /etc/ppp/ip-down.d/0clampmss
chmod 755 /etc/ppp/ip-up.d/0clampmss /etc/ppp/ip-down.d/0clampmss
else
# disable default line
sed -i -e 's/^pty/#&/' $OPTSFILE
# enable the one with our mss size
sed -i -e 's/^#\(pty.*-m 1452.*\)/\1/' $OPTSFILE
#rm -f "$sectempfile"
fi
;;
255)
rm -rf "$TMP"
exit 1
;;
esac
if test -z "`mount | grep KNOPPIX`" ; then
title=$(gettext 'DONE')
text=$(gettext 'Your PPPD is configured now. Would you like to start the connection at boot time?')
$DIALOG --title "$title" --clear --yesno "$text" 15 60
if test "$?" = "0"; then
grep -q "^[[:space:]]*auto.*dsl-provider" $INTFILE || sed -i -e 's/^[[:space:]]*iface.*dsl-provider/auto dsl-provider\n&/' $INTFILE
else
sed -i -e '/^[[:space:]]*auto.*dsl-provider/d' $INTFILE
fi
fi
cd /
# end of story
rm -rf "$TMP"
chmod --reference=$REALINTFILE $INTFILE
# check that final file is valid or original one was already invalid. otherwise ask what to do
ifup -nai $INTFILE 2>/dev/null
if test "$?" = "1" && (ifup -na 2>/dev/null; test "$?" = "0"); then
title=$(gettext 'ERROR')
text=$(eval_gettext 'The interfaces file generated by pppoeconf appears to be invalid. This is probably because pppoeconf is unable to handle your original interfaces file. Should pppoeconf nevertheless change your interfaces file with the one that appears to be invalid?
If you agree, you will probably break your network connectivity after rebooting, and cause some local problems if lo is down. Your original interfaces file will be moved to $REALINTFILE~ so you can restore it.
If not, you will have to make sure that $iface is configured before starting your DSL connection and start the connection manually.
Note that this situation is not expected and you should consider submitting a bug report against pppoeconf including your original interfaces file and the one generated by pppoeconf.')
$DIALOG --title "$title" --clear --defaultno --yesno "$text" 20 75
case $? in
0)
mv -b $INTFILE $REALINTFILE || exit 1
;;
1)
exit 0
;;
255)
exit 1
;;
esac
else
mv $INTFILE $REALINTFILE || exit 1
fi
title=$(gettext 'ESTABLISH A CONNECTION')
text=$(gettext 'Now, you can make a DSL connection with "pon dsl-provider" and terminate it with "poff". Would you like to start the connection now?')
$DIALOG --title "$title" --clear --yesno "$text" 15 60
case $? in
0)
cd /
pon dsl-provider
title=$(gettext 'CONNECTION INITIATED')
text=$(gettext 'The DSL connection has been triggered. You can use the "plog" command to see the status or "ip addr show ppp0" for general interface info.')
$DIALOG --title "$title" --clear --msgbox "$text" 10 60
;;
1)
exit 0
;;
255)
exit 1
;;
esac
else
title=$(gettext 'NO INTERFACE FOUND')
text=$(gettext 'Sorry, no working ethernet card could be found.')
$DIALOG --title "$title" --clear --msgbox "$text" 20 70
exit 0
fi
|