-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5. RemoveOldCerts.cs
27 lines (25 loc) · 1021 Bytes
/
5. RemoveOldCerts.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using BSS.Logging;
using Renci.SshNet;
using System;
namespace CertBotHelper
{
internal static partial class Program
{
private static Boolean RemoveDownloadedCertificatesFromRemoteLocation(SftpClient sftpClient, ref Configuration configuration)
{
try
{
sftpClient.DeleteFile(configuration.RemoteCertBotPath + "cert.crt");
sftpClient.DeleteFile(configuration.RemoteCertBotPath + "chain.crt");
sftpClient.DeleteFile(configuration.RemoteCertBotPath + "fullChain.crt");
Log.FastLog($"Successfully removed all three certificates from the server", LogSeverity.Info, "Delete");
}
catch (Exception exception)
{
Log.FastLog($"An error occurred whilst removing the certificates from the server\n{exception.Message}", LogSeverity.Critical, "Delete");
return false;
}
return true;
}
}
}