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