logstash-input-LDAPSearch 0.1.0 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db3a194fc8eb70cfc593b9e0886ae8974dbd4754
4
- data.tar.gz: cb02f1997099adbb1e9f436b2314b9a0386c5601
3
+ metadata.gz: 8806c50a22c8f50e4be0b397f3e4fb3d3c4414fb
4
+ data.tar.gz: 30b3b06e3af70d110f5f47d580fa0ee60d88248e
5
5
  SHA512:
6
- metadata.gz: bdcfb01dc37200f235569b984ab68ec4ce2f2e16ee3995597cbed9cb59c339f5510aab2bf19a39b0c5752ce7ca9fd645ed1ddcbc635cfd9debfdaca682d43b96
7
- data.tar.gz: 7baebc7edf3b43f5c5ca895f9ff90acbe387a049e9650a1a8b88e57b4de7659cbe438b3967d7f0150f918e28314e103d48c9578cf05ea550273fffd7421acbe2
6
+ metadata.gz: 117ea66842f3633c61235d6a0f996a0a3381d692908bcf12a6237bb41108f59148f2db31dbca0052d421f974d8698b8995d4c04b8b8f676c90758dcb65bf32bf
7
+ data.tar.gz: ff130a2ec97704dac70aba418c38a8da71b0a45c12d370f2ea37ba26bb43ae4f59fb89faeefcdb8e85a6ad51dfab3a6b8a25943708815f07b6d2526ec5276ab0
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
  gem 'jruby-ldap'
4
+ #gem 'logstash-devutils', '~> 0.0.10'
@@ -32,6 +32,7 @@ class LogStash::Inputs::LDAPSearch < LogStash::Inputs::Base
32
32
  config :filter, :validate => :string, :required => true
33
33
  config :base, :validate => :string, :required => true
34
34
  config :port, :validate => :number, :default => 389
35
+ config :usessl, :validate => :boolean, :default => false
35
36
  config :attrs, :validate => :array, :default => ['uid']
36
37
 
37
38
  public
@@ -47,9 +48,9 @@ class LogStash::Inputs::LDAPSearch < LogStash::Inputs::Base
47
48
  @host = Socket.gethostbyname(@host).first
48
49
  #attrs = ['uid', 'sn', 'cn', 'eduPersonPrimaryAffiliation']
49
50
  scope = LDAP::LDAP_SCOPE_SUBTREE #LDAP::LDAP_SCOPE_ONELEVEL
50
- conn = LDAP::Conn.new(@host, @port)
51
- conn.bind(@dn, @password.value)
52
51
  begin
52
+ conn = ( @usessl == true ) ? LDAP::SSLConn.new(@host,@port) : LDAP::Conn.new(@host, @port)
53
+ conn.bind(@dn, @password.value)
53
54
  @logger.debug("Executing LDAP search base='#{@base}' filter='#{@filter}'")
54
55
  conn.search(base, scope, filter, attrs) { |entry|
55
56
  # print distinguished name
@@ -58,22 +59,25 @@ class LogStash::Inputs::LDAPSearch < LogStash::Inputs::Base
58
59
  decorate(event)
59
60
  event["host"] = @host
60
61
  entry.get_attributes.each do |attr|
61
- #values = entry.get_values(attr).first
62
- values = entry.get_values(attr)
63
- values = values.map { |value|
62
+ #values = entry.get_values(attr).first
63
+ values = entry.get_values(attr)
64
+ values = values.map { |value|
64
65
  (/[^[:print:]]/ =~ value).nil? ? value : Base64.strict_encode64(value)
65
- }
66
- event[attr] = values
67
- end
68
- #event["attr"] = entry.attrs
69
- queue << event
70
-
71
- }
72
- rescue LDAP::ResultError => ex
73
- @logger.error("LDAP search error: #{ex}\n#{ex.backtrace}")
74
- exit
66
+ }
67
+ event[attr] = values
68
+ end
69
+ #event["attr"] = entry.attrs
70
+ queue << event
71
+ }
72
+ rescue LDAP::Error => ex
73
+ @logger.error("Ldap connect failed: #{ex}\n#{ex.backtrace}")
74
+ exit
75
+ rescue LDAP::ResultError => ex
76
+ @logger.error("LDAP search error: #{ex}\n#{ex.backtrace}")
77
+ exit
75
78
  end
76
- finished
79
+ # no finished in 2.1, instead stop method is called
80
+ # finished
77
81
  end # def run
78
82
 
79
83
  end # class LogStash::Inputs::LDAPSearch
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-LDAPSearch'
4
- s.version = '0.1.0'
4
+ s.version = '0.1.4'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "logstash input plugin to perform search into ldap."
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')
14
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency "logstash-core", '>= 2.0.0', '< 3.0.0'
24
24
 
25
25
  s.add_runtime_dependency 'jruby-ldap'
26
26
  #s.add_runtime_dependency 'ruby_base64'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-LDAPSearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas CAN
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2016-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core
@@ -16,18 +16,18 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.0
19
+ version: 2.0.0
20
20
  - - <
21
21
  - !ruby/object:Gem::Version
22
- version: 2.0.0
22
+ version: 3.0.0
23
23
  requirement: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 1.4.0
27
+ version: 2.0.0
28
28
  - - <
29
29
  - !ruby/object:Gem::Version
30
- version: 2.0.0
30
+ version: 3.0.0
31
31
  prerelease: false
32
32
  type: :runtime
33
33
  - !ruby/object:Gem::Dependency
@@ -64,12 +64,10 @@ executables: []
64
64
  extensions: []
65
65
  extra_rdoc_files: []
66
66
  files:
67
- - .gitignore
68
67
  - DEVELOPER.md
69
68
  - Gemfile
70
69
  - LICENSE
71
70
  - README.md
72
- - Rakefile
73
71
  - lib/logstash/inputs/LDAPSearch.rb
74
72
  - logstash-input-LDAPSearch.gemspec
75
73
  - spec/inputs/LDAPSearch_spec.rb
data/.gitignore DELETED
@@ -1,35 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /test/tmp/
9
- /test/version_tmp/
10
- /tmp/
11
-
12
- ## Specific to RubyMotion:
13
- .dat*
14
- .repl_history
15
- build/
16
-
17
- ## Documentation cache and generated files:
18
- /.yardoc/
19
- /_yardoc/
20
- /doc/
21
- /rdoc/
22
-
23
- ## Environment normalisation:
24
- /.bundle/
25
- /vendor/bundle
26
- /lib/bundler/man/
27
-
28
- # for a library or gem, you might want to ignore these files since the code is
29
- # intended to run in multiple environments; otherwise, check them in:
30
- # Gemfile.lock
31
- # .ruby-version
32
- # .ruby-gemset
33
-
34
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
- .rvmrc
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "logstash/devutils/rake"