Exemple #1
0
def _forcibly_reset_chap(hutil):
    name = "ChallengeResponseAuthentication"
    config = ext_utils.get_file_contents(SshdConfigPath).split("\n")
    for i in range(0, len(config)):
        if config[i].startswith(name) and "no" in config[i].lower():
            ext_utils.add_extension_event(name=hutil.get_name(), op="sshd", is_success=True,
                                          message="ChallengeResponseAuthentication no")
            return

    ext_utils.add_extension_event(name=hutil.get_name(), op="sshd", is_success=True,
                                  message="ChallengeResponseAuthentication yes")
    _backup_sshd_config(SshdConfigPath)
    _set_sshd_config(config, name, "no")
    ext_utils.replace_file_with_contents_atomic(SshdConfigPath, "\n".join(config))
    MyDistro.restart_ssh_service()
Exemple #2
0
def _allow_password_auth():
    config = ext_utils.get_file_contents(SshdConfigPath).split("\n")
    _set_sshd_config(config, "PasswordAuthentication", "yes")
    ext_utils.replace_file_with_contents_atomic(SshdConfigPath,
                                                "\n".join(config))