Diald calls pppd - not the connect script - here is my config which uses pap login


On Thu, 01 Jun 2000, System Administration wrote:
> System Administration writes:
>  > Both SuSE (6.4 - 2.2.14 kernel) and RedHat (6.2 - 2.2.14 kernel) are
>  > choking on diald.  Specifically, some device (tab? tar? tap?) is
>  > created and assigned as an Ethernet interface with an IRQ (usually 5 -
>  > already in use with lpt0) when diald starts up.  Even though I have
>  > SLIP and PPP in the kernels (as modules), and even see sl0 created on
>  > occasion, the overall process isn't working.  Also, where can I find a
>  > more recent version of chat???  I seem to be stuck at v1.22.
> 
> OK, I figured out what tap0 ... tap4 are and why I want them but chat
> is still choking with the following logged event:
> Jun  1 01:45:46 wxsat diald[619]: Calling site 192.168.0.2
> Jun  1 01:45:47 wxsat chat[625]: Can't get terminal parameters: Invalid argument
> Jun  1 01:45:47 wxsat diald[619]: Connect script failed.
> Jun  1 01:45:48 wxsat diald[619]: Delaying 30 seconds before clear to dial.
> 
> This is the same chat that works quite nicely with:
> #!/bin/sh
> #
> localip=0.0.0.0
> remoteip=
> device=/dev/modem
> pppflags="115200 modem defaultroute"
> /usr/sbin/pppd lock connect \
>         '/usr/sbin/chat -f /etc/ppp/ppp.chat' \
>         $device $pppflags $localip:$remoteip
> 
> Other than that, I'm stalled.
> 
> Rick
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-diald" in
> the body of a message to [EMAIL PROTECTED]
--
Mr Cornish Rex
 [EMAIL PROTECTED]

   Ignore Microsoft
    Get a real OS 
These are my diald configuration and script files
I have found that they work verry well for me
I login using pap

Files included -
mode		filename	description
r________	diald.conf	diald configuration
r________	diald.auth	basic auth file for tcp diald control
r________	functions	common functions used by scripts
r_x______	connect		connect script called by diald
r________	pap-secrets	pap secrets file for pap login
r_x______	addroute	diald script called at ip-up
r_x______	delroute	diald script called at ip-down
r_x______	ip-up		ip-up script called by pppd
r_x______	ip-down		ip-down script called by pppd
r________	orig.chains	contains the boot up firewall setup

------------------------------------------------------------------------------
#
#	File - /etc/diald.conf
#	Copyright (c) 1999, D.H.McKay
#
mode ppp					# required mode
tcpport 1313					# diald-top can't change port
linkname diald.internet.connection		# name given to dummy link
linkdesc "Internet through my ip"		# description of link
authsimple /etc/ppp/diald.auth			# authorization file
fifo /var/run/diald.ctl				# need fifo for scripts
mtu 1500					# default mtu
local 192.168.1.254				# dummy interface address
remote my-ip-address				# remote provider address
netmask 255.255.255.0				# netmask for link
dynamic						# addresses will change
device /dev/modem				# dialing device at /dev/modem
connect /etc/ppp/connect			# connect script
ip-up /etc/ppp/addroute				# script on connected
ip-down /etc/ppp/delroute			# script for disconnected
speed 38400					# serial port speed
modem						# the device is a modem
redial-timeout 2				# redial after 2 secs
retry-count 50					# retry 50 times
died-retry-count 50				# restore connection max 50 x
include /usr/lib/diald/standard.filter		# the standard filter rules
pppd-options user my-ip-username noauth 	# options for pppd

------------------------------------------------------------------------------
#
#	File - /etc/ppp/diald.auth
#
*	0xffffffff

------------------------------------------------------------------------------
#
#	File - /etc/ppp/functions
#	Copyright (c) 1999, D.H.McKay
#
#
#	This file contains functions and variables used by all scripts
#

[ !FIFO ] && FIFO=/var/run/diald.ctl

ipchains=/sbin/ipchains
iptables=/usr/local/bin/iptables
ipnatctl=/usr/local/bin/ipnatctl

function logit()
{
  date +"message %a %b %d %T %Y %Z <${0//*\/}[$$]> $1" > $FIFO
  logger -p local2.info -t "${0//*\/}[$$]" "$1"
}

------------------------------------------------------------------------------
#!/bin/sh
#
#	File - /etc/ppp/connect
#       Copyright (c) 1999, D.H.McKay
#

#
#	Include common functions and variables
#
. /etc/ppp/functions  

#
# Modem Init string 	z   = reset
#			e1  = modem echo
#			v1  = long form result codes
#			x4  = enable all return codes
#			s25 = dial speed 
#			s95 = connect reporting options (4 = CARRIER XXXX
#							and CONNECT XXXX)
M_INIT="+++atze1v1x4s25=255s95=4"

#
#	Phone number of provider
#
P_NUMBER="my-ip-phone-number"

