Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC for Kerberos on Windows with SSPI, take 2 #25

Merged
merged 2 commits into from
Sep 29, 2014
Merged

POC for Kerberos on Windows with SSPI, take 2 #25

merged 2 commits into from
Sep 29, 2014

Conversation

vkarpov15
Copy link
Contributor

Unfortunately can't change branches on a Github PR AFAIK, for the sake of sanity this is #20 against the v2-dev branch

@niemeyer
Copy link
Contributor

There are comments in #20 that were not addressed. Even some of the ones marked as "Done".

@vkarpov15
Copy link
Contributor Author

Yeah I hadn't pushed them yet, sorry. Subsequent commit contains them. I just wanted to open up a new PR because I merged v2-dev into this branch and so the previous PR had a lot of noise.

@niemeyer
Copy link
Contributor

Okay, please let me know once this is actually ready for review.

@vkarpov15
Copy link
Contributor Author

Go ahead and review, I'm reasonably certain I've addressed all your comments.

@@ -2,6 +2,9 @@
//
// This package is not meant to be used by itself.
//

// +build linux darwin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// +build !windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@niemeyer
Copy link
Contributor

Ok, just did a quick scan with a few comments, but I'll need to go back to it later.

Meanwhile, where are the tests?

@vkarpov15
Copy link
Contributor Author

Thanks for comments, I'll fix them in a bit. Re: tests, working on that, that will require moving kerb tests to a separate suite for now. My current testing setup overwrites existing tests and so isn't mergable.

@vkarpov15
Copy link
Contributor Author

Hey Gustavo, just a gentle reminder to see if you have any more comments.

@niemeyer
Copy link
Contributor

I might, but where are the tests?

@vkarpov15
Copy link
Contributor Author

In a separate branch and ready to merge into this one. Do you want them in
this branch? There's some significant work there to break Kerberos tests
off into their own suite so they don't go through the normal setup and
teardown.

On Mon, Sep 22, 2014 at 12:30 PM, Gustavo Niemeyer <[email protected]

wrote:

I might, but where are the tests?


Reply to this email directly or view it on GitHub
#25 (comment).

@niemeyer
Copy link
Contributor

I don't understand what kind of significant work might take place for that. Registering a new test suite requires three or four lines of code.

Either way, it doesn't make sense to merge this without tests. Please also make sure that the tests that are being submitted with the logic actually exercise it well, and are passing for real.

@niemeyer
Copy link
Contributor

Also, what do you mean by "break Kerberos tests"? The test that exists today are trivial in their implementation and design. We shouldn't be breaking them out or removing them from where they are.

@niemeyer
Copy link
Contributor

It might be best to submit that new logic you're talking about in a separate branch before polluting this PR, actually, so I can at least have an idea about what's being done.

@vkarpov15
Copy link
Contributor Author

See here for diff. The general idea is:

  1. have a separate test suite, RemoteSuite, for tests that don't require a local mongod setup. With this, the Kerberos tests no longer have to use the Setup() and TearDown, so the tests can run on Windows.
  2. I switched to using the official drivers Kerberos testing host instead of the mms one, because its the standard practice, and SSPI doesn't really do keytabs as far as I know.
  3. Because SSPI requires you to acquire your kerberos ticket in-process, I added an environment variable for setting the password that gets passed to SSPI

@niemeyer
Copy link
Contributor

Okay, that looks reasonable, but let's name it what it is: KerberosSuite, and have the suite defined right above kerberosFlag instead of having a new file for it. We can reorganize it after it lands if necessary.

If that's what it is, we can merge it in this PR so you can make sure tests pass before we merge this.

@vkarpov15
Copy link
Contributor Author

Ok I merged in the test suite. Here's a screen cap of the windows tests passing:

image

@niemeyer
Copy link
Contributor

Thanks! Can you please run the tests on Linux as well, to make sure we're still good there after the changes?

@vkarpov15
Copy link
Contributor Author

Tests now pass on ubuntu 12.04 as well:

