fix: wildcard certificate challenge method not present

This commit is contained in:
Jacky 2024-02-14 17:40:04 +08:00
parent f727218a28
commit 97ec26331b
4 changed files with 46 additions and 4 deletions

View file

@ -123,6 +123,8 @@ func IssueCert(c *gin.Context) {
SSLCertificateKeyPath: sslCertificateKeyPath, SSLCertificateKeyPath: sslCertificateKeyPath,
AutoCert: model.AutoCertEnabled, AutoCert: model.AutoCertEnabled,
KeyType: payload.KeyType, KeyType: payload.KeyType,
ChallengeMethod: payload.ChallengeMethod,
DnsCredentialID: payload.DNSCredentialID,
}) })
if err != nil { if err != nil {

View file

@ -23,6 +23,7 @@ function open() {
step.value = 0 step.value = 0
data.value = { data.value = {
challenge_method: 'dns01', challenge_method: 'dns01',
key_type: '2048',
} as Cert } as Cert
} }
@ -45,12 +46,39 @@ const issueCert = () => {
modalVisible.value = true modalVisible.value = true
refObtainCertLive.value.issue_cert(computedDomain.value, refObtainCertLive.value.issue_cert(computedDomain.value,
[computedDomain.value, domain.value]) [computedDomain.value, domain.value], data.value.key_type)
.then(() => { .then(() => {
message.success($gettext('Renew successfully')) message.success($gettext('Renew successfully'))
emit('issued') emit('issued')
}) })
} }
const keyType = shallowRef([
{
key: '2048',
name: 'RSA2048',
},
{
key: '3072',
name: 'RSA3072',
},
{
key: '4096',
name: 'RSA4096',
},
{
key: '8192',
name: 'RAS8192',
},
{
key: 'P256',
name: 'EC256',
},
{
key: 'P384',
name: 'EC384',
},
])
</script> </script>
<template> <template>
@ -75,6 +103,18 @@ const issueCert = () => {
addon-before="*." addon-before="*."
/> />
</AFormItem> </AFormItem>
<AFormItem :label="$gettext('Key Type')">
<ASelect v-model:value="data.key_type">
<ASelectOption
v-for="t in keyType"
:key="t.key"
:value="t.key"
>
{{ t.name }}
</ASelectOption>
</ASelect>
</AFormItem>
</AForm> </AForm>
<div <div
v-if="step === 0" v-if="step === 0"

View file

@ -44,8 +44,8 @@ const keyType = shallowRef([
]) ])
onMounted(() => { onMounted(() => {
if (data.value.key_type === '') if (!data.value.key_type)
data.value.key_type = 'RSA2048' data.value.key_type = '2048'
}) })
</script> </script>

View file

@ -7,7 +7,7 @@ import (
func autoCertKeyType(fl val.FieldLevel) bool { func autoCertKeyType(fl val.FieldLevel) bool {
switch certcrypto.KeyType(fl.Field().String()) { switch certcrypto.KeyType(fl.Field().String()) {
case certcrypto.RSA2048, certcrypto.RSA3072, certcrypto.RSA4096, case "", certcrypto.RSA2048, certcrypto.RSA3072, certcrypto.RSA4096,
certcrypto.EC256, certcrypto.EC384: certcrypto.EC256, certcrypto.EC384:
return true return true
} }