# exit code 0 = success, 1 = error
EXITMSG=0
# syslog report string
EXITSTRN=""

#
#	Write to system log and fifo
#
#logit "Modem Initialization"

#
#	The -S switch prevents chat from logging errors to the syslog
#	USE -S ONLY IF THE SCRIPT WORKS	
#
#
#	OK lets initialize the modem
#
chat -S \
	TIMEOUT 5 \
	"" $M_INIT \
	TIMEOUT 45 \
	OK ""

if [ $? != 0 ]; then
	logit "Error initializing modem"
	exit 1
fi

logit "Dialing $P_NUMBER"

#
#	The -S switch prevents chat from logging errors to the syslog
#	USE -S ONLY IF THE SCRIPT WORKS	
#
#	Now lets dial the system
#
#	I cheat here as I want a more complex result than chat normaly gives
#	ABORT is normally for errors - but it gives an individual return
#	code for each string.
#
chat -S \
	TIMEOUT 45 \
	ABORT "NO CARRIER" \
	ABORT BUSY \
	ABORT "NO DIALTONE" \
	ABORT ERROR \
	ABORT "CARRIER 300" \
	ABORT "CARRIER 1200/75" \
	ABORT "CARRIER 75/1200" \
	ABORT "CARRIER 1200" \
	ABORT "CARRIER 2400" \
	ABORT "CARRIER 4800" \
	ABORT "CARRIER 7200" \
	ABORT "CARRIER 9600" \
	ABORT "CARRIER 12000" \
	ABORT "CARRIER 14400" \
	ABORT "CARRIER 16800" \
	ABORT "CARRIER 19200" \
	ABORT "CARRIER 21600" \
	ABORT "CARRIER 24000" \
	ABORT "CARRIER 26400" \
	ABORT "CARRIER 28800" \
	ABORT "CARRIER 31200" \
	ABORT "CARRIER 33600" \
	"" ATDTW"$P_NUMBER" \
	CONNECT "" 

#
#	Lets test the return codes
#
case $? in
   0)	EXITSTRN="Connected Unknown speed";EXITMSG=0;;	#default connect
   1)	EXITSTRN="Chat Error";EXITMSG=1;;		#internal chat error
   2)	EXITSTRN="Chat Script Error";EXITMSG=1;;	#error in script
   3)	EXITSTRN="Chat Timeout";EXITMSG=1;;		#error timed out
   4)	EXITSTRN="No Carrier";EXITMSG=1;;		#no carrier
   5)	EXITSTRN="Busy";EXITMSG=1;;			#phone number busy
   6)	EXITSTRN="No DialTone";EXITMSG=1;;		#nodialtone
   7)	EXITSTRN="Modem Error";EXITMSG=1;;		#general modem error
   8)	EXITSTRN="Error 300 bps GROAN";EXITMSG=1;;	#300 - 12000 bps
   9)	EXITSTRN="Error 1200tx 75rx bps GRR";EXITMSG=1;;#unacceptable
   10)	EXITSTRN="Error 75tx 1200rx bps SHEESH";EXITMSG=1;;
   11)	EXITSTRN="Error 1200 bps HMM";EXITMSG=1;;
   12)	EXITSTRN="Error 2400 bps HNGG";EXITMSG=1;;
   13)	EXITSTRN="Error 4800 bps BOY";EXITMSG=1;;
   14)	EXITSTRN="Error 7200 bps ALMOST";EXITMSG=1;;
   15)	EXITSTRN="Error 9600 bps NOT QUITE";EXITMSG=1;;
   16)	EXITSTRN="Error 12000 bps ALMOST BORDERLINE";EXITMSG=1;;
   17)	EXITSTRN="Connect 14400 bps VERRY SLOW";EXITMSG=0;; #minimum allowed
   18)	EXITSTRN="Connect 16800 bps BIT SLOW";EXITMSG=0;;
   19)	EXITSTRN="Connect 19200 bps SLOW";EXITMSG=0;;
   20)	EXITSTRN="Connect 21600 bps MEDIUM";EXITMSG=0;;
   21)	EXITSTRN="Connect 24000 bps PASSABLE";EXITMSG=0;;
   22)	EXITSTRN="Connect 26400 bps A-";EXITMSG=0;;
   23)	EXITSTRN="Connect 28800 bps A";EXITMSG=0;;
   24)	EXITSTRN="Connect 31200 bps A+";EXITMSG=0;;
   25)	EXITSTRN="Connect 33600 bps YAHOO A++";EXITMSG=0;; #best connect speed
   *)	EXITSTRN="UNKNOWN ERROR $?";EXITMSG=1;;	#default unknown error
esac

logit "$EXITSTRN"

#
#	return result to calling program (diald)
#
exit $EXITMSG

------------------------------------------------------------------------------
#
#	File - /etc/ppp/pap-secrets
#

#hostname	*	password
#(username)	
my-ip-username	*	my-ip-password

