Sha256: 8732aeaedda67ab3ee7dba2e70a880cf207f6bdf8aa1c80427e0daecb4b2c420
Contents?: true
Size: 733 Bytes
Versions: 1
Compression:
Stored size: 733 Bytes
Contents
require 'net/ldap' module PublicKeys class LDAP def initialize(host, port, user_dn = nil, password = nil) @client = Net::LDAP.new @client.host = host @client.port = port @client.auth(user_dn, password) if user_dn end def group_keys(group_dn, base_dn) filter = Net::LDAP::Filter.eq("sshPublicKey", "*") & Net::LDAP::Filter.eq("memberof", group_dn) Array(@client.search(:base => base_dn, :filter => filter)).flat_map { |entry| entry[:sshPublicKey] } end def user_keys(user_dn) filter = Net::LDAP::Filter.eq("sshPublicKey", "*") Array(@client.search(:base => user_dn, :filter => filter)).flat_map { |entry| entry[:sshPublicKey] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
public_keys-0.0.1 | lib/public_keys/ldap.rb |