Remove database initialization during island startup
Database initialization can not be done because island doesn't know the key needed for encrypting collections. Since the key only appears after registration, database setup also should happen only after registration
This commit is contained in:
parent
a2b09a9e7a
commit
3b5dd6ac3e
|
@ -54,7 +54,6 @@ from monkey_island.cc.resources.zero_trust.scoutsuite_auth.scoutsuite_auth impor
|
|||
from monkey_island.cc.resources.zero_trust.zero_trust_report import ZeroTrustReport
|
||||
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH
|
||||
from monkey_island.cc.server_utils.custom_json_encoder import CustomJSONEncoder
|
||||
from monkey_island.cc.services.database import Database
|
||||
from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService
|
||||
from monkey_island.cc.services.representations import output_json
|
||||
|
||||
|
@ -108,7 +107,6 @@ def init_app_services(app):
|
|||
|
||||
with app.app_context():
|
||||
database.init()
|
||||
Database.init_db()
|
||||
|
||||
# If running on AWS, this will initialize the instance data, which is used "later" in the
|
||||
# execution of the island.
|
||||
|
|
|
@ -33,11 +33,6 @@ class Database(object):
|
|||
mongo.db[collection_name].drop()
|
||||
logger.info("Dropped collection {}".format(collection_name))
|
||||
|
||||
@staticmethod
|
||||
def init_db():
|
||||
if not mongo.db.collection_names():
|
||||
Database.reset_db()
|
||||
|
||||
@staticmethod
|
||||
def is_mitigations_missing() -> bool:
|
||||
return bool(AttackMitigations.COLLECTION_NAME not in mongo.db.list_collection_names())
|
||||
|
|
Loading…
Reference in New Issue