Re: freeradius + external CHAP auth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Mike,

Saturday, November 15, 2003, 6:10:35 PM, you wrote:

MMT> Hello All,

MMT>    I'm trying to authentificate CHAP users via radius with external script.
MMT>    I use FreeRadius 0.9.2, something like this:
MMT>      DEFAULT Auth-Type := Accept
MMT>         Exec-Program-Wait = "/usr/local/voip/bin/auth"

MMT>    And I have a trouble with CHAP. Earlier I've used XTRadius and it's
MMT>    worked fine. Can anyone give me an example how to calculate MD5
MMT>    digest on PERL for FreeRadius? Maybe there is some nuances?

MMT>    Best regards,
MMT>    Mike                  mike@yes.net.ua



I found the different, thanks. If anyone need procedure for checking
md5 pass for perl it's bottom (or for newbies, like me);

I use freeradius 0.9.2.

use Digest::MD5;

sub chappassok {
my ($given_password,$want_password,$given_chap_challenge) = @_;
        $given_password =~ s/^0x//;
        $given_chap_challenge =~ s/^0x//;
        my $chap_password = pack("H*", $given_password);
        my $chap_challenge = pack("H*", $given_chap_challenge);
        my $md5 = new Digest::MD5;
        $md5->reset;
        $md5->add(substr($chap_password, 0, 1));
        $md5->add($want_password);
        $md5->add($chap_challenge);
        my $digest = $md5->digest();
        if ($digest ne substr($chap_password, 1)) {
                return 0; #Bad pass returning 0
        }
        else {
                return 1; # Pass is OK Returning 1
        } 

}

-- 
Best regards,
 Mike                            mailto:mike@yes.net.ua



-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
List: Openh323gk-users@lists.sourceforge.net
Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
Homepage: http://www.gnugk.org/

[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux