Beispiel #1
0
def test_manual_http_auth(context):
    """Test the HTTP-01 challenge using manual plugin."""
    with misc.create_http_server(context.http_01_port) as webroot,\
            misc.manual_http_hooks(webroot, context.http_01_port) as scripts:

        certname = context.get_domain()
        context.certbot([
            'certonly',
            '-a',
            'manual',
            '-d',
            certname,
            '--cert-name',
            certname,
            '--manual-auth-hook',
            scripts[0],
            '--manual-cleanup-hook',
            scripts[1],
            '--pre-hook',
            misc.echo('wtf_pre', context.hook_probe),
            '--post-hook',
            misc.echo('wtf_post', context.hook_probe),
            '--renew-hook',
            misc.echo('renew', context.hook_probe),
        ])

    with pytest.raises(AssertionError):
        assert_hook_execution(context.hook_probe, 'renew')
    assert_saved_renew_hook(context.config_dir, certname)
Beispiel #2
0
def test_manual_dns_auth(context):
    """Test the DNS-01 challenge using manual plugin."""
    certname = context.get_domain('dns')
    context.certbot([
        '-a',
        'manual',
        '-d',
        certname,
        '--preferred-challenges',
        'dns',
        'run',
        '--cert-name',
        certname,
        '--manual-auth-hook',
        context.manual_dns_auth_hook,
        '--manual-cleanup-hook',
        context.manual_dns_cleanup_hook,
        '--pre-hook',
        misc.echo('wtf_pre', context.hook_probe),
        '--post-hook',
        misc.echo('wtf_post', context.hook_probe),
        '--renew-hook',
        misc.echo('renew', context.hook_probe),
    ])

    with pytest.raises(AssertionError):
        assert_hook_execution(context.hook_probe, 'renew')
    assert_saved_renew_hook(context.config_dir, certname)

    context.certbot(
        ['renew', '--cert-name', certname, '--authenticator', 'manual'])

    assert_cert_count_for_lineage(context.config_dir, certname, 2)
Beispiel #3
0
def test_http_01(context: IntegrationTestsContext) -> None:
    """Test the HTTP-01 challenge using standalone plugin."""
    # We start a server listening on the port for the
    # TLS-SNI challenge to prevent regressions in #3601.
    with misc.create_http_server(context.tls_alpn_01_port):
        certname = context.get_domain('le2')
        context.certbot([
            '--domains',
            certname,
            '--preferred-challenges',
            'http-01',
            'run',
            '--cert-name',
            certname,
            '--pre-hook',
            misc.echo('wtf_pre', context.hook_probe),
            '--post-hook',
            misc.echo('wtf_post', context.hook_probe),
            '--deploy-hook',
            misc.echo('deploy', context.hook_probe),
        ])

    assert_hook_execution(context.hook_probe, 'deploy')
    assert_saved_renew_hook(context.config_dir, certname)
    assert_saved_lineage_option(context.config_dir, certname, 'key_type',
                                'rsa')
Beispiel #4
0
def test_http_01(context):
    """Test the HTTP-01 challenge using standalone plugin."""
    # We start a server listening on the port for the
    # TLS-SNI challenge to prevent regressions in #3601.
    with misc.create_http_server(context.tls_alpn_01_port):
        certname = context.get_domain('le2')
        context.certbot([
            '--domains', certname, '--preferred-challenges', 'http-01', 'run',
            '--cert-name', certname,
            '--pre-hook', 'echo wtf.pre >> "{0}"'.format(context.hook_probe),
            '--post-hook', 'echo wtf.post >> "{0}"'.format(context.hook_probe),
            '--deploy-hook', 'echo deploy >> "{0}"'.format(context.hook_probe)
        ])

    assert_hook_execution(context.hook_probe, 'deploy')
    assert_saved_renew_hook(context.config_dir, certname)