mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 13:39:53 +00:00
commit
b28f0dc5e4
@ -6,5 +6,7 @@ services:
|
||||
ports:
|
||||
- 8090:8090
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./data:/app/pb_data
|
||||
restart: unless-stopped
|
||||
|
@ -1,7 +1,10 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -39,19 +42,58 @@ func (c *Certificate) PopulateFromX509(certX509 *x509.Certificate) *Certificate
|
||||
c.EffectAt = certX509.NotBefore
|
||||
c.ExpireAt = certX509.NotAfter
|
||||
|
||||
switch certX509.SignatureAlgorithm {
|
||||
case x509.SHA256WithRSA, x509.SHA256WithRSAPSS:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA2048
|
||||
case x509.SHA384WithRSA, x509.SHA384WithRSAPSS:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA3072
|
||||
case x509.SHA512WithRSA, x509.SHA512WithRSAPSS:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA4096
|
||||
case x509.ECDSAWithSHA256:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC256
|
||||
case x509.ECDSAWithSHA384:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC384
|
||||
case x509.ECDSAWithSHA512:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC512
|
||||
switch certX509.PublicKeyAlgorithm {
|
||||
case x509.RSA:
|
||||
{
|
||||
len := 0
|
||||
if pubkey, ok := certX509.PublicKey.(*rsa.PublicKey); ok {
|
||||
len = pubkey.N.BitLen()
|
||||
}
|
||||
|
||||
switch len {
|
||||
case 0:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmType("RSA")
|
||||
case 2048:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA2048
|
||||
case 3072:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA3072
|
||||
case 4096:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA4096
|
||||
case 8192:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA8192
|
||||
default:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmType(fmt.Sprintf("RSA%d", len))
|
||||
}
|
||||
}
|
||||
|
||||
case x509.ECDSA:
|
||||
{
|
||||
len := 0
|
||||
if pubkey, ok := certX509.PublicKey.(*ecdsa.PublicKey); ok {
|
||||
if pubkey.Curve != nil && pubkey.Curve.Params() != nil {
|
||||
len = pubkey.Curve.Params().BitSize
|
||||
}
|
||||
}
|
||||
|
||||
switch len {
|
||||
case 0:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmType("EC")
|
||||
case 256:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC256
|
||||
case 384:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC384
|
||||
case 521:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC512
|
||||
default:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmType(fmt.Sprintf("EC%d", len))
|
||||
}
|
||||
}
|
||||
|
||||
case x509.Ed25519:
|
||||
{
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmType("ED25519")
|
||||
}
|
||||
|
||||
default:
|
||||
c.KeyAlgorithm = CertificateKeyAlgorithmType("")
|
||||
}
|
||||
|
@ -62,14 +62,14 @@ type WorkflowNode struct {
|
||||
}
|
||||
|
||||
type WorkflowNodeConfigForApply struct {
|
||||
Domains string `json:"domains"` // 域名列表,以半角逗号分隔
|
||||
Domains string `json:"domains"` // 域名列表,以半角分号分隔
|
||||
ContactEmail string `json:"contactEmail"` // 联系邮箱
|
||||
ChallengeType string `json:"challengeType"` // TODO: 验证方式。目前仅支持 dns-01
|
||||
Provider string `json:"provider"` // DNS 提供商
|
||||
ProviderAccessId string `json:"providerAccessId"` // DNS 提供商授权记录 ID
|
||||
ProviderConfig map[string]any `json:"providerConfig"` // DNS 提供商额外配置
|
||||
KeyAlgorithm string `json:"keyAlgorithm"` // 密钥算法
|
||||
Nameservers string `json:"nameservers"` // DNS 服务器列表,以半角逗号分隔
|
||||
Nameservers string `json:"nameservers"` // DNS 服务器列表,以半角分号分隔
|
||||
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout"` // DNS 传播超时时间(零值取决于提供商的默认值)
|
||||
DnsTTL int32 `json:"dnsTTL"` // DNS TTL(零值取决于提供商的默认值)
|
||||
DisableFollowCNAME bool `json:"disableFollowCNAME"` // 是否关闭 CNAME 跟随
|
||||
|
@ -16,7 +16,9 @@ export type DeployNodeConfigForm1PanelConsoleConfigProps = {
|
||||
};
|
||||
|
||||
const initFormModel = (): DeployNodeConfigForm1PanelConsoleConfigFieldValues => {
|
||||
return {};
|
||||
return {
|
||||
autoRestart: true,
|
||||
};
|
||||
};
|
||||
|
||||
const DeployNodeConfigForm1PanelConsoleConfig = ({
|
||||
|
@ -16,7 +16,9 @@ export type DeployNodeConfigFormBaotaPanelConsoleConfigProps = {
|
||||
};
|
||||
|
||||
const initFormModel = (): DeployNodeConfigFormBaotaPanelConsoleConfigFieldValues => {
|
||||
return {};
|
||||
return {
|
||||
autoRestart: true,
|
||||
};
|
||||
};
|
||||
|
||||
const DeployNodeConfigFormBaotaPanelConsoleConfig = ({
|
||||
|
@ -4,7 +4,7 @@ import { version } from "@/domain/version";
|
||||
|
||||
export type UseVersionCheckerReturns = {
|
||||
hasNewVersion: boolean;
|
||||
check: () => void;
|
||||
checkNewVersion: () => void;
|
||||
};
|
||||
|
||||
const extractSemver = (vers: string) => {
|
||||
@ -48,7 +48,7 @@ const useVersionChecker = () => {
|
||||
}
|
||||
|
||||
const nIdx = releases.findIndex((e: any) => compareVersions(e.name, version) !== -1);
|
||||
if (cIdx >= nIdx) {
|
||||
if (cIdx !== -1 && cIdx <= nIdx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ const useVersionChecker = () => {
|
||||
|
||||
return {
|
||||
hasNewVersion: !!data,
|
||||
check: refresh,
|
||||
checkNewVersion: refresh,
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user