How do you setup MD5 using Freeradius and MySQL?

Frank Reiss f.reiss at impeva.com
Mon Jan 16 15:14:09 CET 2006


Hi,

Well I did not get the zip file but did find the solution. What I did not 
know was to add the information into the database.

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from radcheck;
+----+------------+----------------+----+------------------------------------+
| id | UserName   | Attribute      | op | Value 
|
+----+------------+----------------+----+------------------------------------+
|  1 | fred       | User-Password  | == | wilma 
|
|  2 | barney     | User-Password  | == | betty 
|
|  3 | dialrouter | User-Password  | == | dialup 
|
|  4 | frankr     | User-Password  | == | missy 
|
|  6 | flr        | Crypt-Password | == | $1$M/Dyy6Ix$wEc4DMMhp4MK222lTn1X/0 
|
|  7 | flr3       | Crypt-Password | == | $1$NxQPW2DB$glf2EPj/iPS3H8SwId6mA. 
|
|  5 | flr1       | Crypt-Password | == | $1$HoIOzDKM$.TZWU5kiU9.sjHGrbSkc.1 
|
|  8 | flr1       | Auth-Type      | == | Crypt-Local 
|
|  9 | flr        | Auth-Type      | == | Crypt-Local 
|
| 10 | flr3       | Auth-Type      | == | Crypt-Local 
|
| 11 | flr2       | Crypt-Password | == | $1$bZTA.bno$RgogLTF9j9/H7jTsnAsLQ. 
|
| 12 | flr2       | Auth-Type      | == | Crypt-Local 
|
| 13 | flr4       | Crypt-Password | == | $1$Q42F5AEu$Oq7g9z2s38PsQ4Qzjv14Z0 
|
| 14 | flr4       | Auth-Type      | == | Crypt-Local 
|
+----+------------+----------------+----+------------------------------------+
14 rows in set (0.01 sec)

Below is a test bash shell that works

#!/bin/bash
set -v
IDV=$(mysql radius -e "select max(id)+1 from radcheck;" | grep -v max)
USV=$(mysql radius -e "select UserName from usergroup where UserName = 
'$1';" | grep -c $1)
HTS=$(grep master-host /etc/my.cnf | awk -F= '{ print $2 }')
HPW=$(grep master-password /etc/my.cnf | awk -F= '{ print $2 }')
HUS=$(grep master-user /etc/my.cnf | awk -F= '{ print $2 }')
HCP=$(openssl passwd -1 $2)
echo "$2 $HCP"
if [ $USV -eq 0 ]
then
  RSV=$(mysql radius -e "select UserName from radcheck where UserName = 
'$1';" | grep -c "$1")
  if [ $RSV -eq 0 ]
  then
    echo "Adding user $1 $2"
    echo "insert into usergroup (UserName, GroupName) values('$1', 
'dynamic');" > /tmp/maddusr.tmp
    echo "insert into radcheck ( UserName, Attribute, op, Value) 
values('$1', 'Crypt-Password', '==', '$HCP');" >> /tmp/maddusr.tmp
    echo "insert into radcheck ( UserName, Attribute, op, Value) 
values('$1', 'Auth-Type', '==', 'Crypt-Local');" >> /tmp/maddusr.tmp
    echo "select * from usergroup;" >> /tmp/maddusr.tmp
    echo "select * from radcheck;" >> /tmp/maddusr.tmp
    cat /tmp/maddusr.tmp
    mysql radius < /tmp/maddusr.tmp > /tmp/maddusr.log
    radtest $1 $2 localhost 1 p1zzap1e | tee -a /tmp/maddusr.log
#    rm -f /tmp/maddusr.tmp
  fi
fi
[root at localhost ~]#

Frank Reiss
Impeva Labs, Inc.
Phone: 1-850-872-7099

COMPANY CONFIDENTIAL NOTICE
This electronic mail transmission and any accompanying documents contain
information belonging to the sender which may be company confidential and 
legally
privileged. If you are not the intended recipient, any disclosure, copying,
distribution or action taken in reliance on the message is strictly
prohibited. If you have received this message in error, please delete it.
Thank You

----- Original Message ----- 
From: "Marco Spiga" <ctxspi at gmail.com>
To: "Frank Reiss" <f.reiss at impeva.com>
Cc: "FreeRadius users mailing list" <freeradius-users at lists.freeradius.org>
Sent: Saturday, January 14, 2006 6:55 AM
Subject: Re: How do you setup MD5 using Freeradius and MySQL?


> On Fri, Jan 13, 2006 at 06:18:41PM -0600, Frank Reiss wrote:
>> From: "Frank Reiss" <f.reiss at impeva.com>
>> To: <freeradius-users at lists.freeradius.org>
>> Date: Fri, 13 Jan 2006 18:18:41 -0600
>> X-Mailer: Microsoft Outlook Express 6.00.2900.2180
>> Subject: How do you setup MD5 using Freeradius and MySQL?
>>
>> HI,
>>
>> Well I tested the MD5 authentication using the user file and that worked 
>> but I still can not figure out how to do it against the mysql database. 
>> Is there anyone out there that knows hot to set this up I would 
>> appreciate some HELP!!
>>
>> Frank Reiss
>> -
>> List info/subscribe/unsubscribe? See 
>> http://www.freeradius.org/list/users.html
> ---fine del testo---
>
> If you want I send you a file tar.gz that work fine with Postgresql and 
> eap-md5!!!
> I think there are few differences!!!
> Sorry for my bad english!!!
> -- 
> !!!!! Messaggio da Marco !!!!!
>
> 





More information about the Freeradius-Users mailing list