How to configure SSH server on MikroTik router using Python & routeros_api


def configure_ssh(api):
    """
    Set SSH to forwarding enabled both, strong crypto, always allow password login,
    and host key type to ed25519.
    """
    # Set SSH to forwarding enabled both, strong crypto, always allow password login,
    # and host key type to ed25519
    print("Configuring SSH")
    try:
        api.get_resource('/ip/ssh').set(
            forwarding_enabled='both',
            strong_crypto='yes',
            always_allow_password_login='yes',
            host_key_type='ed25519'
        )
    except routeros_api.exceptions.RouterOsApiCommunicationError as e:
        raise e