Skip to content

Commit

Permalink
Restore SSL cert and key if in backup
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Dec 2, 2022
1 parent f99e871 commit 255a5b8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions virtual_feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2615,6 +2615,26 @@ sub feature_restore
&$virtual_server::second_print($virtual_server::text{'setup_done'});
}

# Restore SSL cert and key
my $cert = $d->{'ssl_cert'} || &feature_get_web_ssl_file($d, 'cert');
my $key = $d->{'ssl_key'} || &feature_get_web_ssl_file($d, 'key');
my $ca = $d->{'ssl_chain'} || &feature_get_web_ssl_file($d, 'ca');
if ($cert && -r $file."_cert") {
&lock_file($cert);
&virtual_server::write_ssl_file_contents($d, $cert, $file."_cert");
&unlock_file($cert);
}
if ($key && -r $file."_key") {
&lock_file($key);
&virtual_server::write_ssl_file_contents($d, $key, $file."_key");
&unlock_file($key);
}
if ($ca && -r $file."_ca") {
&lock_file($ca);
&virtual_server::write_ssl_file_contents($d, $ca, $file."_ca");
&unlock_file($ca);
}

return 1;
}

Expand Down

0 comments on commit 255a5b8

Please sign in to comment.