------------------------------------------------------------------------------
#!/bin/sh
#
#	File - /etc/ppp/addroute
#	Copyright (c) 1999, D.H.McKay
#

#
#	Include common functions and variables
#
. /etc/ppp/functions

logit "Setting routing"
#logit "route add default gw $4 dev $1"
route add default gw $4 dev $1

------------------------------------------------------------------------------
#!/bin/sh
#
#	File - /etc/ppp/delroute
#       Copyright (c) 1999, D.H.McKay
#

#
#       Include common functions and variables
#
. /etc/ppp/functions

logit "Resetting routing"
#logit "route add default gw my-ip-address"
route add default gw my-ip-address
logit "Link down"

------------------------------------------------------------------------------
#!/bin/sh
#
#	File - /etc/ppp/ip-up
#	Copyright 1999, D.H.McKay
#

#
#       Include common functions and variables
#
. /etc/ppp/functions

# $1 = Interface
# $2 = Tty device
# $3 = speed
# $4 = local ip
# $5 = remote ip
# $6 = ipparam

logit "Starting firewall setup"

$ipchains -F input
$ipchains -P input DENY
$ipchains -A input -j ACCEPT -i eth0 -s 192.168.0.0/16 -d 0.0.0.0/0
$ipchains -A input -j DENY -p udp -i $1 -s 0.0.0.0/0 -d $4/32 0:52 -l
$ipchains -A input -j DENY -p udp -i $1 -s 0.0.0.0/0 -d $4/32 54:1023 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 0:112 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 114:1023 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 6000:6010 -l
$ipchains -A input -j DENY -p icmp --icmp-type echo-request -i $1 -s 0.0.0.0/0 -l
$ipchains -A input -j DENY -p icmp -f -i $1 -s 0.0.0.0/0 -l
$ipchains -A input -j DENY -p udp -i $1 -s 0.0.0.0/0 -d $4/32 5555 -l
$ipchains -A input -j DENY -p udp -i $1 -s 0.0.0.0/0 -d $4/32 8000 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 8000 -l
$ipchains -A input -j DENY -p udp -i $1 -s 0.0.0.0/0 -d $4/32 6667 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 6667 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 4557 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 4559 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 4001 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 2005 -l
$ipchains -A input -j DENY -p tcp -i $1 -s 0.0.0.0/0 -d $4/32 6711 -l
$ipchains -A input -j DENY -i $1 -s 192.168.0.0/16 -d 0.0.0.0/0 -l
$ipchains -A input -j ACCEPT -i $1 -s 0.0.0.0/0 -d $4/32
$ipchains -A input -j ACCEPT -i lo -s 0.0.0.0/0 -d 0.0.0.0/0
$ipchains -A input -j DENY -s 0.0.0.0/0 -d 0.0.0.0/0 -l

$ipchains -F output
$ipchains -P output DENY
$ipchains -A output -j ACCEPT -i eth0 -s 0.0.0.0/0 -d 192.168.0.0/16
$ipchains -A output -j DENY -i $1 -s 192.168.0.0/16 -d 0.0.0.0/0 -l
$ipchains -A output -j ACCEPT -i $1 -s $4/32 -d 0.0.0.0/0
$ipchains -A output -j ACCEPT -i lo -s 0.0.0.0/0 -d 0.0.0.0/0
$ipchains -A output -j DENY -s 0.0.0.0/0 -d 0.0.0.0/0

$ipchains -F forward
$ipchains -P forward DENY
$ipchains -M -S 120 120 120
$ipchains -A forward -j MASQ -s 192.168.1.0/24 
$ipchains -A forward -j DENY -s 0.0.0.0/0 -d 0.0.0.0/0

#logit "Starting fetchmail"
/usr/bin/fetchmail -d 120 -a -v --postmaster my-ip-username >>/var/log/fetchmail 2>&1 &

logit "Firewall setup done"

exit 0

------------------------------------------------------------------------------
#!/bin/sh
#
#	File - /etc/ppp/ip-down
#	Copyright (c) 1999, D.H.McKay
#

#
#       Include common functions and variables
#
. /etc/ppp/functions

# $1 = Interface
# $2 = Tty device
# $3 = Speed
# $4 = Local ip
# $5 = Remote ip

#logit "Killing fetchmail"
fetchmail --quit

logit "Restoring firewall rules"

$ipchains -F input
$ipchains -F output
$ipchains -F forward
/sbin/ipchains-restore < /etc/ppp/orig.chains

logit " Firewall down"

------------------------------------------------------------------------------
#	orig.chains
#	created by - ipchains-save > orig.chains
------------------------------------------------------------------------------
:input ACCEPT
:forward ACCEPT
:output ACCEPT
-A input -s 0.0.0.0/0.0.0.0 -d 192.168.1.1/255.255.255.255
-A output -s 192.168.1.1/255.255.255.255 -d 0.0.0.0/0.0.0.0

------------------------------------------------------------------------------

Reply via email to