msfdb does not pull user specific port
rwincey opened this issue · comments
When running in a multi-user environment, the msfdb script uses the hardcoded port value in the msfdb script rather than the one that is defined in the users database.yml and db/postgresql.conf. This means after reboot, the msfdb will not correctly start the postgres server. Suggested fix: If the database.yml file exists, read the postgres port from the file and try to start the server using it rather than using the default port in the msfdb script.
I can't seem to find the source for the msfdb script in this repo or I'd attempt to make the change. Here's the snippet I added to the start_db func below the check for the database dir. The spacing appears to be getting f-ed.
def start_db
if !Dir.exist?(@db)
puts "No database found at #{@db}, not starting"
return
end
#--------------------- Check for database config ---------------------------------
if File.exist?(@dbconf)
File.readlines("#{@dbconf}").each do |line|
arr = line.split(":")
key = arr.first.strip
val = arr.last.strip
if key == "port"
@dbport = val
end
end
end
Will take a look, thanks.
If you want formatting to stay the same, surround in triple backticks
Like this
I went ahead and fixed up your description.
I added a commit to another PR that fixes this: