LDAP and Ruby
There is a need for users at my job to create accounts and manage passwords. Since we are bringing online a new Sun One LDAP server for personal use, we have no GUI tools for the end user. Building on our Ruby experience we looked there for help with web tools. There is a method to change userPassword attribute in Ruby (thanks Ollivier Robert):
You need to hash the password:
—–
e_password = “{SHA}” + encode64(Digest::SHA1.new(password).digest).chomp
—–then generate the modification:
—–
# Do the modification
#
reset = [
LDAP.mod(LDAP::LDAP_MOD_REPLACE, "userPassword", [e_password]),
]conn.bind(USER, PASS) do
begin
conn.modify(”uid=#{login},#{BASE}”, reset)
rescue LDAP::ResultError => msg
puts “Can’t change password: ” + msg
exit 0
rescue LDAP::Error => errcode
puts “Can’t change password: ” + LDAP.err2string(errcode)
exit 0
end
end
Load the Ruby-ldap module and off you go. All there is needed now is an interface for input. Soon we will rule the world…

Comments (3 comments)
Are you using the native ruby ldap module? ruby-net-ldap?
[Reply]
Manuel / Thursday, June 14th, 2007, 2:49 pm
The rss feed on your root site only loaded once. And now it won’t update new stories. It looks like you had 2 stories. One a welcome and the second the aggregated feeds?
[Reply]
Manuel / Thursday, June 14th, 2007, 2:50 pm
no, I am using ruby-ldap:
http://sourceforge.net/projects/ruby-ldap/
I am looking at ruby-net-ldap but we are authenticating using ruby-ldap.
As for the rss feeder from the root site, yes it only updates on a refresh and does not work regularly. I need to fix that.
[Reply]
ruben / Thursday, June 14th, 2007, 9:34 pm
What do you think?