反代模式停用自动证书签发续期并完善初始化提示与测试
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-06 13:27:06 +08:00
1 parent 7ffb1e751d
commit 369f502c10
20 files changed
+599 -56

No files matched your search

+8 -3
View File
@@ -125,6 +125,7 @@ export function usePage() {
const port = ref(80)
const sslRuntime = ref({})
const proxyHTTPS = computed(() => sslRuntime.value.tlsMode === 'proxy')
const addDomain = () => {
domainSettings.multi_domain.push([])
@@ -350,7 +351,7 @@ export function usePage() {
const getSSLConfig = () => {
return setupRequest({"action": "get", "step": "ssl"}).then((res) => {
assertSetupSuccess(res)
sslSettings.type = res.data.type
sslSettings.type = res.data.tlsMode === 'proxy' ? '1' : res.data.type
if (sslSettings.type === "2") {
sslSettings.type = "0"
sslSettings.challenge = "dns"
@@ -370,7 +371,7 @@ export function usePage() {
const setSSLConfig = () => {
fullscreenLoading.value = true;
let sslType = sslSettings.type;
let sslType = proxyHTTPS.value ? '1' : sslSettings.type;
if (sslType === "0" && sslSettings.challenge === "dns") {
sslType = "2"
}
@@ -610,6 +611,9 @@ export function usePage() {
}
const handleSSLTypeChange = () => {
if (proxyHTTPS.value) {
sslSettings.type = '1'
}
if (dnsChecking.value) {
resetDNSChallenge()
}
@@ -619,7 +623,7 @@ export function usePage() {
}
const handleSSLChallengeChange = (challenge) => {
if (fullscreenLoading.value) {
if (fullscreenLoading.value || proxyHTTPS.value) {
return
}
@@ -722,6 +726,7 @@ export function usePage() {
dnsChecking,
dnsChallengeNotice,
port,
proxyHTTPS,
dnsInfos,
hasDNSIPv6,
addDomain,
+9 -5
View File
@@ -278,7 +278,7 @@
<div class="desc">
<div class="ssl-title-row">
<h2>{{ lang.setSSL }}</h2>
<div v-if="sslSettings.type === '0' && sslSettings.challenge === 'http' && port !== 80"
<div v-if="!proxyHTTPS && sslSettings.type === '0' && sslSettings.challenge === 'http' && port !== 80"
class="ssl-port-warning" role="alert">
<strong>{{ lang.warning }}</strong>
<span>{{ lang.autoSSLWarn }}</span>
@@ -287,16 +287,19 @@
<div class="ssl-title-description">{{ lang.setSSL }}</div>
</div>
<div class="form ssl-form">
<p v-if="proxyHTTPS" class="ssl-manual-desc" role="note">
HTTPS 证书的申请和续期由反向代理负责,Smail 不再自动处理。SMTP、IMAP、POP3 仍需本地证书,请导入由外部维护的证书与私钥;外部续期后也需重新导入并应用。
</p>
<el-form label-position="top">
<el-form-item :label="lang.type">
<el-select class="ssl-type-select" :placeholder="lang.ssl_auto" v-model="sslSettings.type"
<el-select class="ssl-type-select" :placeholder="proxyHTTPS ? lang.ssl_manuallyf : lang.ssl_auto" v-model="sslSettings.type"
:disabled="fullscreenLoading" @change="handleSSLTypeChange">
<el-option :label="lang.ssl_auto" value="0"/>
<el-option v-if="!proxyHTTPS" :label="lang.ssl_auto" value="0"/>
<el-option :label="lang.ssl_manuallyf" value="1"/>
</el-select>
</el-form-item>
<el-form-item :label="lang.ssl_challenge_type" v-if="sslSettings.type === '0'">
<el-form-item :label="lang.ssl_challenge_type" v-if="!proxyHTTPS && sslSettings.type === '0'">
<div class="ssl-challenge-select-row">
<el-select class="ssl-type-select" :placeholder="lang.ssl_challenge_type" v-model="sslSettings.challenge"
:disabled="fullscreenLoading" @change="handleSSLChallengeChange">
@@ -311,7 +314,7 @@
</div>
</el-form-item>
<div v-if="sslSettings.type === '0'" class="ssl-storage-card">
<div v-if="!proxyHTTPS && sslSettings.type === '0'" class="ssl-storage-card">
<div class="ssl-storage-title">{{ lang.ssl_auto_storage_title }}</div>
<div class="ssl-storage-desc">{{ lang.ssl_auto_storage_desc }}</div>
<div v-if="sslSettings.challenge === 'dns'" class="ssl-dns-intro">
@@ -413,6 +416,7 @@ const {
sslSettings,
dnsChecking,
port,
proxyHTTPS,
dnsChallengeNotice,
waitDesc,
next,
@@ -83,6 +83,10 @@
<span class="selected-section-label">{{ currentSection.label }}</span>
</div>
<p v-if="selectedSection === 'ssl' && status.tlsMode === 'proxy'" class="heading-note" role="note">
当前由反向代理提供 HTTPS,Smail 不自动申请或续期 SSL 证书。下方配置仅用于本地邮件服务证书;外部续期后请重新导入并应用,不能仅更新反代服务器上的证书。
</p>
<el-alert
v-if="sectionError"
:title="sectionError"
@@ -51,7 +51,7 @@ const baseGroups = [
]),
group('http', '网页访问服务', '端口和加密方式变更可能需要重启,并影响当前访问地址。', [
port('http.port', 'HTTP 端口', { hint: '填写 0 使用后端默认值。' }),
field('http.tlsMode', '加密连接方式', 'select', { options: options([['', '使用默认方式'], ['direct', '由 Smail 提供 HTTPS'], ['proxy', '由反向代理提供 HTTPS']]) }),
field('http.tlsMode', '加密连接方式', 'select', { options: options([['', '使用默认方式'], ['direct', '由 Smail 提供 HTTPS'], ['proxy', '由反向代理提供 HTTPS']]), hint: '选择反向代理后,Smail 不自动申请或续期 SSL 证书,由反代服务器负责;邮件协议仍需有效的本地证书。' }),
field('http.httpsEnabled', '启用内置 HTTPS', 'switch', { show: config => config.http?.tlsMode !== 'proxy' }),
port('http.httpsPort', 'HTTPS 端口', { show: config => config.http?.tlsMode !== 'proxy', hint: '启用内置 HTTPS 时需填写有效端口;关闭时 0 表示不使用。' }),
field('http.trustedProxyCidrs', '可信代理网段', 'list', { placeholder: '127.0.0.1/32', hint: '仅填写实际代理的 CIDR 网段,不要无条件信任所有来源。' })
@@ -42,6 +42,7 @@ export function usePage(pageKey = 'base') {
const auditError = ref('')
const status = reactive({
setupState: '',
tlsMode: '',
activeGeneration: 0,
lastValidAt: '',
pendingRestart: [],