Merge pull request #1645 from guardicore/1635-remove-should_monkey_run-config-field

Remove started_on_island config field
This commit is contained in:
Mike Salvatore 2021-12-08 12:07:11 -05:00 committed by GitHub
commit 1c76ea20f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 2 additions and 55 deletions

View File

@ -1,5 +1,4 @@
AWS_KEYS_PATH = ["internal", "monkey", "aws_keys"]
STARTED_ON_ISLAND_PATH = ["internal", "general", "started_on_island"]
EXPORT_MONKEY_TELEMS_PATH = ["internal", "testing", "export_monkey_telems"]
CURRENT_SERVER_PATH = ["internal", "island_server", "current_server"]
SSH_KEYS_PATH = ["internal", "exploits", "exploit_ssh_keys"]

View File

@ -112,7 +112,6 @@ class Configuration(object):
# depth of propagation
depth = 2
max_depth = None
started_on_island = False
current_server = ""
# Configuration servers to try to connect to, in this order.
@ -232,8 +231,5 @@ class Configuration(object):
###########################
export_monkey_telems = False
def get_hop_distance_to_island(self):
return self.max_depth - self.depth
WormConfiguration = Configuration()

View File

@ -401,12 +401,3 @@ class ControlClient(object):
)
except requests.exceptions.RequestException:
return False
@staticmethod
def report_start_on_island():
requests.post( # noqa: DUO123
f"https://{WormConfiguration.current_server}/api/monkey_control/started_on_island",
data=json.dumps({"started_on_island": True}),
verify=False,
timeout=MEDIUM_REQUEST_TIMEOUT,
)

View File

@ -8,11 +8,7 @@ from werkzeug.exceptions import NotFound
from common.common_consts.api_url_consts import T1216_PBA_FILE_DOWNLOAD_PATH
from monkey_island.cc.database import database, mongo
from monkey_island.cc.resources.agent_controls import (
StartedOnIsland,
StopAgentCheck,
StopAllAgents,
)
from monkey_island.cc.resources.agent_controls import StopAgentCheck, StopAllAgents
from monkey_island.cc.resources.attack.attack_report import AttackReport
from monkey_island.cc.resources.auth.auth import Authenticate, init_jwt
from monkey_island.cc.resources.auth.registration import Registration
@ -172,7 +168,6 @@ def init_api_resources(api):
api.add_resource(PropagationCredentials, "/api/propagation-credentials/<string:guid>")
api.add_resource(RemoteRun, "/api/remote-monkey")
api.add_resource(VersionUpdate, "/api/version-update")
api.add_resource(StartedOnIsland, "/api/monkey_control/started_on_island")
api.add_resource(StopAgentCheck, "/api/monkey_control/needs-to-stop/<int:monkey_guid>")
api.add_resource(StopAllAgents, "/api/monkey_control/stop-all-agents")
api.add_resource(ScoutSuiteAuth, "/api/scoutsuite_auth/<string:provider>")

View File

@ -1,3 +1,2 @@
from .stop_all_agents import StopAllAgents
from .started_on_island import StartedOnIsland
from .stop_agent_check import StopAgentCheck

View File

@ -1,16 +0,0 @@
import json
import flask_restful
from flask import make_response, request
from monkey_island.cc.services.config import ConfigService
class StartedOnIsland(flask_restful.Resource):
# Used by monkey. can't secure.
def post(self):
data = json.loads(request.data)
if data["started_on_island"]:
ConfigService.set_started_on_island(True)
return make_response({}, 200)

View File

@ -15,7 +15,6 @@ from common.config_value_paths import (
PBA_LINUX_FILENAME_PATH,
PBA_WINDOWS_FILENAME_PATH,
SSH_KEYS_PATH,
STARTED_ON_ISLAND_PATH,
USER_LIST_PATH,
)
from monkey_island.cc.database import mongo
@ -405,10 +404,6 @@ class ConfigService:
def is_test_telem_export_enabled():
return ConfigService.get_config_value(EXPORT_MONKEY_TELEMS_PATH)
@staticmethod
def set_started_on_island(value: bool):
ConfigService.set_config_value(STARTED_ON_ISLAND_PATH, value)
@staticmethod
def get_config_propagation_credentials_from_flat_config(config):
return {

View File

@ -15,13 +15,6 @@ INTERNAL = {
"description": "Time to keep tunnel open before going down after last exploit "
"(in seconds)",
},
"started_on_island": {
"title": "Started on island",
"type": "boolean",
"default": False,
"description": "Was exploitation started from island"
"(did monkey with max depth ran on island)",
},
},
},
"monkey": {

View File

@ -117,9 +117,6 @@ export default function UiSchema(props) {
other_behaviors : {'ui:widget': 'hidden'}
},
internal: {
general: {
started_on_island: {'ui:widget': 'hidden'}
},
classes: {
finger_classes: {
classNames: 'config-template-no-header',

View File

@ -101,7 +101,6 @@
"skip_exploit_if_file_exist": false,
"smb_download_timeout": 300,
"smb_service_name": "InfectionMonkey",
"started_on_island": false,
"subnet_scan_list": [],
"system_info_collector_classes": [
"AwsCollector",

View File

@ -44,8 +44,7 @@
},
"internal": {
"general": {
"keep_tunnel_open_time": 60,
"started_on_island": false
"keep_tunnel_open_time": 60
},
"monkey": {
"victims_max_find": 100,