本文整理汇总了C#中LetsEncrypt.ACME.Simple.Target类的典型用法代码示例。如果您正苦于以下问题:C# Target类的具体用法?C# Target怎么用?C# Target使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Target类属于LetsEncrypt.ACME.Simple命名空间,在下文中一共展示了Target类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BeforeAuthorize
// all this would do is move the handler to the bottom, which is the last place you want it.
//<handlers>
// <remove name = "StaticFile" />
// < add name="StaticFile" path="*." verb="*" type="" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
//</handlers>
// this can work sometimes
//<handlers>
// <clear />
// <add name = ""StaticFile"" path=""*."" verb=""*"" type="""" modules=""StaticFileModule,DefaultDocumentModule,DirectoryListingModule"" scriptProcessor="""" resourceType=""Either"" requireAccess=""Read"" allowPathInfo=""false"" preCondition="""" responseBufferLimit=""4194304"" />
//</handlers>
public override void BeforeAuthorize(Target target, string answerPath)
{
var directory = Path.GetDirectoryName(answerPath);
var webConfigPath = Path.Combine(directory, "web.config");
Console.WriteLine($" Writing web.config to add extensionless mime type to {webConfigPath}");
File.WriteAllText(webConfigPath, webConfig);
}
开发者ID:poynter2,项目名称:letsencrypt-win-simple,代码行数:17,代码来源:IISPlugin.cs
示例2: BeforeAuthorize
public override void BeforeAuthorize(Target target, string answerPath, string token)
{
var directory = Path.GetDirectoryName(answerPath);
var webConfigPath = Path.Combine(directory, "web.config");
Console.WriteLine($" Writing web.config to add extensionless mime type to {webConfigPath}");
Log.Information("Writing web.config to add extensionless mime type to {webConfigPath}", webConfigPath);
File.Copy(_sourceFilePath, webConfigPath, true);
}
开发者ID:Trapulo,项目名称:letsencrypt-win-simple,代码行数:9,代码来源:IISPlugin.cs
示例3: BeforeAuthorize
public override void BeforeAuthorize(Target target, string answerPath, string token)
{
answerPath = answerPath.Remove((answerPath.Length - token.Length), token.Length);
var webConfigPath = Path.Combine(answerPath, "web.config");
Console.WriteLine($" Writing web.config to add extensionless mime type to {webConfigPath}");
Log.Information("Writing web.config to add extensionless mime type to {webConfigPath}", webConfigPath);
Upload(webConfigPath, File.ReadAllText(_sourceFilePath));
}
开发者ID:glacasa,项目名称:letsencrypt-win-simple,代码行数:10,代码来源:FTPPlugin.cs
示例4: OnAuthorizeFail
public override void OnAuthorizeFail(Target target)
{
Console.WriteLine(@"
This could be caused by IIS not being setup to handle extensionless static
files. Here's how to fix that:
1. In IIS manager goto Site/Server->Handler Mappings->View Ordered List
2. Move the StaticFile mapping above the ExtensionlessUrlHandler mappings.
(like this http://i.stack.imgur.com/nkvrL.png)");
}
开发者ID:MartijnRasenberg,项目名称:letsencrypt-win-simple,代码行数:10,代码来源:IISPlugin.cs
示例5: PrintMenu
public override void PrintMenu()
{
if (!String.IsNullOrEmpty(Program.Options.ManualHost))
{
var target = new Target() { Host = Program.Options.ManualHost, WebRootPath = Program.Options.WebRoot, PluginName = Name };
Program.Auto(target);
Environment.Exit(0);
}
Console.WriteLine(" M: Generate a certificate manually.");
}
开发者ID:MartijnRasenberg,项目名称:letsencrypt-win-simple,代码行数:11,代码来源:ManualPlugin.cs
示例6: Renew
public override void Renew(Target target)
{
var auth = Program.Authorize(target);
if (auth.Status == "valid")
{
var pfxFilename = Program.GetCertificate(target);
Console.WriteLine("");
Console.WriteLine($"You can find the certificate at {pfxFilename}");
Log.Information("You can find the certificate at {pfxFilename}");
}
}
开发者ID:glacasa,项目名称:letsencrypt-win-simple,代码行数:11,代码来源:WebDavPlugin.cs
示例7: OnAuthorizeFail
public override void OnAuthorizeFail(Target target)
{
Console.WriteLine(@"
This could be caused by IIS not being setup to handle extensionless static
files. Here's how to fix that:
1. In IIS manager goto Site/Server->Handler Mappings->View Ordered List
2. Move the StaticFile mapping above the ExtensionlessUrlHandler mappings.
(like this http://i.stack.imgur.com/nkvrL.png)
3. If you need to make changes to your web.config file, update the one
at " + sourceFilePath);
}
开发者ID:cylon,项目名称:letsencrypt-win-simple,代码行数:12,代码来源:IISPlugin.cs
示例8: HandleMenuResponse
public override void HandleMenuResponse(string response, List<Target> targets)
{
if (response == "m")
{
Console.Write("Enter a host name: ");
var hostName = Console.ReadLine();
// TODO: pull an existing host from the settings to default this value
Console.Write("Enter a site path (the web root of the host for http authentication): ");
var physicalPath = Console.ReadLine();
// TODO: make a system where they can execute a program/batch file to update whatever they need after install.
var target = new Target() { Host = hostName, WebRootPath = physicalPath, PluginName = Name };
Program.Auto(target);
}
}
开发者ID:MartijnRasenberg,项目名称:letsencrypt-win-simple,代码行数:17,代码来源:ManualPlugin.cs
示例9: HandleMenuResponse
public override void HandleMenuResponse(string response, List<Target> targets)
{
if (response == "m")
{
Console.Write("Enter a host name: ");
var hostName = Console.ReadLine();
string[] alternativeNames = null;
List<string> sanList = null;
if (Program.Options.San)
{
Console.Write("Enter all Alternative Names seperated by a comma ");
// Copied from http://stackoverflow.com/a/16638000
int BufferSize = 16384;
Stream inputStream = Console.OpenStandardInput(BufferSize);
Console.SetIn(new StreamReader(inputStream, Console.InputEncoding, false, BufferSize));
var sanInput = Console.ReadLine();
alternativeNames = sanInput.Split(',');
sanList = new List<string>(alternativeNames);
}
Console.Write("Enter a site path (the web root of the host for http authentication): ");
var physicalPath = Console.ReadLine();
if (sanList == null || sanList.Count <= 100)
{
var target = new Target()
{
Host = hostName,
WebRootPath = physicalPath,
PluginName = Name,
AlternativeNames = sanList
};
Auto(target);
}
else
{
Console.WriteLine(
$" You entered too many hosts for a SAN certificate. Let's Encrypt currently has a maximum of 100 alternative names per certificate.");
Log.Error(
"You entered too many hosts for a San certificate. Let's Encrypt currently has a maximum of 100 alternative names per certificate.");
}
}
}
开发者ID:Lone-Coder,项目名称:letsencrypt-win-simple,代码行数:46,代码来源:ManualPlugin.cs
示例10: HandleMenuResponse
public override void HandleMenuResponse(string response, List<Target> targets)
{
if (response == "m")
{
Console.Write("Enter a host name: ");
var hostName = Console.ReadLine();
string[] alternativeNames = null;
if (Program.Options.San)
{
Console.Write("Enter all Alternative Names seperated by a comma ");
Console.SetIn(new System.IO.StreamReader(Console.OpenStandardInput(8192)));
var sanInput = Console.ReadLine();
alternativeNames = sanInput.Split(',');
}
// TODO: pull an existing host from the settings to default this value
Console.Write("Enter a site path (the web root of the host for http authentication): ");
var physicalPath = Console.ReadLine();
// TODO: make a system where they can execute a program/batch file to update whatever they need after install.
List<string> sanList = new List<string>(alternativeNames);
if (sanList.Count <= 100)
{
var target = new Target()
{
Host = hostName,
WebRootPath = physicalPath,
PluginName = Name,
AlternativeNames = sanList
};
Program.Auto(target);
}
else
{
Console.WriteLine(
$" You entered too many hosts for a SAN certificate. Let's Encrypt currently has a maximum of 100 alternative names per certificate.");
Log.Error(
"You entered too many hosts for a San certificate. Let's Encrypt currently has a maximum of 100 alternative names per certificate.");
}
}
}
开发者ID:Trapulo,项目名称:letsencrypt-win-simple,代码行数:43,代码来源:ManualPlugin.cs
示例11: Install
public override void Install(Target target)
{
// This method with just the Target paramater is currently only used by Centralized SSL
if (!string.IsNullOrWhiteSpace(Program.Options.Script) &&
!string.IsNullOrWhiteSpace(Program.Options.ScriptParameters))
{
var parameters = string.Format(Program.Options.ScriptParameters, target.Host,
Properties.Settings.Default.PFXPassword, Program.Options.CentralSslStore);
Console.WriteLine($" Running {Program.Options.Script} with {parameters}");
Log.Information("Running {Script} with {parameters}", Program.Options.Script, parameters);
Process.Start(Program.Options.Script, parameters);
}
else if (!string.IsNullOrWhiteSpace(Program.Options.Script))
{
Console.WriteLine($" Running {Program.Options.Script}");
Log.Information("Running {Script}", Program.Options.Script);
Process.Start(Program.Options.Script);
}
else
{
Console.WriteLine(" WARNING: Unable to configure server software.");
}
}
开发者ID:rkerber,项目名称:letsencrypt-win-simple,代码行数:23,代码来源:FTPPlugin.cs
示例12: Install
public override void Install(Target target, string pfxFilename, X509Store store, X509Certificate2 certificate)
{
using (var iisManager = new ServerManager())
{
var site = GetSite(target, iisManager);
var existingBinding = (from b in site.Bindings where b.Host == target.Host && b.Protocol == "https" select b).FirstOrDefault();
if (existingBinding != null)
{
Console.WriteLine($" Updating Existing https Binding");
existingBinding.CertificateHash = certificate.GetCertHash();
existingBinding.CertificateStoreName = store.Name;
}
else
{
Console.WriteLine($" Adding https Binding");
var iisBinding = site.Bindings.Add(":443:" + target.Host, certificate.GetCertHash(), store.Name);
iisBinding.Protocol = "https";
}
Console.WriteLine($" Commiting binding changes to IIS");
iisManager.CommitChanges();
}
}
开发者ID:poynter2,项目名称:letsencrypt-win-simple,代码行数:23,代码来源:IISPlugin.cs
示例13: Authorize
public static AuthorizationState Authorize(Target target)
{
List<string> dnsIdentifiers = new List<string>();
if (!Options.SAN)
{
dnsIdentifiers.Add(target.Host);
}
if(target.AlternativeNames != null)
{
dnsIdentifiers.AddRange(target.AlternativeNames);
}
List<AuthorizationState> authStatus = new List<AuthorizationState>();
foreach (var dnsIdentifier in dnsIdentifiers)
{
//var dnsIdentifier = target.Host;
var webRootPath = target.WebRootPath;
Console.WriteLine($"\nAuthorizing Identifier {dnsIdentifier} Using Challenge Type {AcmeProtocol.CHALLENGE_TYPE_HTTP}");
Log.Information("Authorizing Identifier {dnsIdentifier} Using Challenge Type {CHALLENGE_TYPE_HTTP}", dnsIdentifier, AcmeProtocol.CHALLENGE_TYPE_HTTP);
var authzState = client.AuthorizeIdentifier(dnsIdentifier);
var challenge = client.DecodeChallenge(authzState, AcmeProtocol.CHALLENGE_TYPE_HTTP);
var httpChallenge = challenge.Challenge as HttpChallenge;
// We need to strip off any leading '/' in the path
var filePath = httpChallenge.FilePath;
if (filePath.StartsWith("/", StringComparison.OrdinalIgnoreCase))
filePath = filePath.Substring(1);
var answerPath = Environment.ExpandEnvironmentVariables(Path.Combine(webRootPath, filePath));
Console.WriteLine($" Writing challenge answer to {answerPath}");
Log.Information("Writing challenge answer to {answerPath}", answerPath);
var directory = Path.GetDirectoryName(answerPath);
Directory.CreateDirectory(directory);
File.WriteAllText(answerPath, httpChallenge.FileContent);
target.Plugin.BeforeAuthorize(target, answerPath);
var answerUri = new Uri(httpChallenge.FileUrl);
Console.WriteLine($" Answer should now be browsable at {answerUri}");
Log.Information("Answer should now be browsable at {answerUri}", answerUri);
try
{
Console.WriteLine(" Submitting answer");
Log.Information("Submitting answer");
authzState.Challenges = new AuthorizeChallenge[] { challenge };
client.SubmitChallengeAnswer(authzState, AcmeProtocol.CHALLENGE_TYPE_HTTP, true);
// have to loop to wait for server to stop being pending.
// TODO: put timeout/retry limit in this loop
while (authzState.Status == "pending")
{
Console.WriteLine(" Refreshing authorization");
Log.Information("Refreshing authorization");
Thread.Sleep(4000); // this has to be here to give ACME server a chance to think
var newAuthzState = client.RefreshIdentifierAuthorization(authzState);
if (newAuthzState.Status != "pending")
authzState = newAuthzState;
}
Console.WriteLine($" Authorization Result: {authzState.Status}");
Log.Information("Auth Result {Status}", authzState.Status);
if (authzState.Status == "invalid")
{
Log.Error("Authorization Failed {Status}", authzState.Status);
Log.Debug("Full Error Details {@authzState}", authzState);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("\n******************************************************************************");
Console.WriteLine($"The ACME server was probably unable to reach {answerUri}");
Log.Error("Unable to reach {answerUri}", answerUri);
Console.WriteLine("\nCheck in a browser to see if the answer file is being served correctly.");
target.Plugin.OnAuthorizeFail(target);
Console.WriteLine("\n******************************************************************************");
Console.ResetColor();
}
authStatus.Add(authzState);
}
finally
{
if (authzState.Status == "valid")
{
Console.WriteLine(" Deleting answer");
Log.Information("Deleting answer");
File.Delete(answerPath);
}
}
}
foreach (var authState in authStatus)
{
if(authState.Status != "valid")
{
return authState;
}
}
return new AuthorizationState { Status = "valid" };
}
开发者ID:knives-out,项目名称:letsencrypt-win-simple,代码行数:100,代码来源:Program.cs
示例14: ScheduleRenewal
const float renewalPeriod = 60; // can't easily make this a command line option since it would have to be saved
public static void ScheduleRenewal(Target target)
{
EnsureTaskScheduler();
var renewals = settings.LoadRenewals();
foreach (var existing in from r in renewals.ToArray() where r.Binding.Host == target.Host select r)
{
Console.WriteLine($" Removing existing scheduled renewal {existing}");
Log.Information("Removing existing scheduled renewal {existing}", existing);
renewals.Remove(existing);
}
var result = new ScheduledRenewal() { Binding = target, CentralSSL = Options.CentralSSLStore, SAN = Options.SAN.ToString(), Date = DateTime.UtcNow.AddDays(renewalPeriod) };
renewals.Add(result);
settings.SaveRenewals(renewals);
Console.WriteLine($" Renewal Scheduled {result}");
Log.Information("Renewal Scheduled {result}", result);
}
开发者ID:knives-out,项目名称:letsencrypt-win-simple,代码行数:22,代码来源:Program.cs
示例15: GetCertificate
public static string GetCertificate(Target binding)
{
var dnsIdentifier = binding.Host;
var SANList = binding.AlternativeNames;
List<string> allDnsIdentifiers = new List<string>();
if (!Options.SAN)
{
allDnsIdentifiers.Add(binding.Host);
}
if (binding.AlternativeNames != null)
{
allDnsIdentifiers.AddRange(binding.AlternativeNames);
}
var cp = CertificateProvider.GetProvider();
var rsaPkp = new RsaPrivateKeyParams();
try
{
if (Properties.Settings.Default.RSAKeyBits >= 1024)
{
rsaPkp.NumBits = Properties.Settings.Default.RSAKeyBits;
Log.Debug("RSAKeyBits: {RSAKeyBits}", Properties.Settings.Default.RSAKeyBits);
}
else
{
Log.Warning("RSA Key Bits less than 1024 is not secure. Letting ACMESharp default key bits. http://openssl.org/docs/manmaster/crypto/RSA_generate_key_ex.html");
}
}
catch (Exception ex)
{
Log.Warning("Unable to set RSA Key Bits, Letting ACMESharp default key bits, Error: {@ex}", ex);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"Unable to set RSA Key Bits, Letting ACMESharp default key bits, Error: {ex.Message.ToString()}");
Console.ResetColor();
}
var rsaKeys = cp.GeneratePrivateKey(rsaPkp);
var csrDetails = new CsrDetails
{
CommonName = dnsIdentifier,
};
if(SANList != null)
{
if (SANList.Count > 0)
{
csrDetails.AlternativeNames = SANList;
}
}
var csrParams = new CsrParams
{
Details = csrDetails,
};
var csr = cp.GenerateCsr(csrParams, rsaKeys, Crt.MessageDigest.SHA256);
byte[] derRaw;
using (var bs = new MemoryStream())
{
cp.ExportCsr(csr, EncodingFormat.DER, bs);
derRaw = bs.ToArray();
}
var derB64u = JwsHelper.Base64UrlEncode(derRaw);
Console.WriteLine($"\nRequesting Certificate");
Log.Information("Requesting Certificate");
var certRequ = client.RequestCertificate(derB64u);
Log.Debug("certRequ {@certRequ}", certRequ);
Console.WriteLine($" Request Status: {certRequ.StatusCode}");
Log.Information("Request Status: {StatusCode}", certRequ.StatusCode);
if (certRequ.StatusCode == System.Net.HttpStatusCode.Created)
{
var keyGenFile = Path.Combine(certificatePath, $"{dnsIdentifier}-gen-key.json");
var keyPemFile = Path.Combine(certificatePath, $"{dnsIdentifier}-key.pem");
var csrGenFile = Path.Combine(certificatePath, $"{dnsIdentifier}-gen-csr.json");
var csrPemFile = Path.Combine(certificatePath, $"{dnsIdentifier}-csr.pem");
var crtDerFile = Path.Combine(certificatePath, $"{dnsIdentifier}-crt.der");
var crtPemFile = Path.Combine(certificatePath, $"{dnsIdentifier}-crt.pem");
string crtPfxFile = null;
if (!CentralSSL)
{
crtPfxFile = Path.Combine(certificatePath, $"{dnsIdentifier}-all.pfx");
}
else
{
crtPfxFile = Path.Combine(Options.CentralSSLStore, $"{dnsIdentifier}.pfx");
}
using (var fs = new FileStream(keyGenFile, FileMode.Create))
cp.SavePrivateKey(rsaKeys, fs);
using (var fs = new FileStream(keyPemFile, FileMode.Create))
cp.ExportPrivateKey(rsaKeys, EncodingFormat.PEM, fs);
using (var fs = new FileStream(csrGenFile, FileMode.Create))
cp.SaveCsr(csr, fs);
using (var fs = new FileStream(csrPemFile, FileMode.Create))
cp.ExportCsr(csr, EncodingFormat.PEM, fs);
//.........这里部分代码省略.........
开发者ID:knives-out,项目名称:letsencrypt-win-simple,代码行数:101,代码来源:Program.cs
示例16: InstallCertificate
public static void InstallCertificate(Target binding, string pfxFilename, out X509Store store, out X509Certificate2 certificate)
{
try
{
store = new X509Store("WebHosting", StoreLocation.LocalMachine);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
}
catch (CryptographicException)
{
store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
}
Console.WriteLine($" Opened Certificate Store \"{store.Name}\"");
Log.Information("Opened Certificate Store {Name}", store.Name);
certificate = null;
try
{
// See http://paulstovell.com/blog/x509certificate2
certificate = new X509Certificate2(pfxFilename, Properties.Settings.Default.PFXPassword, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
certificate.FriendlyName = $"{binding.Host} {DateTime.Now.ToString(Properties.Settings.Default.FileDateFormat)}";
Log.Debug("{FriendlyName}", certificate.FriendlyName);
Console.WriteLine($" Adding Certificate to Store");
Log.Information("Adding Certificate to Store");
store.Add(certificate);
Console.WriteLine($" Closing Certificate Store");
Log.Information("Closing Certificate Store");
}
catch (Exception ex)
{
Log.Error("Error saving certificate {@ex}", ex);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Error saving certificate: {ex.Message.ToString()}");
Console.ResetColor();
}
store.Close();
}
开发者ID:knives-out,项目名称:letsencrypt-win-simple,代码行数:41,代码来源:Program.cs
示例17: Auto
public static void Auto(Target binding)
{
var auth = Authorize(binding);
if (auth.Status == "valid")
{
var pfxFilename = GetCertificate(binding);
if (Options.Test && !Options.Renew)
{
Console.WriteLine($"\nDo you want to install the .pfx into the Certificate Store/ Central SSL Store? (Y/N) ");
if (!PromptYesNo())
return;
}
X509Store store;
X509Certificate2 certificate;
if (!CentralSSL)
{
Log.Information("Installing Non-Central SSL Certificate in the certificate store");
InstallCertificate(binding, pfxFilename, out store, out certificate);
if (Options.Test && !Options.Renew)
{
Console.WriteLine($"\nDo you want to add/update the certificate to your server software? (Y/N) ");
if (!PromptYesNo())
return;
}
Log.Information("Installing Non-Central SSL Certificate in server software");
binding.Plugin.Install(binding, pfxFilename, store, certificate);
}
else if (!Options.Renew)
{
//If it is using centralized SSL and renewing, it doesn't need to change the
//binding since just the certificate needs to be updated at the central ssl path
Log.Information("Updating new Central SSL Certificate");
binding.Plugin.Install(binding);
}
if (Options.Test && !Options.Renew)
{
Console.WriteLine($"\nDo you want to automatically renew this certificate in 60 days? This will add a task scheduler task. (Y/N) ");
if (!PromptYesNo())
return;
}
if (!Options.Renew)
{
Log.Information("Adding renewal for {binding}", binding);
ScheduleRenewal(binding);
}
}
}
开发者ID:knives-out,项目名称:letsencrypt-win-simple,代码行数:51,代码来源:Program.cs
示例18: Authorize
public static AuthorizationState Authorize(Target target)
{
var dnsIdentifier = target.Host;
var webRootPath = target.WebRootPath;
Console.WriteLine($"\nAuthorizing Identifier {dnsIdentifier} Using Challenge Type {AcmeProtocol.CHALLENGE_TYPE_HTTP}");
var authzState = client.AuthorizeIdentifier(dnsIdentifier);
var challenge = client.GenerateAuthorizeChallengeAnswer(authzState, AcmeProtocol.CHALLENGE_TYPE_HTTP);
var answerPath = Environment.ExpandEnvironmentVariables(Path.Combine(webRootPath, challenge.ChallengeAnswer.Key));
Console.WriteLine($" Writing challenge answer to {answerPath}");
var directory = Path.GetDirectoryName(answerPath);
Directory.CreateDirectory(directory);
File.WriteAllText(answerPath, challenge.ChallengeAnswer.Value);
target.Plugin.BeforeAuthorize(target, answerPath);
var answerUri = new Uri(new Uri("http://" + dnsIdentifier), challenge.ChallengeAnswer.Key);
Console.WriteLine($" Answer should now be browsable at {answerUri}");
try
{
Console.WriteLine(" Submitting answer");
authzState.Challenges = new AuthorizeChallenge[] { challenge };
client.SubmitAuthorizeChallengeAnswer(authzState, AcmeProtocol.CHALLENGE_TYPE_HTTP, true);
// have to loop to wait for server to stop being pending.
// TODO: put timeout/retry limit in this loop
while (authzState.Status == "pending")
{
Console.WriteLine(" Refreshing authorization");
Thread.Sleep(4000); // this has to be here to give ACME server a chance to think
var newAuthzState = client.RefreshIdentifierAuthorization(authzState);
if (newAuthzState.Status != "pending")
authzState = newAuthzState;
}
Console.WriteLine($" Authorization Result: {authzState.Status}");
if (authzState.Status == "invalid")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("\n******************************************************************************");
Console.WriteLine($"The ACME server was probably unable to reach {answerUri}");
Console.WriteLine("\nCheck in a browser to see if the answer file is being served correctly.");
target.Plugin.OnAuthorizeFail(target);
Console.WriteLine("\n******************************************************************************");
Console.ResetColor();
}
//if (authzState.Status == "valid")
//{
// var authPath = Path.Combine(configPath, dnsIdentifier + ".auth");
// Console.WriteLine($" Saving authorization record to: {authPath}");
// using (var authStream = File.Create(authPath))
// authzState.Save(authStream);
//}
return authzState;
}
finally
{
if (authzState.Status == "valid")
{
Console.WriteLine(" Deleting answer");
File.Delete(answerPath);
}
}
}
开发者ID:cylon,项目名称:letsencrypt-win-simple,代码行数:71,代码来源:Program.cs
示例19: Install
public override void Install(Target target, string pfxFilename, X509Store store, X509Certificate2 certificate)
{
// TODO: make a system where they can execute a program/batch file to update whatever they need after install.
Console.WriteLine(" WARNING: Unable to configure server software.");
}
开发者ID:MartijnRasenberg,项目名称:letsencrypt-win-simple,代码行数:5,代码来源:ManualPlugin.cs
示例20: GetSite
private Site GetSite(Target target, ServerManager iisManager)
{
foreach (var site in iisManager.Sites)
{
if (site.Id == target.SiteId)
return site;
}
Log.Error("Unable to find IIS site ID # {SiteId} for binding {this}", target.SiteId, this);
throw new System.Exception($"Unable to find IIS site ID #{target.SiteId} for binding {this}");
}
开发者ID:Trapulo,项目名称:letsencrypt-win-simple,代码行数:10,代码来源:IISPlugin.cs
注:本文中的LetsEncrypt.ACME.Simple.Target类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论