[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby Radius Dictionary

Aby azid Abu bakar

10/26/2007 4:26:00 AM

Hie,

Im trying to communicate with radius server using example file from
ruby-radius-0.9.9 and encountered with this error

"/usr/lib/ruby/site_ruby/1.8/radius/dictionary.rb:294:in
`vsattr_numtype': undefined method `[]' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/radius/packet.rb:145:in
`unpack'
from radiusclient.rb:50"

Can anyone help.

Thanks,
Aby Azid
--
Posted via http://www.ruby-....

5 Answers

dusty

10/26/2007 9:20:00 PM

0

On Oct 26, 12:25 am, Aby azid Abu bakar <aby_a...@yahoo.com> wrote:
> Hie,
>
> Im trying to communicate with radius server using example file from
> ruby-radius-0.9.9 and encountered with this error
>
> "/usr/lib/ruby/site_ruby/1.8/radius/dictionary.rb:294:in
> `vsattr_numtype': undefined method `[]' for nil:NilClass (NoMethodError)
> from /usr/lib/ruby/site_ruby/1.8/radius/packet.rb:145:in
> `unpack'
> from radiusclient.rb:50"
>
> Can anyone help.
>
> Thanks,
> Aby Azid
> --
> Posted viahttp://www.ruby-....

I'm using that library, I just ran a test and that file worked fine
for me.

I am using the auth.rb file to simply check for authorization. It
works well for me.

First, I had to change this line in auth.rb

attr_reader :@packet
to
attr_reader :packet

Here is the class I made for checking authentication.

class RadiusUtils

def initialize(hostname,secret)
@hostname, @secret = hostname, secret
@dictionary = "/some/path/to/dictionary"
end

def authenticate(username,password,nasip=nil,timeout=nil)
nasip = nasip || "127.0.0.1"
timeout = timeout || 5
rad = Radius::Auth.new(@dictionary,@hostname,nasip,timeout)
rad.check_passwd(username,password,@secret)
end

end

radius = RadiusUtils.new("x.x.x.x","secret")
radius.authenticate("username","password")


If you are only trying to authenticate to radius, perhaps that will
work for you.

Aby azid Abu bakar

10/27/2007 1:50:00 AM

0

hie thanks for the reply,

may i know which dictionary you are using?

thanks,

Aby Azid
--
Posted via http://www.ruby-....

Aby azid Abu bakar

10/27/2007 2:31:00 AM

0

I'm still new with radius protocol. Does the dictionary in radius client
have to be the same as dictionary in Radius Server?. I checked packet.rb
and found comment that the coding is referring to RFC 2138. The
dictionary in the Radius server is following the RFC 2865. Could this be
the problem?

Thanks

--
Posted via http://www.ruby-....

dusty

10/30/2007 3:32:00 PM

0

On Oct 26, 10:30 pm, Aby azid Abu bakar <aby_a...@yahoo.com> wrote:
> I'm still new with radius protocol. Does the dictionary in radius client
> have to be the same as dictionary in Radius Server?. I checked packet.rb
> and found comment that the coding is referring to RFC 2138. The
> dictionary in the Radius server is following the RFC 2865. Could this be
> the problem?
>
> Thanks
>
> --
> Posted viahttp://www.ruby-....

The dictionary is there to map the code in the packet to a friendly
name. So, it doesn't really need to be the same, unless you are using
it to convert that code to text and then comparing the two. If you
stick with simply the code, then you are OK. But, most people use the
dictionaries.

I'd read RFC2865. Radius actually has some of the easier to read
RFC's, that really explain the protocol well.

Here is another thing you could try. Download and install FreeRadius
(www.freeradius.org). That software comes with a bunch of
dictionaries. You'll notice in them, they use $INCLUDE to include
other dictionaries. That isn't going to work here, but you should be
able to copy/paste or cat a few of them together.

It also comes with a command line program called radclient that you
can use to send radius packets to the radius server and it will give
you a full print out of the return packet, including all the
attributes. I would use that to inspect the packet and see what
attributes are coming back to you. Then find that attribute in one of
the many dictionaries, then just copy that whole dictionary over to
your ruby program.

Of course, you could always use tcpdump and take a look at the packet
with wireshark (ethereal). I believe that also uses the freeradius
dictionaries.

Hope that is helpful.

dusty

10/30/2007 3:33:00 PM

0

On Oct 26, 9:49 pm, Aby azid Abu bakar <aby_a...@yahoo.com> wrote:
> hie thanks for the reply,
>
> may i know which dictionary you are using?
>
> thanks,
>
> Aby Azid
> --
> Posted viahttp://www.ruby-....

I'm using the one that comes with the program, but I just have the
basics returning from my radius server, so it works fine for me.