Commit Graph

55 Commits

Author SHA1 Message Date
Calvin Leung Huang
dc186b63cc
CreateUser deadlock fix (#3761)
* Unlock the lock on CreateUser for Close call

* Let getConnection handle session reset, return c.session on Connection
2018-01-08 12:42:05 -05:00
Jeff Mitchell
8c4f369e50 Revert grabbing lock in database Connection funcs 2017-12-19 12:53:21 -05:00
Jeff Mitchell
7ef59df0b2 Add lock to sql connection as well 2017-12-19 10:38:26 -05:00
Jeff Mitchell
28e8fd1ca7 Add lock and close check on cassandra as well 2017-12-19 10:26:46 -05:00
Jeff Mitchell
3ba108f51e Ping the mongo session when the connection is retrieved.
This was in the deprecated backend where it fixed a similar issue a long
time ago but for some reason didn't make it over. Additionally the
function wasn't being locked properly.

Hopefully fixes #2973
2017-12-19 10:11:04 -05:00
Brian Kassouf
1eec51abff
plugins/database: use context with plugins that use database/sql package (#3691) 2017-12-15 10:26:17 -08:00
Brian Kassouf
a401cc7cb5
Database gRPC plugins (#3666)
* Start work on context aware backends

* Start work on moving the database plugins to gRPC in order to pass context

* Add context to builtin database plugins

* use byte slice instead of string

* Context all the things

* Move proto messages to the dbplugin package

* Add a grpc mechanism for running backend plugins

* Serve the GRPC plugin

* Add backwards compatibility to the database plugins

* Remove backend plugin changes

* Remove backend plugin changes

* Cleanup the transport implementations

* If grpc connection is in an unexpected state restart the plugin

* Fix tests

* Fix tests

* Remove context from the request object, replace it with context.TODO

* Add a test to verify netRPC plugins still work

* Remove unused mapstructure call

* Code review fixes

* Code review fixes

* Code review fixes
2017-12-14 14:03:11 -08:00
Calvin Leung Huang
a9e7dbb7b4
Support MongoDB session-wide write concern (#3646)
* Initial work on write concern support, set for the lifetime of the session

* Add base64 encoded value support, include docs and tests

* Handle error from json.Unmarshal, fix test and docs

* Remove writeConcern struct, move JSON unmarshal to Initialize

* Return error on empty mapping of write_concern into mgo.Safe struct
2017-12-05 15:31:01 -05:00
Jeff Mitchell
f6839fb9d6 Add some delay to postgres create user test to verify expiration isn't immediate 2017-11-30 09:35:47 -05:00
Brian Kassouf
98a644c21d
database/mysql: Allow the creation statement to use commands that are… (#3619)
* database/mysql: Allow the creation statement to use commands that are not yet supported by the prepare statement protocol

* Remove unnecessary else block
2017-11-28 10:19:49 -08:00
navinanandaraj
ece3c77e6f Change list users to list all for session validation (#3469) 2017-10-18 14:24:12 -04:00
Calvin Leung Huang
38be34423c Fix cassandra tests, explicitly set cluster port if provided (#3296)
* Fix cassandra tests, explicitly set cluster port if provided

* Update cassandra.yml test-fixture

* Add port as part of the config option, fix tests

* Remove hostport splitting in cassandraConnectionProducer.createSession

* Include port in API docs
2017-09-07 23:04:40 -04:00
Calvin Leung Huang
ced217e699 Fix flag parsing on database plugins, exit on parse error (#3305)
* Change FlagSet error handling to flag.ExitOnError

* Ignore os.Args[0] (the command itself) when parsing flags

* Revert to using flag.ContinueOnError
2017-09-07 16:30:00 -04:00
Jeff Mitchell
2748d9b31b Try reconnecting Mongo on EOF (#3269) 2017-08-31 16:50:26 -04:00
Brian Kassouf
1fd46cbcb1 Fix MySQL legacy username regression (#3141)
* Fix the mysql legacy username length

* Remove boolean parameter

* Add a MySQL 5.6 container to test the legacy MySQL plugin against

* Add database plugins to the make file

* Fix credsutil test
2017-08-10 18:28:18 -07:00
Calvin Leung Huang
7d55652927 credsutil: Include hyphen as part of reqStr (#3037) 2017-08-03 07:34:53 -04:00
Calvin Leung Huang
071e1e6999 Enforce alphanumeric requirement in RandomAlphaNumeric (#3010)
* Enforce alphanumeric requirement in RandomAlphaNumeric

* credsutil: Update comments and tests from feedback
2017-07-17 14:51:27 -04:00
Tony Cai
f92f4d4972 Added HANA database plugin (#2811)
* Added HANA dynamic secret backend

* Added acceptance tests for HANA secret backend

* Add HANA backend as a logical backend to server

* Added documentation to HANA secret backend

* Added vendored libraries

* Go fmt

* Migrate hana credential creation to plugin

* Removed deprecated hana logical backend

* Migrated documentation for HANA database plugin

* Updated HANA DB plugin to use role name in credential generation

* Update HANA plugin tests

* If env vars are not configured, tests will skip rather than succeed

* Fixed some improperly named string variables

* Removed unused import

* Import SAP hdb driver
2017-07-07 13:11:23 -07:00
Brian Kassouf
9dcea09951 Move database drivers from test files into the plugin files (#2986) 2017-07-07 10:38:12 -07:00
Graham Davison
322abf26f9 Moved drivers from plugins/helper/database/connutil/sql.go to driver test files (#2980) 2017-07-07 09:09:48 -04:00
Brian Kassouf
b9871fc9ad Use WeakDecode to decode the initialize values (#2871) 2017-06-14 18:59:27 -07:00
Brian Kassouf
abc900157b Use the role name in the db username (#2812) 2017-06-06 09:49:49 -04:00
Andrew Paulin
d004ad75db Support custom renewal statements in Postgres (#2788)
* Support custom renewal statements in Postgres

* Refactored out default/custom renew methods
2017-06-01 13:18:16 -07:00
Calvin Leung Huang
a4c652cbb3 Mongodb plugin (#2698)
* WIP on mongodb plugin

* Add mongodb plugin

* Add tests

* Update mongodb.CreateUser() comment

* Update docs

* Add missing docs

* Fix mongodb docs

* Minor comment and test updates

* Fix imports

* Fix dockertest import

* Set c.Initialized at the end, check for empty CreationStmts first on CreateUser

* Remove Initialized check on Connection()

* Add back Initialized check

* Update docs

* Move connProducer and credsProducer into pkg for  mongodb and cassandra

* Chage parseMongoURL to be a private func

* Default to admin if no db is provided in creation_statements

* Update comments and docs
2017-05-11 17:38:54 -04:00
Jeff Mitchell
2e567bd5e7 Only run cassandra tests on Travis for right now 2017-05-09 08:36:20 -04:00
Brian Kassouf
3fcf1ad442 Fix the TLS functionality in cassandra plugin 2017-05-03 15:36:49 -07:00
Brian Kassouf
3ca266b475 Fix parsing the connection duration when it's nil 2017-05-03 13:45:27 -07:00
Brian Kassouf
5b8ce92e12 Fix mysql plugin tests 2017-05-03 13:36:16 -07:00
Brian Kassouf
657826d274 Add the other mysql plugin types with the correct username length settings 2017-05-03 13:33:56 -07:00
Brian Kassouf
c381b0093c Use ParseDurationSecond to parse the timeouts in connutil 2017-05-03 13:11:30 -07:00
Brian Kassouf
f424a9ad79 Use log to output errors instead of fmt 2017-05-03 13:01:05 -07:00
Brian Kassouf
fe86f06daf Fix a few PR comments 2017-05-02 15:59:08 -07:00
Brian Kassouf
1df8ec9ef7 Update the api for serving plugins and provide a utility to pass TLS data for commuinicating with the vault process 2017-05-02 14:40:11 -07:00
Brian Kassouf
7f92c5f47f Fix documentation 2017-05-02 02:22:06 -07:00
Brian Kassouf
6ddfe9aa7f Rename NewPluginServer to just Serve 2017-05-02 02:00:39 -07:00
Brian Kassouf
d68f2837f6 Prepend a 'v-' to the sql username strings 2017-05-01 15:45:17 -07:00
Brian Kassouf
66630f642d Add test for custiom mssql revoke statement 2017-05-01 15:43:21 -07:00
Calvin Leung Huang
f3e7ad7669 Honor statements for RevokeUser on Cassandra backend, add method comments 2017-05-01 11:27:35 -04:00
Brian Kassouf
445a0e339b Update the username length for postgresql 2017-04-27 23:02:33 -07:00
Brian Kassouf
6684e5c91d Update username length for MSSQL 2017-04-27 22:59:22 -07:00
Brian Kassouf
766b90976d If user provides a revocation statement for MSSQL plugin honor it 2017-04-27 22:56:06 -07:00
Calvin Leung Huang
47df4acdf1 Merge pull request #2632 from hashicorp/cassandra-plugin
Add cassandra plugin
2017-04-27 16:28:33 -04:00
Calvin Leung Huang
230a36c5a1 Update New() func signature and its references 2017-04-27 11:07:52 -04:00
Brian Kassouf
cb13786f0a Fix MSSQL test 2017-04-26 10:52:10 -07:00
Brian Kassouf
dc9740d97a Add mssql builtin plugin type 2017-04-26 10:34:45 -07:00
Brian Kassouf
f6b96ccfa2 s/DatabaseType/Database/ 2017-04-24 13:59:12 -07:00
Calvin Leung Huang
2faa08dfba Remove commented old method signature 2017-04-23 00:04:05 -04:00
Calvin Leung Huang
c5d5abef11 Add cassandra plugin 2017-04-23 09:02:57 +08:00
Brian Kassouf
9abc31ece7 Fix tests 2017-04-21 09:10:26 -07:00
Brian Kassouf
f1fa617e03 Calls to builtin plugins now go directly to the implementation instead of go-plugin 2017-04-20 18:46:41 -07:00