Skip to content

User credentials should not be stored in server_config.json #1206

@mssalvatore

Description

@mssalvatore

User credentials (username and password hash) for Monkey Island are not options that the user is expected to manually configure. Rather, they represent inputs to the authentication system. Because they are stored in server_config.json, the server_config.json file must be stored in a writable location, which adds some undesired complexity:

def setup_config_by_cmd_arg(server_config_path) -> Tuple[IslandConfigOptions, str]:
server_config_path = os.path.expandvars(os.path.expanduser(server_config_path))
config = server_config_handler.load_server_config_from_file(server_config_path)
create_secure_directory(config.data_dir, create_parent_dirs=True)
return config, server_config_path
def setup_default_config() -> Tuple[IslandConfigOptions, str]:
server_config_path = DEFAULT_SERVER_CONFIG_PATH
create_secure_directory(DEFAULT_DATA_DIR, create_parent_dirs=False)
server_config_handler.create_default_server_config_file()
config = server_config_handler.load_server_config_from_file(server_config_path)
return config, server_config_path

In addition, user credentials serve a markedly different purpose (access control) than other values in server_config.json (configuring the behavior of Monkey Island at runtime).

Store the user credentials in a separate file within data_dir/. Alternatively, consider storing the user credentials in MongoDB instead of a file.

Tasks

  • Create a new component that can store and retrieve user credentials. (0.25d) @mssalvatore
  • Modify the AuthenticationService to use the new component. Write unit tests that cover the AuthenticationService. (0d) @mssalvatore
  • Remove authentication code from Environment and EnvironmentConfig. (0d) @ilija-lazoroski
  • Update reset password procedure in the documentation (0.25d) @ilija-lazoroski

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