help-gnu-radius
[Top][All Lists]
Advanced

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

Re: [Help-gnu-radius] Radauth


From: Gerald
Subject: Re: [Help-gnu-radius] Radauth
Date: Thu, 24 Jun 2004 17:43:27 -0400 (EDT)

On Thu, 24 Jun 2004, Charles Sprickman wrote:

> I think your problem with the encrypted password is that you need to use a
> standard DES or MD5 crypted password, not MySQL's own crypt function.

You are correct. Mysql's crypt function didn't work for me when I was
initially setting up radius. I had to yank it from the system account that
was created on a server.

This might be of use to someone:

#!/usr/local/bin/perl -w
require 'getopts.pl';
use Getopt::Std;
getopts('P:');

$usage="crypt.pl -P \"password\"\n";

if (! $opt_P) {
        print STDOUT $usage;
        exit;
}

sub to64 {
        local($v,$n)address@hidden;
        local($salt,$itoa64);

        $itoa64 =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

        while (--$n>=0) {
                $salt .= substr($itoa64,($v&0x3f),1);
                $v >>= 6;
        }

        return($salt);
}

sub crypt_passwd {
        local($passwd) = @_;
        local($salt);

        srand(time());
        $salt = &to64(rand(32767),2);
        return(crypt($passwd,$salt));
}

                $passwd = "$opt_P";
                $cryptpwd = &crypt_passwd($passwd);
                #print "$passwd:$cryptpwd\n";
                print "$cryptpwd\n";





reply via email to

[Prev in Thread] Current Thread [Next in Thread]