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

Require SSL connection to database if MariaDB SSL is configured #1289

Merged
merged 4 commits into from
Nov 7, 2017

Conversation

jsuchome
Copy link
Member

@jsuchome jsuchome commented Sep 20, 2017

With this settings, non-SSL access is forbidden for the affected
users.

This is based on @s-t-e-v-e-n-k patch.

NOTE:

nicolasbock
nicolasbock previously approved these changes Sep 20, 2017
if new_resource.connection[:ssl][:insecure]
client_options[:sslverify] = false
else
client_options[:sslca] = new_resource.connection[:ssl][:ca_certs]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you explicitly need to set client_options[:sslverify] = true at least the mysqlclient docs mention that it is off by default. (I didn't try that though)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, true indeed

rhafer
rhafer previously approved these changes Sep 21, 2017
Copy link
Contributor

@rhafer rhafer left a comment

Choose a reason for hiding this comment

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

The change itself looks good now. But we can't merge it before we have feedback on the ruby-mysql2 patch referenced above. Or we need to rework the code to disable ssl for the ruby part when certificate verification is not possible.

rhafer
rhafer previously approved these changes Sep 21, 2017
Copy link
Contributor

@rhafer rhafer left a comment

Choose a reason for hiding this comment

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

Looks good. Though the comments from the previous review still apply.

rsalevsky
rsalevsky previously approved these changes Sep 21, 2017
@jsuchome
Copy link
Member Author

Rebased (no code change)

rsalevsky
rsalevsky previously approved these changes Sep 22, 2017
Copy link
Contributor

@rhafer rhafer left a comment

Choose a reason for hiding this comment

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

This seems to be missing keystone at least.

rhafer
rhafer previously requested changes Sep 22, 2017
Copy link
Contributor

@rhafer rhafer left a comment

Choose a reason for hiding this comment

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

This seems to be missing keystone at least.

@jsuchome
Copy link
Member Author

This seems to be missing keystone at least.

Added

@jsuchome
Copy link
Member Author

@rhafer as your patch is currently living in build service, this PR could be merged actually.

@jsuchome jsuchome requested a review from rsalevsky September 25, 2017 16:09
@jsuchome
Copy link
Member Author

jsuchome commented Oct 2, 2017

Current blocker is neutron behavior, see bug https://bugzilla.suse.com/show_bug.cgi?id=1060405

@rsalevsky
Copy link
Member

@jsuchome Would splitting the neutron part in a separate PR help unblocking this PR?

@@ -63,6 +63,8 @@
host "%"
privileges db_settings[:privs]
provider db_settings[:user_provider]
# FIXME: does not work now, see bsc#1060405
# require_ssl db_settings[:connection][:ssl][:enabled]

Choose a reason for hiding this comment

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

Layout/CommentIndentation: Incorrect indentation detected (column 0 instead of 4).

@@ -63,6 +63,8 @@
host "%"
privileges db_settings[:privs]
provider db_settings[:user_provider]
# FIXME: does not work now, see bsc#1060405
# require_ssl db_settings[:connection][:ssl][:enabled]

Choose a reason for hiding this comment

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

Layout/CommentIndentation: Incorrect indentation detected (column 0 instead of 4).

@jsuchome
Copy link
Member Author

jsuchome commented Oct 2, 2017

@rsalevsky ok, I've removed neutron part in last commit ... but I'm not sure how severe the problem is, maybe we're gonna have to rework it again

@@ -333,6 +333,7 @@
only_if { !ha_enabled || CrowbarPacemakerHelper.is_cluster_founder?(node) }
end

database_ssl = db_settings[:connection][:ssl][:enabled] && !db_settings[:connection][:ssl][:insecure]

Choose a reason for hiding this comment

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

s-t-e-v-e-n-k
s-t-e-v-e-n-k previously approved these changes Nov 3, 2017
Copy link
Contributor

@s-t-e-v-e-n-k s-t-e-v-e-n-k left a comment

Choose a reason for hiding this comment

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

I am happy with these changes, on the proviso that the SSL CI job passes as well.

@@ -333,6 +333,7 @@
only_if { !ha_enabled || CrowbarPacemakerHelper.is_cluster_founder?(node) }
end

database_ssl = db_settings[:connection][:ssl][:enabled] && !db_settings[:connection][:ssl][:insecure]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment with an explanation why we're not enabling ssl for horizon in "insecure" mode.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -333,6 +333,9 @@
only_if { !ha_enabled || CrowbarPacemakerHelper.is_cluster_founder?(node) }
end

# We do not require SSL connectopn for horizon user in case of insecure DB setup,
# because horizon's django uses a library (MySQLdb) that does not support insecure connection.
database_ssl = db_settings[:connection][:ssl][:enabled] && !db_settings[:connection][:ssl][:insecure]

Choose a reason for hiding this comment

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

@@ -333,6 +333,9 @@
only_if { !ha_enabled || CrowbarPacemakerHelper.is_cluster_founder?(node) }
end

# We do not require SSL connectopn for horizon user in case of insecure DB setup,
# because horizon's django uses a library (MySQLdb) that does not support insecure connection.
database_ssl = db_settings[:connection][:ssl][:enabled] && !db_settings[:connection][:ssl][:insecure]

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind addressing this as well?

Also, do not require SSL connection for insecure setup.
It seems that MySQLdb library used by django is not able to start
SSL connection without proper certificate verification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants