Skip to content

Commit 501448c

Browse files
committed
Merge pull request #477 from Mayflower/master
handle mysql compiled without ssl
2 parents 3fa4154 + 5c8d97f commit 501448c

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

manifests/params.pp

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
'ssl-ca' => $mysql::params::ssl_ca,
213213
'ssl-cert' => $mysql::params::ssl_cert,
214214
'ssl-key' => $mysql::params::ssl_key,
215+
'ssl-disable' => false,
215216
'thread_cache_size' => '8',
216217
'thread_stack' => '256K',
217218
'tmpdir' => $mysql::params::tmpdir,

manifests/server/config.pp

+6
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
mode => '0644',
2828
}
2929
}
30+
31+
if $options['mysqld']['ssl-disable'] {
32+
notify {'ssl-disable':
33+
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'
34+
}
35+
}
3036
}

spec/classes/mysql_server_spec.rb

+9
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@
5656
it { should contain_class('mysql::server::account_security') }
5757
end
5858

59+
describe 'possibility of disabling ssl completely' do
60+
let(:params) {
61+
{ :override_options => { 'mysqld' => { 'ssl' => true, 'ssl-disable' => true } }}
62+
}
63+
it do
64+
should contain_file('/etc/my.cnf').without_content(/^\s*ssl\s*(?:$|= true)/m)
65+
end
66+
end
67+
5968
context 'mysql::server::install' do
6069
let(:params) {{ :package_ensure => 'present', :name => 'mysql-server' }}
6170
it do

templates/my.cnf.erb

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<% if v.is_a?(Hash) -%>
33
[<%= k %>]
44
<% v.sort.map do |ki, vi| -%>
5-
<% if vi == true or v == '' -%>
5+
<% if ki =~ /^ssl/ and v['ssl-disable'] == true -%>
6+
<% next %>
7+
<% elsif vi == true or v == '' -%>
68
<%= ki %>
79
<% elsif vi.is_a?(Array) -%>
810
<% vi.each do |vii| -%>

0 commit comments

Comments
 (0)