certmagic | Automatic HTTPS for any Go program | TLS library
kandi X-RAY | certmagic Summary
kandi X-RAY | certmagic Summary
This library uses Let’s Encrypt by default, but you can use any certificate authority that conforms to the ACME specification. Known/common CAs are provided as consts in the package, for example LetsEncryptStagingCA and LetsEncryptProductionCA. The certmagic.Config struct is how you can wield the power of this fully armed and operational battle station. However, an empty/uninitialized Config is not a valid one! In time, you will learn to use the force of certmagic.NewDefault() as I have. The default Config value is called certmagic.Default. Change its fields to suit your needs, then call certmagic.NewDefault() when you need a valid Config value. In other words, certmagic.Default is a template and is not valid for use directly. You can set the default values easily, for example: certmagic.Default.Issuer = …. Similarly, to configure ACME-specific defaults, use certmagic.DefaultACME. The high-level functions in this package (HTTPS(), Listen(), ManageSync(), and ManageAsync()) use the default config exclusively. This is how most of you will interact with the package. This is suitable when all your certificates are managed the same way. However, if you need to manage certificates differently depending on their name, you will need to make your own cache and configs (keep reading). Although not strictly required, this is highly recommended best practice. It allows you to receive expiration emails if your certificates are expiring for some reason, and also allows the CA’s engineers to potentially get in touch with you if something is wrong. I recommend setting certmagic.DefaultACME.Email or always setting the Email field of a new Config struct. To avoid firehosing the CA’s servers, CertMagic has built-in rate limiting. Currently, its default limit is up to 10 transactions (obtain or renew) every 1 minute (sliding window). This can be changed by setting the RateLimitEvents and RateLimitEventsWindow variables, if desired. The CA may still enforce their own rate limits, and there’s nothing (well, nothing ethical) CertMagic can do to bypass them for you. Additionally, CertMagic will retry failed validations with exponential backoff for up to 30 days, with a reasonable maximum interval between attempts (an "attempt" means trying each enabled challenge type once).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of certmagic
certmagic Key Features
certmagic Examples and Code Snippets
Community Discussions
Trending Discussions on certmagic
QUESTION
I'm trying to setup a server using certmagic but every time I run the code I just get the below stack message, everywhere i have looked online says you just need to do certmagic.HTTPS([]string{"my-domain.com"}, router)
but there must be something missing here?
ANSWER
Answered 2021-Jun-20 at 21:13This is a known bug in certmagic which has already been fixed and merged.
You can see the details here: https://github.com/caddyserver/certmagic/pull/135
They seem to release pretty often, so can either wait a few days for the new release, or use the main branch instead of v0.14.0, meanwhile.
QUESTION
I have a simple Go webserver and I want it to use TLS certificates. I know certbot, the python application, and used it frequently so far, but I would like to pretty much automate everything. That's where I stumbled upon https://github.com/caddyserver/certmagic, which is pretty awesome. However, I cannot seem to wrap my head around using it in conjunction with a custom server struct.
...ANSWER
Answered 2020-Jun-21 at 08:26The docs here suggest to use Listen()
instead of HTTPS()
to make use of your own http.Server
values.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install certmagic
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page