mongo_kerberos 2.0.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +1 -1
- data/README.md +18 -16
- data/Rakefile +20 -6
- data/ext/{mongo/kerberos → mongo_kerberos}/extconf.rb +1 -1
- data/ext/{mongo/kerberos/native.c → mongo_kerberos/mongo_kerberos_native.c} +22 -7
- data/lib/mongo/auth/kerberos/conversation.rb +1 -1
- data/lib/mongo/auth/kerberos/jruby/authenticator.rb +0 -1
- data/lib/mongo/auth/kerberos/mri/authenticator.rb +1 -1
- data/lib/mongo/auth/kerberos/version.rb +1 -1
- data/lib/mongo/auth/kerberos.rb +16 -3
- data/spec/mongo/auth/kerberos/conversation_spec.rb +11 -0
- data.tar.gz.sig +0 -0
- metadata +35 -34
- metadata.gz.sig +0 -0
- data/lib/mongo/auth/kerberos/jsasl.jar +0 -0
- data/lib/mongo/auth/kerberos/native.bundle +0 -0
- data/lib/mongo/auth/kerberos/native.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0e6ada2e4a0ddcaf0c1bb4c4a64ca232977bfaca7cd70116179d93dd48852975
|
4
|
+
data.tar.gz: ff2b0390d7937b433e0a8c2fed0f8823ec290b542f01b7c54bc7e2f241af5854
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b93ad2ab566e16181b640217af56ef0e9d865230250bd673b10191b518f613c4b6aad07654650ab721c0a6a9807ac7de92e94d6a7a73fe5577d211158c631e6
|
7
|
+
data.tar.gz: 13cb346db91f3a813a97c3612a5f43650db61993f6390128398c98942f7e6b709f1df178ef4e4bac181fa32f1474048fdc0c8c4408e7ad0a936a9ba74bec4c0e
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
��
|
1
|
+
Y:.=��1��ڌm����5�J�7W��{��}�&6���y.AO��K0cm;�[����,�Cvs����J�Sg�2���EuGZǮϙ��5��4��Jq��ll�n�v�S��c#��ά���O����V*ԏe���fo
|
data/README.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
|
-
Mongo Kerberos [![Build Status](https://secure.travis-ci.org/mongodb/mongo-ruby-kerberos.png?branch=master&.png)](http://travis-ci.org/mongodb/mongo-ruby-kerberos) [![Code Climate](https://codeclimate.com/github/mongodb/mongo-ruby-kerberos.png)](https://codeclimate.com/github/mongodb/mongo-ruby-kerberos) [![Coverage Status](https://coveralls.io/repos/mongodb/mongo-ruby-kerberos/badge.png?branch=master)](https://coveralls.io/r/mongodb/mongo-ruby-kerberos?branch=master)
|
2
|
-
====
|
1
|
+
# Mongo Kerberos [![Build Status](https://secure.travis-ci.org/mongodb/mongo-ruby-kerberos.png?branch=master&.png)](http://travis-ci.org/mongodb/mongo-ruby-kerberos) [![Code Climate](https://codeclimate.com/github/mongodb/mongo-ruby-kerberos.png)](https://codeclimate.com/github/mongodb/mongo-ruby-kerberos) [![Coverage Status](https://coveralls.io/repos/mongodb/mongo-ruby-kerberos/badge.png?branch=master)](https://coveralls.io/r/mongodb/mongo-ruby-kerberos?branch=master)
|
3
2
|
|
4
3
|
Provides Kerberos authentication support to the Mongo Ruby Driver.
|
5
4
|
|
6
|
-
Compatibility
|
7
|
-
-------------
|
8
5
|
|
9
|
-
|
6
|
+
## Compatibility
|
10
7
|
|
11
|
-
|
12
|
-
|
8
|
+
mongo_kerberos is tested against MRI (1.9.3+) and JRuby (9.1+).
|
9
|
+
|
10
|
+
### JRuby
|
11
|
+
|
12
|
+
In order to work with Kerberos TGTs that are in the system cache (e.g. obtained with `kinit`), the
|
13
|
+
JRuby extension sets the JVM system property "sun.security.jgss.native" to "true". Note that any
|
14
|
+
other use of the JGSS library will also be affected by this setting, meaning that any TGTs in the
|
15
|
+
system cache will be available for obtaining Kerberos credentials as well.
|
16
|
+
|
17
|
+
|
18
|
+
## Installation
|
13
19
|
|
14
20
|
libsasl is a requirement to be able to install the mongo_kerberos gem. Please see the
|
15
21
|
[Cyrus documentation](http://cyrusimap.web.cmu.edu/docs/cyrus-sasl/2.1.25/) for more
|
@@ -18,7 +24,7 @@ information.
|
|
18
24
|
With bundler, add the `mongo_kerberos` gem to your `Gemfile`.
|
19
25
|
|
20
26
|
```ruby
|
21
|
-
gem "mongo_kerberos", "~> 2.
|
27
|
+
gem "mongo_kerberos", "~> 2.1"
|
22
28
|
```
|
23
29
|
|
24
30
|
Require the `mongo_kerberos` gem in your application.
|
@@ -27,17 +33,13 @@ Require the `mongo_kerberos` gem in your application.
|
|
27
33
|
require "mongo_kerberos"
|
28
34
|
```
|
29
35
|
|
30
|
-
Usage
|
31
|
-
-----
|
32
|
-
|
33
36
|
|
34
|
-
API Documentation
|
35
|
-
-----------------
|
37
|
+
## API Documentation
|
36
38
|
|
37
39
|
The [API Documentation](http://rdoc.info/github/mongodb/mongo-ruby-kerberos/master/frames) is
|
38
40
|
located at rdoc.info.
|
39
41
|
|
40
|
-
Versioning
|
41
|
-
----------
|
42
|
+
## Versioning
|
42
43
|
|
43
|
-
As of 2.
|
44
|
+
As of 2.1.0, this project adheres to the
|
45
|
+
[Semantic Versioning Specification](http://semver.org/).
|
data/Rakefile
CHANGED
@@ -35,9 +35,9 @@ if jruby?
|
|
35
35
|
else
|
36
36
|
require "rake/extensiontask"
|
37
37
|
Rake::ExtensionTask.new do |ext|
|
38
|
-
ext.name = "
|
39
|
-
ext.ext_dir = "ext/
|
40
|
-
ext.lib_dir = "lib
|
38
|
+
ext.name = "mongo_kerberos_native"
|
39
|
+
ext.ext_dir = "ext/mongo_kerberos"
|
40
|
+
ext.lib_dir = "lib"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -62,9 +62,11 @@ end
|
|
62
62
|
task :clean_all => :clean do
|
63
63
|
begin
|
64
64
|
Dir.chdir(Pathname(__FILE__).dirname + "lib") do
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
["o", extension, "jar"].each do |e|
|
66
|
+
Dir.glob(File.join("**", "*.#{e}")).each do |f|
|
67
|
+
`rm #{f}`
|
68
|
+
end
|
69
|
+
end
|
68
70
|
end
|
69
71
|
rescue Exception => e
|
70
72
|
puts e.message
|
@@ -94,3 +96,15 @@ task :release => :build do
|
|
94
96
|
end
|
95
97
|
|
96
98
|
task :default => [ :clean_all, :spec ]
|
99
|
+
|
100
|
+
desc "Generate all documentation"
|
101
|
+
task :docs => 'docs:yard'
|
102
|
+
|
103
|
+
namespace :docs do
|
104
|
+
desc "Generate yard documention"
|
105
|
+
task :yard do
|
106
|
+
out = File.join('yard-docs', Mongo::Auth::Kerberos::VERSION)
|
107
|
+
FileUtils.rm_rf(out)
|
108
|
+
system "yardoc -o #{out} --title mongo-ruby-kerberos-#{Mongo::Auth::Kerberos::VERSION}"
|
109
|
+
end
|
110
|
+
end
|
@@ -18,8 +18,14 @@
|
|
18
18
|
|
19
19
|
static void mongo_sasl_conn_free(void* data) {
|
20
20
|
sasl_conn_t *conn = (sasl_conn_t*) data;
|
21
|
-
|
22
|
-
|
21
|
+
if (conn) {
|
22
|
+
sasl_dispose(&conn);
|
23
|
+
/* We do not set connection to NULL in the Ruby object. */
|
24
|
+
/* This is probably fine because this method is supposed to be called */
|
25
|
+
/* when the Ruby object is being garbage collected. */
|
26
|
+
/* Plus, we don't have the Ruby object reference here to do anything */
|
27
|
+
/* with it. */
|
28
|
+
}
|
23
29
|
}
|
24
30
|
|
25
31
|
static sasl_conn_t* mongo_sasl_context(VALUE self) {
|
@@ -104,7 +110,14 @@ static VALUE initialize_challenge(VALUE self) {
|
|
104
110
|
}
|
105
111
|
|
106
112
|
context = Data_Wrap_Struct(rb_cObject, NULL, mongo_sasl_conn_free, conn);
|
113
|
+
/* I'm guessing ruby raises on out of memory condition rather than */
|
114
|
+
/* returns NULL, hence no error checking is needed here? */
|
115
|
+
|
116
|
+
/* from now on context owns conn */
|
117
|
+
/* since mongo_sasl_conn_free cleans up conn, we should NOT call */
|
118
|
+
/* sasl_dispose any more in this function. */
|
107
119
|
rb_iv_set(self, "@context", context);
|
120
|
+
RB_GC_GUARD(context);
|
108
121
|
|
109
122
|
result = sasl_client_start(conn, mechanism_list, NULL, &raw_payload, &raw_payload_len, &mechanism_selected);
|
110
123
|
if (is_sasl_failure(result)) {
|
@@ -115,7 +128,9 @@ static VALUE initialize_challenge(VALUE self) {
|
|
115
128
|
return Qfalse;
|
116
129
|
}
|
117
130
|
|
118
|
-
|
131
|
+
/* cyrus-sasl considers `outmax` (fourth argument) to include the null */
|
132
|
+
/* terminator, but this is not documented. Be defensive and exclude it. */
|
133
|
+
result = sasl_encode64(raw_payload, raw_payload_len, encoded_payload, sizeof(encoded_payload)-1, &encoded_payload_len);
|
119
134
|
if (is_sasl_failure(result)) {
|
120
135
|
return Qfalse;
|
121
136
|
}
|
@@ -135,17 +150,17 @@ static VALUE evaluate_challenge(VALUE self, VALUE rb_payload) {
|
|
135
150
|
step_payload = RSTRING_PTR(rb_payload);
|
136
151
|
step_payload_len = (int)RSTRING_LEN(rb_payload);
|
137
152
|
|
138
|
-
result = sasl_decode64(step_payload, step_payload_len, base_payload, sizeof(base_payload), &base_payload_len);
|
153
|
+
result = sasl_decode64(step_payload, step_payload_len, base_payload, sizeof(base_payload)-1, &base_payload_len);
|
139
154
|
if (is_sasl_failure(result)) {
|
140
155
|
return Qfalse;
|
141
156
|
}
|
142
157
|
|
143
158
|
result = sasl_client_step(conn, base_payload, base_payload_len, NULL, &out, &outlen);
|
144
159
|
if (is_sasl_failure(result)) {
|
145
|
-
|
160
|
+
return Qfalse;
|
146
161
|
}
|
147
162
|
|
148
|
-
result = sasl_encode64(out, outlen, payload, sizeof(payload), &payload_len);
|
163
|
+
result = sasl_encode64(out, outlen, payload, sizeof(payload)-1, &payload_len);
|
149
164
|
if (is_sasl_failure(result)) {
|
150
165
|
return Qfalse;
|
151
166
|
}
|
@@ -155,7 +170,7 @@ static VALUE evaluate_challenge(VALUE self, VALUE rb_payload) {
|
|
155
170
|
|
156
171
|
VALUE c_GSSAPI_authenticator;
|
157
172
|
|
158
|
-
void
|
173
|
+
void Init_mongo_kerberos_native() {
|
159
174
|
VALUE mongo, auth;
|
160
175
|
mongo = rb_const_get(rb_cObject, rb_intern("Mongo"));
|
161
176
|
auth = rb_const_get(mongo, rb_intern("Auth"));
|
@@ -113,7 +113,7 @@ module Mongo
|
|
113
113
|
|
114
114
|
# Create the new conversation.
|
115
115
|
#
|
116
|
-
# @example Create the new
|
116
|
+
# @example Create the new conversation.
|
117
117
|
# Conversation.new(user, 'test.example.com')
|
118
118
|
#
|
119
119
|
# @param [ Auth::User ] user The user to converse about.
|
data/lib/mongo/auth/kerberos.rb
CHANGED
@@ -22,13 +22,24 @@ module Mongo
|
|
22
22
|
#
|
23
23
|
# @since 2.0.0
|
24
24
|
class Kerberos
|
25
|
-
include Executable
|
26
25
|
|
27
|
-
# The authentication
|
26
|
+
# The authentication mechanism string.
|
28
27
|
#
|
29
28
|
# @since 2.0.0
|
30
29
|
MECHANISM = 'GSSAPI'.freeze
|
31
30
|
|
31
|
+
# Instantiate a new authenticator.
|
32
|
+
#
|
33
|
+
# example Create the authenticator.
|
34
|
+
# Mongo::Auth::Kerberos.new(user)
|
35
|
+
#
|
36
|
+
# @param [ Mongo::Auth::User ] user The user to authenticate.
|
37
|
+
#
|
38
|
+
# @since 2.0.1
|
39
|
+
def initialize(user)
|
40
|
+
@user = user
|
41
|
+
end
|
42
|
+
|
32
43
|
# Log the user in on the given connection.
|
33
44
|
#
|
34
45
|
# @example Log the user in.
|
@@ -41,10 +52,12 @@ module Mongo
|
|
41
52
|
#
|
42
53
|
# @since 2.0.0
|
43
54
|
def login(connection)
|
44
|
-
conversation = Conversation.new(user, connection.address.host)
|
55
|
+
conversation = Conversation.new(@user, connection.address.host)
|
45
56
|
reply = connection.dispatch([ conversation.start ])
|
57
|
+
connection.update_cluster_time(Operation::Result.new(reply))
|
46
58
|
until reply.documents[0][Conversation::DONE]
|
47
59
|
reply = connection.dispatch([ conversation.finalize(reply) ])
|
60
|
+
connection.update_cluster_time(Operation::Result.new(reply))
|
48
61
|
end
|
49
62
|
reply
|
50
63
|
end
|
@@ -20,6 +20,17 @@ describe Mongo::Auth::Kerberos::Conversation do
|
|
20
20
|
and_return(authenticator)
|
21
21
|
end
|
22
22
|
|
23
|
+
context 'when the user has a realm', if: RUBY_PLATFORM == 'java' do
|
24
|
+
|
25
|
+
let(:user) do
|
26
|
+
Mongo::Auth::User.new(user: 'user1@MYREALM.ME')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'includes the realm in the username as it was provided' do
|
30
|
+
expect(conversation.user.name).to eq(user.name)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
23
34
|
describe '#start' do
|
24
35
|
|
25
36
|
let(:query) do
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,37 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_kerberos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emily Stolfo
|
8
8
|
- Durran Jordan
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
14
|
+
MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMREwDwYDVQQDDAhkYngt
|
15
|
+
cnVieTEXMBUGCgmSJomT8ixkARkWB21vbmdvZGIxEzARBgoJki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/Lj4U62XoALkdCI+OZ30+WrA8qiRLSL9ZEziVK9AV7ylez+sriQ
|
31
|
+
m8XKZKsCN5ON4+zXw1S+6Ftz/R4zDg7nTb9Wgw8ibzsoiP6e4pRW3Fls3ZdaG4pW
|
32
|
+
+qMTbae9OiSrgI2bxNTII+v+1FcbQjOlMu8HPZ3ZfXnurXPgN5GxSyyclZI1QONO
|
33
|
+
HbUoKHRirZu0F7JCvQQq4EkSuLWPplRJfYEeJIYm05zhhFeEyqea2B/TTlCtXa42
|
34
|
+
84vxXsxGzumuO8F2Q9m6/p95sNhqCp0B/SkKXIrRGJ7FBzupoORNRXHviS2OC3ty
|
35
|
+
4lwUzOlLTF/yO0wwYYfmtQOALQwKnW838vbYthMXvTjxB0EgVZ5PKto99WbjsXzy
|
36
|
+
wkeAWhd5b+5JS0zgDL4SvGB8/W2IY+y0zELkojBMgJPyrpAWHL/WSsSBMuhyI2Pv
|
37
|
+
xxaBVLklnJJ/qCCOZ3lG2MyVc/Nb0Mmq8ygWNsfwHmKKYuuWcviit0D0Tek=
|
33
38
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
39
|
+
date: 2023-06-12 00:00:00.000000000 Z
|
35
40
|
dependencies:
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: mongo
|
@@ -39,21 +44,21 @@ dependencies:
|
|
39
44
|
requirements:
|
40
45
|
- - "~>"
|
41
46
|
- !ruby/object:Gem::Version
|
42
|
-
version: 2.0
|
47
|
+
version: '2.0'
|
43
48
|
type: :runtime
|
44
49
|
prerelease: false
|
45
50
|
version_requirements: !ruby/object:Gem::Requirement
|
46
51
|
requirements:
|
47
52
|
- - "~>"
|
48
53
|
- !ruby/object:Gem::Version
|
49
|
-
version: 2.0
|
54
|
+
version: '2.0'
|
50
55
|
description: Adds Kerberos authentication via libsasl to the MongoDB Ruby Driver on
|
51
56
|
MRI and JRuby
|
52
57
|
email:
|
53
58
|
- mongodb-dev@googlegroups.com
|
54
59
|
executables: []
|
55
60
|
extensions:
|
56
|
-
- ext/
|
61
|
+
- ext/mongo_kerberos/extconf.rb
|
57
62
|
extra_rdoc_files: []
|
58
63
|
files:
|
59
64
|
- CONTRIBUTING.md
|
@@ -61,15 +66,12 @@ files:
|
|
61
66
|
- NOTICE
|
62
67
|
- README.md
|
63
68
|
- Rakefile
|
64
|
-
- ext/
|
65
|
-
- ext/
|
69
|
+
- ext/mongo_kerberos/extconf.rb
|
70
|
+
- ext/mongo_kerberos/mongo_kerberos_native.c
|
66
71
|
- lib/mongo/auth/kerberos.rb
|
67
72
|
- lib/mongo/auth/kerberos/conversation.rb
|
68
73
|
- lib/mongo/auth/kerberos/jruby/authenticator.rb
|
69
|
-
- lib/mongo/auth/kerberos/jsasl.jar
|
70
74
|
- lib/mongo/auth/kerberos/mri/authenticator.rb
|
71
|
-
- lib/mongo/auth/kerberos/native.bundle
|
72
|
-
- lib/mongo/auth/kerberos/native.jar
|
73
75
|
- lib/mongo/auth/kerberos/version.rb
|
74
76
|
- lib/mongo_kerberos.rb
|
75
77
|
- spec/mongo/auth/kerberos/conversation_spec.rb
|
@@ -79,7 +81,7 @@ homepage: http://www.mongodb.org
|
|
79
81
|
licenses:
|
80
82
|
- Apache License Version 2.0
|
81
83
|
metadata: {}
|
82
|
-
post_install_message:
|
84
|
+
post_install_message:
|
83
85
|
rdoc_options: []
|
84
86
|
require_paths:
|
85
87
|
- lib
|
@@ -94,9 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
96
|
- !ruby/object:Gem::Version
|
95
97
|
version: 1.3.6
|
96
98
|
requirements: []
|
97
|
-
|
98
|
-
|
99
|
-
signing_key:
|
99
|
+
rubygems_version: 3.4.12
|
100
|
+
signing_key:
|
100
101
|
specification_version: 4
|
101
102
|
summary: Kerberos authentication support for the MongoDB Ruby driver
|
102
103
|
test_files:
|
metadata.gz.sig
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|