Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrianosela/sslmgr
A layer of abstraction the around acme/autocert certificate manager (Golang)
https://github.com/adrianosela/sslmgr
acme acme-client acme-dns acme-v2 autocert certificate go golang graceful graceful-shutdown https https-server server ssl ssl-certificate ssl-certificates tls tls-certificate x509 x509certificates
Last synced: about 2 months ago
JSON representation
A layer of abstraction the around acme/autocert certificate manager (Golang)
- Host: GitHub
- URL: https://github.com/adrianosela/sslmgr
- Owner: adrianosela
- License: mit
- Created: 2019-04-02T17:35:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-05T15:07:43.000Z (4 months ago)
- Last Synced: 2024-08-05T17:39:14.319Z (4 months ago)
- Topics: acme, acme-client, acme-dns, acme-v2, autocert, certificate, go, golang, graceful, graceful-shutdown, https, https-server, server, ssl, ssl-certificate, ssl-certificates, tls, tls-certificate, x509, x509certificates
- Language: Go
- Homepage:
- Size: 61.5 KB
- Stars: 26
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - sslmgr - SSL certificates made easy with a high level wrapper around acme/autocert. (Security / HTTP Clients)
- zero-alloc-awesome-go - sslmgr - SSL certificates made easy with a high level wrapper around acme/autocert. (Security / HTTP Clients)
- awesome-go-extra - sslmgr - 04-02T17:35:38Z|2019-07-27T18:49:03Z| (Security / HTTP Clients)
README
# Simple Secure Server
[![Go Report Card](https://goreportcard.com/badge/github.com/adrianosela/sslmgr)](https://goreportcard.com/report/github.com/adrianosela/sslmgr)
[![Documentation](https://godoc.org/github.com/adrianosela/sslmgr?status.svg)](https://godoc.org/github.com/adrianosela/sslmgr)
[![GitHub issues](https://img.shields.io/github/issues/adrianosela/sslmgr.svg)](https://github.com/adrianosela/sslmgr/issues)
[![license](https://img.shields.io/github/license/adrianosela/sslmgr.svg)](https://github.com/adrianosela/sslmgr/blob/master/LICENSE)
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go#security)#### Prerequisites:
* Your server must be reachable through the provided domain name, this is how LetsEncrypt verifies domain ownership and grants your server a trusted certificate
#### With Default Values:
```
ss, err := sslmgr.NewSecureServer(handler, "yourhostname.com")
if err != nil {
log.Fatal(err)
}
ss.ListenAndServe()
```**Note:** This option uses the file system as the certificate cache. If your use case does not have a persistent file system, you should provide a value for CertCache in the [ServerConfig](https://godoc.org/github.com/adrianosela/sslmgr#ServerConfig) as shown below.
#### With Optional Values:
(Using the [certcache](https://godoc.org/github.com/adrianosela/certcache) library to define a cache)
```
ss, err := sslmgr.NewServer(sslmgr.ServerConfig{
Hostnames: []string{os.Getenv("CN_FOR_CERTIFICATE")},
HTTPPort: ":80",
HTTPSPort: ":443",
Handler: h,
ServeSSLFunc: func() bool {
return strings.ToLower(os.Getenv("PROD")) == "true"
},
CertCache: certcache.NewLayered(
certcache.NewLogger(),
autocert.DirCache("."),
),
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
IdleTimeout: 25 * time.Second,
GracefulnessTimeout: 5 * time.Second,
GracefulShutdownErrHandler: func(e error) {
log.Fatal(e)
},
})
if err != nil {
log.Fatal(err)
}ss.ListenAndServe()
```