Beispiel #1
0
def acme_from_config_key(config, key, regr=None):
    "Wrangle ACME client construction"
    # TODO: Allow for other alg types besides RS256
    net = acme_client.ClientNetwork(key,
                                    account=regr,
                                    verify_ssl=(not config.no_verify_ssl),
                                    user_agent=determine_user_agent(config))
    return acme_client.BackwardsCompatibleClientV2(net, key, config.server)
Beispiel #2
0
def acme_from_config_key(config, key, regr=None):
    "Wrangle ACME client construction"
    # TODO: Allow for other alg types besides RS256
    net = acme_client.ClientNetwork(key,
                                    account=regr,
                                    verify_ssl=(not config.no_verify_ssl),
                                    user_agent=determine_user_agent(config))

    with warnings.catch_warnings():
        warnings.simplefilter("ignore", DeprecationWarning)

        client = acme_client.BackwardsCompatibleClientV2(
            net, key, config.server)
        if client.acme_version == 1:
            logger.warning(
                "Certbot is configured to use an ACMEv1 server (%s). ACMEv1 support is deprecated"
                " and will soon be removed. See https://community.letsencrypt.org/t/143839 for "
                "more information.", config.server)
        return client
Beispiel #3
0
def acme_from_config_key(
    config: configuration.NamespaceConfig,
    key: jose.JWK,
    regr: Optional[messages.RegistrationResource] = None
) -> acme_client.ClientV2:
    """Wrangle ACME client construction"""
    if key.typ == 'EC':
        public_key = key.key
        if public_key.key_size == 256:
            alg = ES256
        elif public_key.key_size == 384:
            alg = ES384
        elif public_key.key_size == 521:
            alg = ES512
        else:
            raise errors.NotSupportedError(
                "No matching signing algorithm can be found for the key")
    else:
        alg = RS256
    net = acme_client.ClientNetwork(key,
                                    alg=alg,
                                    account=regr,
                                    verify_ssl=(not config.no_verify_ssl),
                                    user_agent=determine_user_agent(config))

    with warnings.catch_warnings():
        warnings.simplefilter("ignore", DeprecationWarning)

        client = acme_client.BackwardsCompatibleClientV2(
            net, key, config.server)
        if client.acme_version == 1:
            logger.warning(
                "Certbot is configured to use an ACMEv1 server (%s). ACMEv1 support is deprecated"
                " and will soon be removed. See https://community.letsencrypt.org/t/143839 for "
                "more information.", config.server)
        return cast(acme_client.ClientV2, client)