Module: NewRelic::Security::Instrumentation::NetLDAP

Included in:
Prepend
Defined in:
lib/newrelic_security/instrumentation-security/net_ldap/chain.rb,
lib/newrelic_security/instrumentation-security/net_ldap/prepend.rb,
lib/newrelic_security/instrumentation-security/net_ldap/instrumentation.rb

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#search_on_enter(args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/newrelic_security/instrumentation-security/net_ldap/instrumentation.rb', line 8

def search_on_enter(args)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  if args.key?(:base) && !args[:base].empty?
    hash = {}
    hash[:name] = args[:base] if args.key?(:base)
    hash[:filter] = args[:filter] if args.key?(:filter)
    event = NewRelic::Security::Agent::Control::Collector.collect(LDAP, [hash])
  else
    #some times this method is also used during instance creation
    # to know the capabilities of Ldap server. In these
    # situations they don't provide the query parameter, so we filter
    # this event
    NewRelic::Security::Agent.logger.debug "Filtered #{self.class}.#{__method__} because of insufficient args. args : #{args}\n"
  end
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
  return event
end

#search_on_exit(event) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/newrelic_security/instrumentation-security/net_ldap/instrumentation.rb', line 30

def search_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end