Skip to content

Untangle logger config from environment config #1146

@mssalvatore

Description

@mssalvatore

Monkey Island needs to write runtime artifacts to a writable location and assume that the source code directory is read-only (#1141). Currently, the "data_dir" configuration option is provided in server_config.json, but is effectively duplicated in the logger config. Since the server_config.json contains data for populating the EnvironmentConfig object, this effectively entangles the logger config with the environment config.

  • Parse server_config.json config in monkey_island.py. (0d) - @shreyamalviya

    • Remove island_logger_config.json
    • Remove --logger-config command-line argument
    • Add "log_level" option to server_config.json.
    • Replace json_setup_logging() with a new function that configures the logger.
      • The function accepts 2 parameters:
        • The logging level
        • The data directory
      • The function configures the logger using settings that are identical to what
        was in island_logger_config.json except it uses the logging level it was given
        and the log is written to "${data_dir}/monkey_island.log".
    • monkey_island.py parses the configuration file and passes the appropriate configuration values to the new logger configuration function.
  • Reoganize the default server_config.json to have an "environment" section comprising the old environment config. (0d) @mssalvatore
    Example:

{
    "log_level": "debug",
    "environment": {
        "data_dir": "$HOME/.monkey_island",
        "server_config": "password",
        "deployment": "development",
        "user": "my_user",
        "password_hash": "DEADBEEF"
    }
}
  • monkey_island.py passes the server config file path to main.py which passes it to the EnvironmentConfig constructor.

  • Modify EnvironmentConfig.save_to_file() so that only the "environment" config section in server_config.json is updated.

  • Move "data_dir" to the top level of the configuration. (00d) @mssalvatore

{
    "log_level": "debug",
    "data_dir": "$HOME/.monkey_island",
    "environment": {
        "server_config": "password",
        "deployment": "development",
        "user": "my_user",
        "password_hash": "DEADBEEF"
    }
}
  • Replace all current references to data_dir or data_dir_abs_path with calls to the new get_data_dir() function.
  • Update the documentation (0d) - @shreyamalviya
    • Update the documentation for resetting the password
    • Add instructions for changing the log level
    • Add a description for "data_dir"
  • Update the docker build to use the new server_config.json format. (0d) @mssalvatore
  • Update the AppImage build to use the new server_config.json format.(0d) @mssalvatore
  • Update the MSI build to use the new server_config.json format. (0.25d) (Blocked by Monkey build machine being offline due to office moving)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions