Skip to content

Commit

Permalink
Remove connection pool patch
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Nov 19, 2024
1 parent 2177fda commit d5cb723
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
33 changes: 33 additions & 0 deletions foo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Usage:
# terraform output | ruby foo.rb "TEST_SUBDOMAIN"

require 'json'
require 'yaml'

terraform_output = JSON.parse(STDIN.read, symbolize_names: true)
lab_cucumber_targets = terraform_output[:lab_cucumber_targets][:value]
test_subdomain = ARGV[0]

# Names from: https://github.com/rapid7/pro/blob/4cb5d12469405b124c0ce3d1f818e95b20ddac3d/ui/features/support/aws_lab_config.yml#L6
templates = [
{ alias: 'winm3', search_prefix: 'metasploitable3-win2k8-' },
{ alias: 'linm3', search_prefix: 'metasploitable3-ub1404-' },
{ alias: 'windows_server_2022_domain_controller', search_prefix: 'mspro-test-active_directory-w22std' },
]
result = templates.each_with_object({}) do |template, acc|
lab_cucumber_target = lab_cucumber_targets.find do |lab_target_name, config|
lab_target_name.start_with?(template[:search_prefix])
end
raise "Did not find matching cucumber lab target #{template}" unless lab_cucumber_target
name, config = lab_cucumber_target

acc[template[:alias]] = {
template: name,
name: "#{name}.#{test_subdomain}",
path: "#{name}.#{test_subdomain}",
instance_id: config[:instance_id],
private_ip: config[:private_ip]
}
end

puts result.to_yaml
10 changes: 0 additions & 10 deletions lib/msf/core/thread_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ def spawn(name, crit, *args, &block)
error: e
)
raise e
ensure
if framework.db && framework.db.active && framework.db.is_local?
# NOTE: despite the Deprecation Warning's advice, this should *NOT*
# be ApplicationRecord.connection.close which causes unrelated
# threads to raise ActiveRecord::StatementInvalid exceptions at
# some point in the future, presumably due to the pool manager
# believing that the connection is still usable and handing it out
# to another thread.
::ApplicationRecord.connection_pool.release_connection
end
end
end
else
Expand Down

0 comments on commit d5cb723

Please sign in to comment.