![]() |
VOOZH | about |
dotnet add package sparrow-cert --version 1.1.45
NuGet\Install-Package sparrow-cert -Version 1.1.45
<PackageReference Include="sparrow-cert" Version="1.1.45" />
<PackageVersion Include="sparrow-cert" Version="1.1.45" />Directory.Packages.props
<PackageReference Include="sparrow-cert" />Project file
paket add sparrow-cert --version 1.1.45
#r "nuget: sparrow-cert, 1.1.45"
#:package sparrow-cert@1.1.45
#addin nuget:?package=sparrow-cert&version=1.1.45Install as a Cake Addin
#tool nuget:?package=sparrow-cert&version=1.1.45Install as a Cake Tool
SparrowCert is a simple certificate renewal library for Kestrel-based services. It can be used in any .NET Core-based web service. The service automatically renews certificates, eliminating the need to worry about certificate expiry. It uses the Let's Encrypt ACME protocol to issue and renew certificates and is tested with Kubernetes and Nginx Proxy Manager.
dotnet build to build the projectdotnet run to start the serviceThe service is configured through a cert.json file. Here is an example configuration:
[Note] Of course, your 'cert.json' file SHOULD NOT BE in your repository.
{
"Domains": [
"www.own-domain.org",
"api.own-domain.org" // your domain name (include sub-domains, if you have)
],
"Email": "your@email.address", // your email address for Let's Encrypt account
"RenewBeforeExpiry": "30.00:00:00", // renew 30 days before expiry (default 30 days)
"RenewAfterIssued": "80.00:00:00", // renew 80 days after issued (default null, which means do nothing)
"UseStaging": true, // trying with Let's Encrypt Staging first
"CertSigningRequest": {
"CountryName": "CA", // your country code
"State": "Ontario", // your state
"Locality": "Toronto", // your city
"Organization": "Acme Inc.", // your organization name
"OrganizationUnit": "IT", // your organization unit (department)
"CommonName": "own-domain.org" // your domain name (primary domain)
},
"RenewalFailMode": 1, // 0: unhandled, 1: continue, 2: retry
"KeyAlgorithm": 1, // 0: RSA256, 1: ES256, 2: ES384, 3: ES512
"RenewalStartupDelay": "00:00:00", // delay on startup before renewing
"WithHttpProxy": false, // default false, if enabled, it will use the HTTP proxy (port:443) for ACME challenge
"HttpPort": 5080, // for NAT, customizable HTTP port (80 -> i.e. 5080)
"HttpsPort": 5443, // for NAT, customizable HTTPS port (443 -> i.e. 5443)
"CertAlias": "own-domain-host-name",
"KeyPath": "/var/sparrow-cert/keys", // where to store the new certificates (typically, with K8s Persistent Volume)
"CertPwd": "your-cert-password", // your certificate password when it is issued (or renewed)
"Notify": {
"Slack": {
"Enabled": true, // default false, discarded if not enabled
"Channels": [ "T0*******HZ" ], // your Slack channel IDs for notification (get it from Slack channel details)
"Token": "<your-slack-token>", // your Slack token, typically starts with 'xoxb-'
"Body": "\n\n\nPlease store the attachment securely, and take the necessary action accordingly.\n\n\n"
},
"Email": {
"Enabled": true, // default false, discarded if not enabled
"SenderName": "cert-bot", // your sender name
"SenderEmail": "<your@email.address>",
"Recipient": "<recipient@email.address>",
"SmtpHost": "<your-smtp-server>",
"SmtpPort": 587, // your SMTP port, typically 587
"SmtpUser": "<your-smtp-user-name>",
"SmtpPwd": "<your-smtp-password>",
"Html": false,
"Body": "\n\n\nPlease store the attachment securely, and take the necessary action accordingly.\n\n\n"
}
}
}
public static void Main(string[] args) {
....
// Load the configuration from the 'cert.json' file
var configPath = "<path to your 'cert.json' file>";
var config = CertJsonConfiguration.FromFile(configPath);
var buildArgs = SparrowCertStartup.SetConfiguration(config);
CreateWebHostBuilder(buildArgs).Build().Run();
}
private static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
....
// Use Kestrel with custom configuration
.UseKestrel(o => {
o.ListenAnyIP(args.HttpPort);
o.ListenAnyIP(args.HttpsPort, listenOptions => {
listenOptions.UseHttps(SelfSignedCertGenerator.GenerateCertificate(args.Domain));
});
})
.UseStartup<SparrowCertStartup>(); // Or, add your Startup that is inherited from SparrowCertStartup
This project is started from reviewing and trying to utilize FluffySpoon.AspNet.EncryptWeMust and Certes, ended-up refactoring quite a bit for my use cases. Kudos to the authors for the initial implementation.
All the credit for pioneering the approach goes to the authors. I just updated the code for my use cases, and hopping this useful to others.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.45 | 698 | 11/5/2025 |
| 1.1.44 | 686 | 11/10/2024 |
| 1.1.43 | 630 | 11/10/2024 |
| 1.1.42 | 626 | 11/10/2024 |
| 1.1.41 | 625 | 11/10/2024 |
| 1.1.40 | 633 | 11/10/2024 |
| 1.1.39 | 624 | 11/10/2024 |
| 1.1.38 | 631 | 11/10/2024 |
| 1.1.37 | 628 | 11/10/2024 |
| 1.1.36 | 617 | 10/21/2024 |
| 1.1.35 | 619 | 10/16/2024 |
| 1.1.34 | 689 | 8/30/2024 |
| 1.1.33 | 659 | 8/21/2024 |
| 1.1.32 | 635 | 8/20/2024 |
| 1.1.31 | 640 | 8/20/2024 |
| 1.1.30 | 643 | 8/20/2024 |
| 1.1.29 | 656 | 8/18/2024 |
| 1.1.28 | 641 | 8/18/2024 |
| 1.1.27 | 655 | 8/17/2024 |
| 1.1.26 | 649 | 8/17/2024 |