Skip to content

handle mysql compiled without ssl #477

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

Merged
merged 3 commits into from
Mar 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
'ssl-ca' => $mysql::params::ssl_ca,
'ssl-cert' => $mysql::params::ssl_cert,
'ssl-key' => $mysql::params::ssl_key,
'ssl-disable' => false,
'thread_cache_size' => '8',
'thread_stack' => '256K',
'tmpdir' => $mysql::params::tmpdir,
Expand Down
6 changes: 6 additions & 0 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@
mode => '0644',
}
}

if $options['mysqld']['ssl-disable'] {
notify {'ssl-disable':
message =>'Disabling SSL is evil! You should never ever do this except if you are forced to use a mysql version compiled without SSL support'
}
}
}
9 changes: 9 additions & 0 deletions spec/classes/mysql_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
it { should contain_class('mysql::server::account_security') }
end

describe 'possibility of disabling ssl completely' do
let(:params) {
{ :override_options => { 'mysqld' => { 'ssl' => true, 'ssl-disable' => true } }}
}
it do
should contain_file('/etc/my.cnf').without_content(/^\s*ssl\s*(?:$|= true)/m)
end
end

context 'mysql::server::install' do
let(:params) {{ :package_ensure => 'present', :name => 'mysql-server' }}
it do
Expand Down
4 changes: 3 additions & 1 deletion templates/my.cnf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<% if v.is_a?(Hash) -%>
[<%= k %>]
<% v.sort.map do |ki, vi| -%>
<% if vi == true or v == '' -%>
<% if ki =~ /^ssl/ and v['ssl-disable'] == true -%>
<% next %>
<% elsif vi == true or v == '' -%>
<%= ki %>
<% elsif vi.is_a?(Array) -%>
<% vi.each do |vii| -%>
Expand Down