metasploit-framework icon indicating copy to clipboard operation
metasploit-framework copied to clipboard

msfdb: `ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied for schema public` + solution

Open fabpiaf opened this issue 1 year ago • 2 comments

https://github.com/rapid7/metasploit-framework/blob/8a46b2b1255faaecd6f3f858b2ac1f3a6cb17fd0/msfdb#L268

This line fails with ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied for schema public

my fix was

psql --dbname msf --username postgres --command "grant all on schema public to msf"

maybe its worth to include that into msfdb

fabpiaf avatar Sep 06 '24 07:09 fabpiaf

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

github-actions[bot] avatar Oct 07 '24 15:10 github-actions[bot]

not stale I guess?

fabpiaf avatar Oct 15 '24 07:10 fabpiaf

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

github-actions[bot] avatar Nov 15 '24 15:11 github-actions[bot]

not?

fabpiaf avatar Nov 15 '24 15:11 fabpiaf

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

github-actions[bot] avatar Dec 18 '24 15:12 github-actions[bot]

I'll leave this open incase anyone else hits it, potentially we're missing documentation or code improvements to handle this scenario better - will see 🕵️

adfoster-r7 avatar Dec 18 '24 15:12 adfoster-r7

psql --host db --dbname msf --username postgres --command 'GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO msf'
psql --host db --dbname msf --username postgres --command 'GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO msf'

The problem seems to be that postgres is the owner of each table/sequence - not msf - maybe thats missing in the migration?

fabpiaf avatar Mar 05 '25 17:03 fabpiaf