line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# crypto::letsencrypt Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Crypto::Letsencrypt; |
7
|
1
|
|
|
1
|
|
697
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
41
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Shell::Command Metabrik::System::Package); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
481
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(experimental ssl certificate x509 tls cert) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
datadir => [ qw(datadir) ], |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
commands => { |
22
|
|
|
|
|
|
|
install => [ ], # Inherited |
23
|
|
|
|
|
|
|
certonly => [ qw(domain|$domain_list email|OPTIONAL) ], |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
require_modules => { |
26
|
|
|
|
|
|
|
'Metabrik::Devel::Git' => [ ], |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub install { |
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $datadir = $self->datadir; |
35
|
0
|
|
|
|
|
|
my $directory = $datadir.'/letsencrypt'; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
my $dg = Metabrik::Devel::Git->new_from_brik_init($self) or return; |
38
|
0
|
0
|
|
|
|
|
$dg->clone('https://github.com/letsencrypt/letsencrypt', $directory) or return; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $self->system("$directory/letsencrypt-auto --help"); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
# https://letsencrypt.readthedocs.org/en/latest/using.html |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
sub certonly { |
47
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
48
|
0
|
|
|
|
|
|
my ($domains, $email) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('certonly', $domains) or return; |
51
|
0
|
0
|
|
|
|
|
my $ref = $self->brik_help_run_invalid_arg('certonly', $domains, 'ARRAY', 'SCALAR') |
52
|
|
|
|
|
|
|
or return; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $bin = $self->datadir.'/letsencrypt/letsencrypt-auto'; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $cmd = "$bin certonly --manual --agree-tos"; |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
if (defined($email)) { |
59
|
0
|
|
|
|
|
|
$cmd .= " --email $email"; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
if ($ref eq 'ARRAY') { |
63
|
0
|
|
|
|
|
|
for (@$domains) { |
64
|
0
|
|
|
|
|
|
$cmd .= " -d $_"; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else { # SCALAR |
68
|
0
|
|
|
|
|
|
$cmd .= " -d $domains"; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$self->log->verbose("certonly: cmd[$cmd]"); |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $self->system($cmd); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |