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

WIP: Add mysql ssl connection #1054

Closed
wants to merge 6 commits into from
Closed
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
25 changes: 18 additions & 7 deletions lib/rmt/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,31 @@
File.join(__dir__, '../../config/rmt.local.yml')
)


module RMT::Config
class << self
def ssl_config(key = 'database')
{
'sslverify' => Settings[key].sslverify || true,
'sslkey' => Settings[key].sslkey || '',
'sslcert' => Settings[key].sslcert || '',
'sslca' => Settings[key].sslca || '',
'sslcapath' => Settings[key].sslcapath || '',
'sslcipher' => Settings[key].sslcipher || 'AES256-SHA',
'ssl_mode' => Settings[key].ssl_mode.try(:to_sym) || :disabled
}
end

def db_config(key = 'database')
{
'username' => Settings[key].username,
'password' => Settings[key].password,
'database' => Settings[key].database,
'host' => Settings[key].host || 'localhost',
'adapter' => Settings[key].adapter || 'mysql2',
'host' => Settings[key].host || 'localhost',
'adapter' => Settings[key].adapter || 'mysql2',
'encoding' => Settings[key].encoding || 'utf8',
'timeout' => Settings[key].timeout || 5000,
'pool' => Settings[key].pool || 5
}
'timeout' => Settings[key].timeout || 5000,
'pool' => Settings[key].pool || 5
}.deep_merge! ssl_config
end

# This method checks whether or not deduplication should be done by hardlinks.
Expand All @@ -47,7 +58,7 @@ def web_server
WebServerConfig.new(
max_threads: validate_int(Settings.try(:web_server).try(:max_threads)) || 5,
min_threads: validate_int(Settings.try(:web_server).try(:min_threads)) || 5,
workers: validate_int(Settings.try(:web_server).try(:workers)) || 2
workers: validate_int(Settings.try(:web_server).try(:workers)) || 2
)
end

Expand Down
8 changes: 8 additions & 0 deletions package/obs/rmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ database:
encoding: utf8
timeout: 5000
pool: 5
# set sslverify to true to use tls over ssl mysql connection
sslverify: false
sslkey: /some/path
sslcert: /some/path
sslca: /some/path
sslcapath: /some/path
sslcipher: /some/path


scc:
username:
Expand Down