netldap

How do I debug ruby-ldap when a method only returns false?

拟墨画扇 提交于 2020-01-25 08:57:07
问题 My goal is to move an account to another OU. My understanding is that the following code should do the job. However, it returns false . There is no error, warning or exceptions. How do I debug why this isn't working? secure_ldap.rename( olddn: self.dn, newrdn: "CN=#{self.cn}", delete_attributes: true, new_superior: "#{ou}" ) 回答1: Well, one approach might be to add pry and pry-byebug to your application. Modify your code to include binding.pry then run your application: Frame number: 0/0 From:

Ruby net-ldap add user

ぃ、小莉子 提交于 2020-01-11 06:25:30
问题 I am trying to create a new user using ldap by doing this: require 'net/ldap' ldap = Net::LDAP.new ldap.host = 'ldap' ldap.auth('uid=myuser,ou=users,dc=my,dc=domain,dc=com', 'mypass') ldap.bind # this executes successfully, up to this point, all is well dn = 'uid=newuser,ou=users,dc=my,dc=domain,dc=com' attributes = { cn: 'newuser', sn: 'surname', objectclass: ['top', 'agent'] } ldap.add(dn: dn, attributes: attributes) ldap.get_operation_result #=> #<OpenStruct code=21, message="unknown

net-ldap create user with password

牧云@^-^@ 提交于 2019-12-23 15:23:01
问题 I am trying to create an AD account with a password already set using the net-ldap gem. I am able to connect to the server fine. And I am also able to add a new user without passing the :unicodepwd attribute however when the new user is created there is no password set. When I do pass that attribute the user is not created and it fails with error code 53 and the following message Unwilling to perform . I also get the same error if I try to replace the password of the user after I have created

Search for “Enabled” users in net-ldap for Ruby

試著忘記壹切 提交于 2019-12-19 04:09:53
问题 I am using the net-ldap gem to search active directory. I can search for users by using filter: filter = Net::LDAP::Filter.eq("sAMAccountName", "neil*") filter2 = ~Net::LDAP::Filter.eq("objectclass", "computer") joined_filter = Net::LDAP::Filter.join(filter, filter2) ldap.search(:base => treebase, :filter => joined_filter) do |entry| puts entry.sAMAccountName end This gives me all the users whose sAMAccountName starts with neil and is not a computer account. How do I add a filter that only

Net LDAP gem in Ruby: “invalid response-type in search: 24”

纵然是瞬间 提交于 2019-12-12 04:05:43
问题 I'm using LDAP to authenticate to our database, via the net ldap gem under active ldap. It works great from my local system, and when I run it in a console, but when I roll my app out to production, eventually it starts throwing this error: invalid response-type in search: 24 vendor/bundle/ruby/1.9.1/gems/net-ldap-0.2.2/lib/net/ldap.rb:1418:in `block in search Has anyone seen this error before? It seems like its simply the connection getting stale in some fashion - I have multiple web heads,

Active Directory LDAP move user to different OU - Ruby

心不动则不痛 提交于 2019-12-10 17:08:41
问题 I have hit a snag in my integration with Active Directory. I need to be able to move users from one OU to another. I'm using net-ldap 0.5.0 which is on github master branch and dug around in the source code and found out you could do this $ldap.rename( olddn: "cn=bradford ricechip,ou=agents,ou=ihs,ou=test environment,dc=ctatechs,dc=com", newrdn: "cn=bradford ricechip", new_superior: "ou=coach,ou=ihs,ou=test environment,dc=ctatechs,dc=com" ) I'm getting: #<OpenStruct code=53, error_message=

Ruby net-ldap add user

帅比萌擦擦* 提交于 2019-12-01 10:26:34
I am trying to create a new user using ldap by doing this: require 'net/ldap' ldap = Net::LDAP.new ldap.host = 'ldap' ldap.auth('uid=myuser,ou=users,dc=my,dc=domain,dc=com', 'mypass') ldap.bind # this executes successfully, up to this point, all is well dn = 'uid=newuser,ou=users,dc=my,dc=domain,dc=com' attributes = { cn: 'newuser', sn: 'surname', objectclass: ['top', 'agent'] } ldap.add(dn: dn, attributes: attributes) ldap.get_operation_result #=> #<OpenStruct code=21, message="unknown result (21)"> I am new to ldap, and I can't find a place online that provides a clear example of how to use