-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
0.8.0 Mysql-Legacy not random... #3138
Comments
@briankassouf @calvn basically the combination of d68f283 and #2812 end up making user names too long for legacy mysql, which is limited to 16 characters. Probably for legacy mysql we're better off being mostly or purely random (perhaps just a v- in front). I think legacy mysql (and maybe rds) are the only dbs with such a low length limit although we should check. |
@jefferai we didn't run into a problem in 0.7.3 (in fact we've rolled back to 0.7.3) although that seems to be pure luck. Our eventual platform will be Amazon so we can't just upgrade mysql and cross our fingers. |
The username format changed since which caused this. For most purposes the legacy backend can be used instead for the moment with 0.8. I'm not sure when the next release will be but it might be as early as next week. Depending on that timing we also might provide a replacement plugin that is fixed that you can just tell the backend to use instead until the built in version is updated. |
This should be fixed with #3141, and we are planning a release for later next week that will include this fix. In the meantime we made it easy to build the legacy MySQL plugin as an external plugin and run it instead of the builtin version with this regression. Below I'll outline how to build and run the patched plugin, but wanted to note that if need be the vault team can provide a prebuilt binary, just reach out! To build and run an external MySQL plugin first the binary will need to be compiled and placed in the configured plugin directory (if you have not configured the plugin directory with vault, please do so now). As a prerequisite to building the plugin, go must be installed and your $GOPATH must be properly set. Additionally you will have to checkout the vault source code from git. Please see the compiling from source docs for more information on how to setup go and checkout vault's source. Also as a note, these commands work on macOS, on linux or windows the commands might need to be changed a bit. Once the environment is setup we can build the plugin: plugin_dir=<replace with configured plugin directory>
make mysql-legacy-database-plugin
cp bin/mysql-legacy-database-plugin $plugin_dir
sha256=$(shasum -a 256 $plugin_dir/mysql-legacy-database-plugin | awk '{print $1}') We now have a compiled binary in our plugin directory and it's SHA256 sum stored in an env variable. Next we will need to add the plugin to the plugin catalog. Writing to the plugin catalog requires a vault token with sudo permissions: vault write sys/plugins/catalog/mysql-legacy-database-plugin \
sha_256=$sha256 \
command=mysql-legacy-database-plugin We can verify the plugin is in the catalog and the builtin flag is set to false: $ vault read sys/plugins/catalog/mysql-legacy-database-plugin
Key Value
--- -----
args []
builtin false
command /Users/brian/vault-plugins/mysql-legacy-database-plugin
name mysql-legacy-database-plugin
sha256 5ZSvWao9ZXxrwKett85hhKOxK2s3RlzbiZKvOSGHeAE= Now that we have the plugin in the catalog we just need to reset the existing mysql connection and upon reset it will load the new external plugin. In the below command be sure to replace the path to the database connection with your mount location and connection name: vault write -f /database/reset/mysql That should restart the connection and load the new external plugin that was just registered to the plugin catalog. To undo this change (when the next vault release comes out) simply delete the entry from the plugin catalog and reset the plugin again: vault delete sys/plugins/catalog/mysql-legacy-database-plugin
vault write -f /database/reset/mysql And we can verify the plugin now has the builtin flag equal to true: $ vault read sys/plugins/catalog/mysql-legacy-database-plugin
Key Value
--- -----
args <nil>
builtin true
command
name mysql-legacy-database-plugin
sha256 <nil> |
this is awesome news |
Closing as this fix will be in the next version which will be out soon. |
Environment:
Startup Log Output:
Expected Behavior:
Username should be unique
Actual Behavior:
Plugin fails to generate unique credentials
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: