3 # radtest Emulate the user interface of the old
4 # radtest that used to be part of FreeRADIUS.
10 exec_prefix="@exec_prefix@"
14 echo "Usage: radtest [OPTIONS] user passwd radius-server[:port] nas-port-number secret [ppphint] [nasname]" >&2
15 echo " -d RADIUS_DIR Set radius directory" >&2
16 echo " -t <type> Set authentication method" >&2
17 echo " type can be pap, chap, mschap, or eap-md5" >&2
18 echo " -x Enable debug output" >&2
22 radclient=$bindir/radclient
23 if [ ! -x "$radclient" ] && [ -x ./radclient ]
28 # radeapclient is used for EAP-MD5.
29 radeapclient=$bindir/radeapclient
32 PASSWORD="User-Password"
34 # We need at LEAST these many options
40 # Parse new command-line options
41 while [ `echo "$1" | cut -c 1` = "-" ]
45 OPTIONS="$OPTIONS -d $2"
57 PASSWORD="User-Password"
60 PASSWORD="CHAP-Password"
63 PASSWORD="MS-CHAP-Password"
66 PASSWORD="User-Password"
67 if [ ! -x "$radeapclient" ]
69 echo "radtest: No 'radeapclient' program was found. Cannot perform EAP-MD5." >&1
72 radclient="$radeapclient"
87 # Check that there are enough options left over.
88 if [ $# -lt 5 ] || [ $# -gt 7 ]
101 echo "User-Name = \"$1\""
102 echo "$PASSWORD = \"$2\""
103 echo "NAS-IP-Address = $nas"
105 if [ "$radclient" = "$radeapclient" ]
107 echo "EAP-Code = Response"
108 echo "EAP-Type-Identity = \"$1\""
109 echo "Message-Authenticator = 0x00"
113 echo "Framed-Protocol = PPP"
115 ) | $radclient $OPTIONS -x $3 auth "$5"