Skip to content

Commit ac08797

Browse files
committedJul 2, 2019
revoke cert
1 parent 915cdd9 commit ac08797

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
 

‎cert_revoke.cgi

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/perl
2+
3+
require './certbot-lib.pl';
4+
5+
&ReadParse();
6+
7+
&ui_print_header(undef, $text{'certificates_title'}, "");
8+
9+
my $name = $in{'name'};
10+
my $mode = $in{'mode'} || 'select';
11+
12+
my $href = get_cert_info($name);
13+
if(!$href){
14+
error('Certificate'.$name.' not found!');
15+
16+
}elsif($mode eq 'select'){ #user selects options
17+
18+
print &ui_form_start("cert_revoke.cgi", "post");
19+
print &ui_hidden('mode', 'revoke');
20+
print &ui_hidden('name', $name);
21+
print &ui_table_start($text{'cert_tbl_revoke'}, "width=100%", 2);
22+
print &ui_table_row($text{'cert_name'}, $href->{'name'}, 2);
23+
24+
my @reasons = (['unspecified', 'Unspecified'], ['keycompromise', 'Key compromise'], ['affiliationchanged', 'Affiliation Changed'], ['superseded', 'Suspended'], ['cessationofoperation', 'Cessation of operation']);
25+
print &ui_table_row($text{'revoke_reasons'}, &ui_select('revoke_reason', $reasons[0][0], \@reasons, 1, 0), 2);
26+
print &ui_table_row($text{'revoke_and_delete'}, &ui_yesno_radio('revoke_and_delete', 'true', 'true', 'false'), 2);
27+
28+
print &ui_table_end();
29+
print &ui_form_end([ [ "", $text{'cert_revoke'} ] ]);
30+
31+
}else{ #real revoke
32+
my $cmd = get_certbot_cmd().' revoke -n';
33+
$cmd .= ($in{'revoke_and_delete'} eq 'true') ? ' --delete-after-revoke' : ' --no-delete-after-revoke';
34+
$cmd .= ' --cert-path '.$href->{'cert_path'};
35+
$cmd .= ' 2>&1'; #output goes to stderr!
36+
37+
my $out = &backquote_command($cmd);
38+
foreach my $line (split('\n', $out)){
39+
print &html_escape($line)."<br>";
40+
}
41+
}
42+
&ui_print_footer("edit_certificates.cgi", $text{'index_return_certs'});

0 commit comments

Comments
 (0)
Please sign in to comment.