mirror of
https://github.com/GH05TCREW/pentestagent.git
synced 2026-03-07 22:33:38 +00:00
docker: improve safety, UX, and Metasploit MCP defaults
Why: - Persist artifacts to /app/loot so container outputs remain available when mounted. - Avoid mandatory host chown; make chown opt-in via CHOWN_ON_START to prevent accidental ownership changes. - Bind msfrpcd to 127.0.0.1 by default and add EXPOSE_MSF_RPC opt-in to avoid exposing RPC to host network. - Replace crashing assertion on missing default model with a friendly CLI/TUI error path. - Add .dockerignore to reduce build context and avoid copying unnecessary files.
This commit is contained in:
@@ -154,6 +154,17 @@ if [ "${LAUNCH_METASPLOIT_MCP,,}" = "true" ] && [ -n "${MSF_PASSWORD:-}" ]; then
|
||||
LOG_DIR="loot/artifacts"
|
||||
mkdir -p "$LOG_DIR"
|
||||
MSF_LOG="$LOG_DIR/metasploit_msfrpcd.log"
|
||||
# For safety, bind msfrpcd to loopback by default. To intentionally expose RPC to the host
|
||||
# set EXPOSE_MSF_RPC=true in your environment (not recommended on shared hosts).
|
||||
if [ "${EXPOSE_MSF_RPC,,}" != "true" ]; then
|
||||
if [ "$MSF_SERVER" != "127.0.0.1" ] && [ "$MSF_SERVER" != "localhost" ]; then
|
||||
echo "Warning: MSF_SERVER is set to '$MSF_SERVER' but EXPOSE_MSF_RPC is not true. Overriding to 127.0.0.1 for safety."
|
||||
fi
|
||||
MSF_SERVER=127.0.0.1
|
||||
else
|
||||
echo "EXPOSE_MSF_RPC=true: msfrpcd will bind to $MSF_SERVER and may be reachable from the host network. Ensure you know the risks."
|
||||
fi
|
||||
|
||||
if [ "${MSF_SSL,,}" = "true" ] || [ "${MSF_SSL}" = "1" ]; then
|
||||
"$msfrpcd_cmd" -U "$MSF_USER" -P "$MSF_PASSWORD" -a "$MSF_SERVER" -p "$MSF_PORT" -S >"$MSF_LOG" 2>&1 &
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user