aws-samples / aws-secrets-manager-rotation-lambdas

Contains Lambda functions to be used for automatic rotation of secrets stored in AWS Secrets Manager
MIT No Attribution
329 stars 282 forks source link

MySQL MultiUser lambda cannot rotate users with host different than default '%' #101

Open ivan-georgiev opened 1 year ago

ivan-georgiev commented 1 year ago

MySQL MultiUser lambda assumes that user host is '%'. It is true if user is created as follows:

If user is created with custom host, rotation lambda will fail on "SHOW GRANTS FOR %s" query. Example how to create such user:

Possible solutions:

ivan-georgiev commented 1 year ago

This is example implementation of the third option mentioned in the issue: https://github.com/aws-samples/aws-secrets-manager-rotation-lambdas/pull/102

rstevens011 commented 1 year ago

Thank you for opening this issue - we are looking into it.

ivan-georgiev commented 1 year ago

Example implementation to cover single mysql.user.User value, multiple mysql.user.Host values and same password for all:

https://github.com/aws-samples/aws-secrets-manager-rotation-lambdas/pull/112