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

Issue #223: Generate a random default root password #465

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

colans
Copy link

@colans colans commented Oct 7, 2021

Instead of hard-coding an insecure default password for the root MySQL user, generate a random one as discussed in issue #223.

This is more complicated than simply adding a random password to the defaults file because that'll change every time the variable is read. Instead, I generate a random password and place it into /root/.my.cnf (or wherever) unless there already is one, fetch it from there, and then use it to set the actual root password in the DB. But this only happens if the configuration file has changed. Otherwise, they'd be out of sync.

colans and others added 3 commits October 7, 2021 11:10
Instead of hardcoding an insecure default password for the `root` mysql user, generate a random one as discussed in issue geerlingguy#223 .
mysql_root_cnf_path: "{{ mysql_root_home }}/.my.cnf"

- name: Copy .my.cnf file with root password credentials.
template:
Copy link
Owner

Choose a reason for hiding this comment

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

In terms of backwards compatibility, could this break that for existing installs?

Copy link
Author

Choose a reason for hiding this comment

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

What I think you're mostly concerned about here, and rightly so, is if there's a password already there (for example, the old default one). I tested that by changing it (and leaving the rest of the file alone). Both <5.7 and 5.7+ were skipped so we're all good there. force: no is the default so I think we're good. If the file's already there, it won't touch it. It'll just use what's there for running operations, which will just work.

defaults/main.yml Outdated Show resolved Hide resolved
defaults/main.yml Outdated Show resolved Hide resolved
@colans
Copy link
Author

colans commented Oct 8, 2021

I can't figure out how to turn this comment in to a new "conversation" or start my own review (as I'm more familiar with GitLab) so please convert if you can...

That test result is failing for MySQL < 5.7. I'm less concerned about that because support for that ended in February. Is there a way we could skip that one (for the time being, at least), and see how it works for 5.7+? I'm actually testing this myself on v8, and not having any problems (Ubuntu 20.04).

@stale
Copy link

stale bot commented Jan 8, 2022

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark pull requests as stale.

@stale stale bot added the stale label Jan 8, 2022
@colans
Copy link
Author

colans commented Jan 10, 2022

@geerlingguy I believe that this is ready to be merged. Or do you have any additional concerns?

@stale
Copy link

stale bot commented Jan 10, 2022

This issue is no longer marked for closure.

@stale stale bot removed the stale label Jan 10, 2022
@stale
Copy link

stale bot commented Apr 14, 2022

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark pull requests as stale.

@stale stale bot added the stale label Apr 14, 2022
@colans
Copy link
Author

colans commented Apr 14, 2022

👋

@stale
Copy link

stale bot commented Apr 14, 2022

This issue is no longer marked for closure.

@stale stale bot removed the stale label Apr 14, 2022
@stale
Copy link

stale bot commented Jul 14, 2022

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark pull requests as stale.

@stale stale bot added the stale label Jul 14, 2022
@colans
Copy link
Author

colans commented Jul 14, 2022

👋

@stale
Copy link

stale bot commented Jul 14, 2022

This issue is no longer marked for closure.

@stale stale bot removed the stale label Jul 14, 2022
@geerlingguy
Copy link
Owner

Stale bot stay away!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants