-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Add MCP module notes and comments for hosts #21512
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -54,7 +54,7 @@ def self.apply_defaults(config) | |||||
| config[:logging] ||= {} | ||||||
|
|
||||||
| config[:msf_api][:type] ||= 'messagepack' | ||||||
| config[:msf_api][:host] ||= 'localhost' | ||||||
| config[:msf_api][:host] ||= '127.0.0.1' | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Binding to localhost would resolve to ipv6 then have issues:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking, did you get the same error with the MCP server, which also default to Also, can you also update the example config files:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also ran into this error with the mcp server FWIW |
||||||
| config[:msf_api][:port] ||= (config[:msf_api][:type] == 'json-rpc') ? 8081 : 55553 | ||||||
|
|
||||||
| config[:msf_api][:ssl] = config[:msf_api].fetch(:ssl, true) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,7 +125,7 @@ def wait_for_rpc(timeout: DEFAULT_WAIT_TIMEOUT, interval: DEFAULT_WAIT_INTERVAL) | |
| "Timed out waiting for RPC server after #{timeout} seconds" | ||
| end | ||
|
|
||
| @output.puts 'Waiting for RPC server to become available...' | ||
| @output.puts "Waiting for RPC server to become available at #{Rex::Socket.to_authority(@config[:msf_api][:host], @config[:msf_api][:port])}..." | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding where it's connecting to: RPC server started via msfrpcd (PID: 37410)
- Waiting for RPC server to become available...
+ Waiting for RPC server to become available at 127.0.0.1:55553... |
||
| sleep(interval) | ||
| end | ||
| end | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctrl+c didn't work:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I traced back this issue and it is related to the call to
iloginshutdown, which callMutex#synchronizeat some point. This comes from the last change that has been made to make it compatible with Framework logging system.Mutex#synchronizecan't be called from a signal trap context.That said, during my testing, I found out
@main_thread.raisedoesn't work neither. Therescue Interruptis never triggered in#run. However using a fresh new Thread seems to work:Another option would be to use
at_exit, which is what @dwelch-r7 suggests in this PRThis solution is simpler but we lose the ability to distinguish signals from normal exits. That said, since The
Interruptexception handler callshutdown('INT')even if a SIGTERM is received, so it will always logged as SIGINT. Maybe passing the signal in the Interrupt exception and then passing it toshutdownwould solve this, but it is not a big deal.Whatever solution we choose, we should add specs that check if
#shutdownis correctly called when aINTorTERMsignal is received.Thought?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the issue with the Signal trap is that it gets overwritten by Puma when the
httptransport is used (see my comment here). So it looks like we haven't a lot of options.