image

@vkarpov15
Copy link
Contributor Author

Hey Gustavo, just a ping for any more comments

@niemeyer niemeyer merged commit 10ffa59 into go-mgo:v2-dev Sep 29, 2014
@vkarpov15 vkarpov15 mentioned this pull request Sep 29, 2014
bachue pushed a commit to bachue/mgo that referenced this pull request Dec 20, 2017
* add DropAllIndexes() method (go-mgo#25)

Create a new method to drop all the indexes of a collection
in a single call

* readme: credit @feliixx for go-mgo#25 (#26)

* send metadata during handshake (#28)

fix [#484](https://github.com/go-mgo/mgo/issues/484)

Annotate connections with metadata provided by the
connecting client.

informations send:

{
 "aplication": {         // optional
   "name": "myAppName"
 }
 "driver": {
    "name": "mgo",
    "version": "v2"
  },
  "os": {
    "type": runtime.GOOS,
    "architecture": runtime.GOARCH
  }
}

to set "application.name", add `appname` param in options
of string connection URI,
for example : "mongodb://localhost:27017?appname=myAppName"

* Update README to add appName (go-mgo#32)

* docs: elaborate on what appName does

* readme: add appName to changes

* add method CreateView() (go-mgo#33)

Fix go-mgo#30.

Thanks to @feliixx for the time and effort.

* readme: credit @feliixx in the README (go-mgo#36)

* Don't panic on indexed int64 fields (#23)

* Stop all db instances after tests (go-mgo#462)

If all tests pass, the builds for mongo earlier than 2.6 are still failing.
Running a clean up fixes the issue.

* fixing int64 type failing when getting indexes and trying to type them

* requested changes relating to case statement and panic

* Update README.md to credit @mapete94.

* tests: ensure indexed int64 fields do not cause a panic in Indexes()

See:
* globalsign#23
* https://github.com/go-mgo/mgo/issues/475
* go-mgo#476

* Add collation option to collection.Create() (go-mgo#37)

- Allow specifying the default collation for the collection when creating it.
- Add some documentation to query.Collation() method.

fix go-mgo#29

* Test against MongoDB 3.4.x (go-mgo#35)

* test against MongoDB 3.4.x

* tests: use listIndexes to assert index state for 3.4+

* make test pass against v3.4.x

  - skip `TestViewWithCollation` because of SERVER-31049,
    cf: https://jira.mongodb.org/browse/SERVER-31049

  - add versionAtLeast() method in init.js script to better
    detect server version

fixes go-mgo#31

* Introduce constants for BSON element types (go-mgo#41)

* bson.Unmarshal returns time in UTC (go-mgo#42)

* readme: add missing features / credit

* Adds missing collation feature description (by @feliixx).
* Adds missing 3.4 tests description (by @feliixx).
* Adds BSON constants description (by @bozaro).
* Adds UTC time.Time unmarshalling (by @gazoon).

* fix golint, go vet and gofmt warnings (#44)

Fixes #43

* readme: credit @feliixx (#46)

* Fix GetBSON() method usage (go-mgo#40)

* Fix GetBSON() method usage

Original issue
---

You can't use type with custom GetBSON() method mixed with structure field type and structure field reference type.

For example, you can't create custom GetBSON() for Bar type:

```
struct Foo {
	a  Bar
	b *Bar
}
```

Type implementation (`func (t Bar) GetBSON()` ) would crash on `Foo.b = nil` value encoding.

Reference implementation (`func (t *Bar) GetBSON()` ) would not call on `Foo.a` value encoding.

After this change
---

For type implementation  `func (t Bar) GetBSON()` would not call on `Foo.b = nil` value encoding.
In this case `nil` value would be seariazied as `nil` BSON value.

For reference implementation `func (t *Bar) GetBSON()` would call even on `Foo.a` value encoding.

* Minor refactoring

* readme: credit @bozaro (#47)
bachue pushed a commit to bachue/mgo that referenced this pull request Dec 20, 2017
* add DropAllIndexes() method (go-mgo#25)

Create a new method to drop all the indexes of a collection
in a single call

* readme: credit @feliixx for go-mgo#25 (#26)

* send metadata during handshake (#28)

fix [#484](https://github.com/go-mgo/mgo/issues/484)

Annotate connections with metadata provided by the
connecting client.

informations send:

{
 "aplication": {         // optional
   "name": "myAppName"
 }
 "driver": {
    "name": "mgo",
    "version": "v2"
  },
  "os": {
    "type": runtime.GOOS,
    "architecture": runtime.GOARCH
  }
}

to set "application.name", add `appname` param in options
of string connection URI,
for example : "mongodb://localhost:27017?appname=myAppName"

* Update README to add appName (go-mgo#32)

* docs: elaborate on what appName does

* readme: add appName to changes

* add method CreateView() (go-mgo#33)

Fix go-mgo#30.

Thanks to @feliixx for the time and effort.

* readme: credit @feliixx in the README (go-mgo#36)

* Don't panic on indexed int64 fields (#23)

* Stop all db instances after tests (go-mgo#462)

If all tests pass, the builds for mongo earlier than 2.6 are still failing.
Running a clean up fixes the issue.

* fixing int64 type failing when getting indexes and trying to type them

* requested changes relating to case statement and panic

* Update README.md to credit @mapete94.

* tests: ensure indexed int64 fields do not cause a panic in Indexes()

See:
* globalsign#23
* https://github.com/go-mgo/mgo/issues/475
* go-mgo#476

* Add collation option to collection.Create() (go-mgo#37)

- Allow specifying the default collation for the collection when creating it.
- Add some documentation to query.Collation() method.

fix go-mgo#29

* Test against MongoDB 3.4.x (go-mgo#35)

* test against MongoDB 3.4.x

* tests: use listIndexes to assert index state for 3.4+

* make test pass against v3.4.x

  - skip `TestViewWithCollation` because of SERVER-31049,
    cf: https://jira.mongodb.org/browse/SERVER-31049

  - add versionAtLeast() method in init.js script to better
    detect server version

fixes go-mgo#31

* Introduce constants for BSON element types (go-mgo#41)

* bson.Unmarshal returns time in UTC (go-mgo#42)

* readme: add missing features / credit

* Adds missing collation feature description (by @feliixx).
* Adds missing 3.4 tests description (by @feliixx).
* Adds BSON constants description (by @bozaro).
* Adds UTC time.Time unmarshalling (by @gazoon).

* fix golint, go vet and gofmt warnings (#44)

Fixes #43

* readme: credit @feliixx (#46)

* Fix GetBSON() method usage (go-mgo#40)

* Fix GetBSON() method usage

Original issue
---

You can't use type with custom GetBSON() method mixed with structure field type and structure field reference type.

For example, you can't create custom GetBSON() for Bar type:

```
struct Foo {
	a  Bar
	b *Bar
}
```

Type implementation (`func (t Bar) GetBSON()` ) would crash on `Foo.b = nil` value encoding.

Reference implementation (`func (t *Bar) GetBSON()` ) would not call on `Foo.a` value encoding.

After this change
---

For type implementation  `func (t Bar) GetBSON()` would not call on `Foo.b = nil` value encoding.
In this case `nil` value would be seariazied as `nil` BSON value.

For reference implementation `func (t *Bar) GetBSON()` would call even on `Foo.a` value encoding.

* Minor refactoring

* readme: credit @bozaro (#47)

* Improve cursorData struct unmarshaling speed (#49)

This change remove full BSON decoding on:

 - parsing to `bson.Raw` and `bson.DocElem` fields;
 - skipping unused BSON fields.

* readme: credit @bozaro and @idy (go-mgo#53)

* readme: credit @bozaro and @idy

* readme: add @idy to contributor list

* do not lock while writing to a socket (#52) (#54)

fix go-mgo#51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants