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

Support spaces in user input for msfdb #15196

Merged
merged 1 commit into from
May 17, 2021

Conversation

dwelch-r7
Copy link
Contributor

@dwelch-r7 dwelch-r7 commented May 14, 2021

Previously having spaces in the path to framework install would result in errors running msfdb, this PR addresses that issue along with having spaces in options passed into the script

Example of current functionality, you can see when running reinit which metasploit in a folder with spaces in the name it fails to complete
image

and after:
image

Verification

  • ./msfdb delete --component=all # This is destructive if you have important data in your db do this in a VM
  • Create a folder with spaces in the name
  • place a copy of metasploit framework in there
  • ./msfdb reinit --component=all # Both components should start with no issues
  • Also try with --ssl-key-file and --ssl-cert-file options where they lie in a path with a space in it

@dwelch-r7 dwelch-r7 added the bug label May 17, 2021
@gwillcox-r7 gwillcox-r7 self-assigned this May 17, 2021
@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented May 17, 2021

Confirmed this works for the default setup and removes the need to do the workarounds mentioned in #12098 (comment) that I was having to do in order to get PostgreSQL to work on my Ubuntu 20.04 LTS machine.

Only downside is you do have to undo adding the PostgreSQL location to your path and setting the PGHOST environment variable from your workaround if you have already set these as part of your workaround efforts, but hey small tradeoff :)

@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented May 17, 2021

Alright after further conversation we did find another bug whereby if ~/.msf4/msf-ws-key.pem doesn't exist, then the reinit flag won't work as it checks to see if the file exists and fails if it doesn't. This is ironic cause the delete option will also delete this file when resetting the components so you would think that given this file is wiped during a reset that one wouldn't check it exists when resetting the database 😄

Otherwise though this PR works as expected and does what it is meant to do so I'm going to go ahead and land it in the meantime.

@gwillcox-r7 gwillcox-r7 merged commit ddd609f into rapid7:master May 17, 2021
@gwillcox-r7 gwillcox-r7 added the rn-fix release notes fix label May 17, 2021
@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented May 17, 2021

Release Notes

Fixed a bug in the msfdb script that prevented users from being able to run the script if they installed Metasploit into a location that contained spaces within its path.

@dwelch-r7 dwelch-r7 deleted the support-spaces-in-user-input branch May 18, 2021 09:08
@gwillcox-r7 gwillcox-r7 mentioned this pull request May 18, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants