mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Add function to cleanup let's encrypt files for a domain
This commit is contained in:
@@ -475,4 +475,22 @@ if ($out && $out =~ /\s*(\d+\.\d+)\s*/) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
# cleanup_letsencrypt_files(domain)
|
||||
# Delete all temporary files under /etc/letsencrypt for a domain name
|
||||
sub cleanup_letsencrypt_files
|
||||
{
|
||||
my ($dname) = @_;
|
||||
foreach my $base ("/etc/letsencrypt", "/usr/local/etc/letsencrypt") {
|
||||
next if (!-d $base);
|
||||
foreach my $f ("$base/live/$dname",
|
||||
glob("$base/live/$dname-[0-9][0-9][0-9][0-9]"),
|
||||
"$base/archive/$dname",
|
||||
glob("$base/archive/$dname-[0-9][0-9][0-9][0-9]"),
|
||||
"$base/renewal/$dname.conf",
|
||||
glob("$base/renewal/$dname-[0-9][0-9][0-9][0-9].conf")) {
|
||||
&unlink_file($f) if (-e $f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user