[release] v0.9.0-unstable7
This commit is contained in:
parent
1b22ca65fc
commit
3c9318aba0
|
@ -226,6 +226,15 @@ const HomePage = () => {
|
|||
</Alert>
|
||||
)}
|
||||
|
||||
{coStatus && coStatus.LetsEncryptErrors && coStatus.LetsEncryptErrors.length > 0 && (
|
||||
<Alert severity="error">
|
||||
There are errors with your Let's Encrypt configuration or one of your routes, please fix them as soon as possible.:
|
||||
{coStatus.LetsEncryptErrors.map((err) => {
|
||||
return <div> - {err}</div>
|
||||
})}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{coStatus && coStatus.newVersionAvailable && (
|
||||
<Alert severity="warning">
|
||||
A new version of Cosmos is available! Please update to the latest version to get the latest features and bug fixes.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.9.0-unstable6",
|
||||
"version": "0.9.0-unstable7",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
|
|
@ -61,6 +61,7 @@ func StatusRoute(w http.ResponseWriter, req *http.Request) {
|
|||
"hostname": utils.GetMainConfig().HTTPConfig.Hostname,
|
||||
"CPU": runtime.GOARCH,
|
||||
"AVX": cpu.X86.HasAVX,
|
||||
"LetsEncryptErrors": utils.LetsEncryptErrors,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
|
|
|
@ -141,10 +141,12 @@ func (u *CertUser) GetPrivateKey() crypto.PrivateKey {
|
|||
|
||||
func DoLetsEncrypt() (string, string) {
|
||||
config := GetMainConfig()
|
||||
LetsEncryptErrors = []string{}
|
||||
|
||||
privateKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
if err != nil {
|
||||
Error("LETSENCRYPT_ECDSA", err)
|
||||
LetsEncryptErrors = append(LetsEncryptErrors, err.Error())
|
||||
return "", ""
|
||||
}
|
||||
|
||||
|
@ -166,6 +168,7 @@ func DoLetsEncrypt() (string, string) {
|
|||
client, err := lego.NewClient(certConfig)
|
||||
if err != nil {
|
||||
Error("LETSENCRYPT_NEW", err)
|
||||
LetsEncryptErrors = append(LetsEncryptErrors, err.Error())
|
||||
return "", ""
|
||||
}
|
||||
|
||||
|
@ -173,6 +176,7 @@ func DoLetsEncrypt() (string, string) {
|
|||
provider, err := dns.NewDNSChallengeProviderByName(config.HTTPConfig.DNSChallengeProvider)
|
||||
if err != nil {
|
||||
Error("LETSENCRYPT_DNS", err)
|
||||
LetsEncryptErrors = append(LetsEncryptErrors, err.Error())
|
||||
return "", ""
|
||||
}
|
||||
|
||||
|
@ -182,12 +186,14 @@ func DoLetsEncrypt() (string, string) {
|
|||
err = client.Challenge.SetHTTP01Provider(http01.NewProviderServer("", config.HTTPConfig.HTTPPort))
|
||||
if err != nil {
|
||||
Error("LETSENCRYPT_HTTP01", err)
|
||||
LetsEncryptErrors = append(LetsEncryptErrors, err.Error())
|
||||
return "", ""
|
||||
}
|
||||
|
||||
err = client.Challenge.SetTLSALPN01Provider(tlsalpn01.NewProviderServer("", config.HTTPConfig.HTTPSPort))
|
||||
if err != nil {
|
||||
Error("LETSENCRYPT_TLS01", err)
|
||||
LetsEncryptErrors = append(LetsEncryptErrors, err.Error())
|
||||
return "", ""
|
||||
}
|
||||
|
||||
|
@ -195,6 +201,7 @@ func DoLetsEncrypt() (string, string) {
|
|||
reg, err := client.Registration.Register(registration.RegisterOptions{TermsOfServiceAgreed: true})
|
||||
if err != nil {
|
||||
Error("LETSENCRYPT_REGISTER", err)
|
||||
LetsEncryptErrors = append(LetsEncryptErrors, err.Error())
|
||||
return "", ""
|
||||
}
|
||||
myUser.Registration = reg
|
||||
|
@ -206,6 +213,7 @@ func DoLetsEncrypt() (string, string) {
|
|||
certificates, err := client.Certificate.Obtain(request)
|
||||
if err != nil {
|
||||
Error("LETSENCRYPT_OBTAIN", err)
|
||||
LetsEncryptErrors = append(LetsEncryptErrors, err.Error())
|
||||
return "", ""
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ var UpdateAvailable = map[string]bool{}
|
|||
|
||||
var RestartHTTPServer func()
|
||||
|
||||
var LetsEncryptErrors = []string{}
|
||||
|
||||
var DefaultConfig = Config{
|
||||
LoggingLevel: "INFO",
|
||||
NewInstall: true,
|
||||
|
|
Loading…
Reference in a new issue