net-ldap-auth_adapter-gssapi 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a594bccd6602780aeef1a3f55886872355ff51c1
4
+ data.tar.gz: a91b436547ba5ddfbc4b33b4c679b511fcad251a
5
+ SHA512:
6
+ metadata.gz: 7680d4e1a292a87614d76102610be4a58815670bf09fe800b0124cc3fd5ee2e3af4bb3023a013d74aaf84408bc2eac8820788eea11c1d24b5faaac818a8f606e
7
+ data.tar.gz: a430adba13d78d7f30d324a884534a7580ebdde144ff29be34767bdeb00cc14903dd3429175060cb3569d8a5b76982c6dd1765386c0a286187b96645ed5b9219
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in net-ldap-auth_adapter-gssapi.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2018 Smartling, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # Net::LDAP::AuthAdapter::GSSAPI
2
+
3
+ This gem can be used with the net-ldap gem to perform GSSAPI authentication (which almost always means Kerberos authentication).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'net-ldap-auth_adapter-gssapi'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install net-ldap-auth_adapter-gssapi
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ require 'net/ldap/auth_adapter/gssapi'
25
+
26
+ ldap = Net::LDAP.new(auth: {method: :gssapi, hostname: "ldap.example.com"})
27
+ ```
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/syskill/ruby-net-ldap-gssapi/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "net/ldap/auth_adapter/gssapi"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ require 'net/ldap/auth_adapter/gssapi'
@@ -0,0 +1,57 @@
1
+ require 'gssapi'
2
+ require 'net/ldap'
3
+
4
+ module Net
5
+ class LDAP
6
+ class GSSAPIError < Error; end
7
+
8
+ class AuthAdapter
9
+ class GSSAPI < Net::LDAP::AuthAdapter
10
+ #--
11
+ # Required parameters: :hostname
12
+ # Optional parameters: :servicename
13
+ #
14
+ # Hostname must be a fully-qualified domain name.
15
+ #
16
+ # Service name defaults to "ldap", which is almost certainly what you want.
17
+ #++
18
+ def bind(auth)
19
+ host, svc = [auth[:hostname], auth[:servicename] || "ldap"]
20
+ raise Net::LDAP::BindingInformationInvalidError, "Invalid binding information" unless (host && svc)
21
+
22
+ gsscli = ::GSSAPI::Simple.new(host, svc)
23
+ context_established = nil
24
+ challenge_response = proc do |challenge|
25
+ if !context_established
26
+ resp = gsscli.init_context(challenge)
27
+ if resp.equal?(true)
28
+ context_established = true
29
+ elsif !resp || resp.empty?
30
+ raise Net::LDAP::GSSAPIError, "Failed to establish GSSAPI security context"
31
+ end
32
+ resp
33
+ else
34
+ # After the security context has been established, the LDAP server will
35
+ # offer to negotiate the security strength factor (SSF) and maximum
36
+ # output size. We request an SSF of 0, i.e. no protection (integrity
37
+ # and confidentiality protections aren't implemented here, yet) and no
38
+ # size limit.
39
+ #
40
+ # N.b. your LDAP server may reject the bind request with an error
41
+ # message like "protocol violation: client requested invalid layer."
42
+ # That means that it is configured to require stronger protection.
43
+ gsscli.wrap_message("\x01\xff\xff\xff".force_encoding("binary"), false)
44
+ end
45
+ end
46
+
47
+ Net::LDAP::AuthAdapter::Sasl.new(@connection).
48
+ bind(method: :sasl, mechanism: "GSSAPI",
49
+ initial_credential: gsscli.init_context,
50
+ challenge_response: challenge_response)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ Net::LDAP::AuthAdapter.register(:gssapi, Net::LDAP::AuthAdapter::GSSAPI)
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "net-ldap-auth_adapter-gssapi"
7
+ spec.version = "0.2.0"
8
+ spec.authors = ["Ben Slusky"]
9
+ spec.email = ["bslusky@smartling.com"]
10
+
11
+ spec.summary = %q{Adapter for GSSAPI authentication in net-ldap gem}
12
+ spec.description = %q{This gem can be used with the net-ldap gem to perform GSSAPI authentication (which almost always means Kerberos authentication).}
13
+ spec.homepage = "https://github.com/syskill/ruby-net-ldap-gssapi"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "gssapi"
22
+ spec.add_runtime_dependency "net-ldap", "~> 0.16"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.9"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: net-ldap-auth_adapter-gssapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Slusky
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gssapi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: net-ldap
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.16'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: This gem can be used with the net-ldap gem to perform GSSAPI authentication
70
+ (which almost always means Kerberos authentication).
71
+ email:
72
+ - bslusky@smartling.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - lib/net-ldap-auth_adapter-gssapi.rb
86
+ - lib/net/ldap/auth_adapter/gssapi.rb
87
+ - net-ldap-auth_adapter-gssapi.gemspec
88
+ homepage: https://github.com/syskill/ruby-net-ldap-gssapi
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.6.14.1
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Adapter for GSSAPI authentication in net-ldap gem
112
+ test_files: []