bug fix - multi cert

This commit is contained in:
MHSanaei 2023-12-09 20:43:36 +03:30
parent 4db42ba409
commit 83769f963e

View File

@ -1,6 +1,7 @@
{{define "form/tlsSettings"}} {{define "form/tlsSettings"}}
<!-- tls enable --> <!-- tls enable -->
<a-form layout="inline" v-if="inbound.canEnableTls()">
<a-form v-if="inbound.canEnableTls()" layout="inline">
<a-divider style="margin:0;"></a-divider> <a-divider style="margin:0;"></a-divider>
<table width="100%" class="ant-table-tbody"> <table width="100%" class="ant-table-tbody">
<tr> <tr>
@ -26,383 +27,370 @@
</a-radio-group> </a-radio-group>
</td> </td>
</tr> </tr>
</table>
</a-form>
<!-- tls settings --> <!-- tls settings -->
<a-form v-if="inbound.tls" layout="inline"> <template v-if="inbound.stream.isTls">
<table width="100%" class="ant-table-tbody"> <tr>
<tr> <td>SNI</td>
<td> <td>
<span>CipherSuites</span> <a-form-item placeholder="Server Name Indication">
</td> <a-input v-model.trim="inbound.stream.tls.sni" style="width: 250px"></a-input>
<td> </a-form-item>
<a-form-item> </td>
<a-select v-model="inbound.stream.tls.cipherSuites" style="width: 300px" </tr>
:dropdown-class-name="themeSwitcher.currentTheme"> <tr>
<a-select-option value="">auto</a-select-option> <td>CipherSuites</td>
<a-select-option v-for="key,value in TLS_CIPHER_OPTION" :value="key">[[ value <td>
]]</a-select-option> <a-form-item>
</a-select> <a-select v-model="inbound.stream.tls.cipherSuites" style="width: 250px"
</a-form-item>
</td>
</tr>
<tr>
<td>
<span>Min/Max Version</span>
</td>
<td>
<a-form-item>
<a-input-group compact>
<a-select style="width: 60px" v-model="inbound.stream.tls.minVersion"
:dropdown-class-name="themeSwitcher.currentTheme"> :dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option v-for="key in TLS_VERSION_OPTION" :value="key">[[ key ]]</a-select-option> <a-select-option value="">auto</a-select-option>
<a-select-option v-for="key,value in TLS_CIPHER_OPTION"
:value="key">[[ value]]</a-select-option>
</a-select> </a-select>
<a-select style="width: 60px" v-model="inbound.stream.tls.maxVersion" </a-form-item>
</td>
</tr>
<tr>
<td>Min/Max Version</td>
<td>
<a-form-item>
<a-input-group compact>
<a-select style="width: 125px" v-model="inbound.stream.tls.minVersion"
:dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option v-for="key in TLS_VERSION_OPTION"
:value="key">[[ key ]]</a-select-option>
</a-select>
<a-select style="width: 125px" v-model="inbound.stream.tls.maxVersion"
:dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option v-for="key in TLS_VERSION_OPTION"
:value="key">[[ key ]]</a-select-option>
</a-select>
</a-input-group>
</a-form-item>
</td>
</tr>
<tr>
<td>uTLS</td>
<td>
<a-form-item>
<a-select v-model="inbound.stream.tls.settings.fingerprint" style="width: 250px"
:dropdown-class-name="themeSwitcher.currentTheme"> :dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option v-for="key in TLS_VERSION_OPTION" :value="key">[[ key ]]</a-select-option> <a-select-option value=''>None</a-select-option>
<a-select-option v-for="key in UTLS_FINGERPRINT"
:value="key">[[ key ]]</a-select-option>
</a-select> </a-select>
</a-input-group> </a-form-item>
</a-form-item> </td>
</td> </tr>
</tr> <tr>
<tr> <td>ALPN</td>
<td> <td>
<span>SNI</span> <a-form-item>
</td> <a-select mode="multiple" style="width: 250px"
<td> :dropdown-class-name="themeSwitcher.currentTheme"
<a-form-item> v-model="inbound.stream.tls.alpn">
<a-input v-model.trim="inbound.stream.tls.server" style="width: 250px"></a-input> <a-select-option v-for="alpn in ALPN_OPTION"
</a-form-item> :value="alpn">[[ alpn ]]</a-select-option>
</td> </a-select>
</tr> </a-form-item>
<tr> </td>
<td> </tr>
<span>uTLS</span> <tr>
</td> <td>Allow insecure</td>
<td> <td>
<a-form-item> <a-form-item>
<a-select v-model="inbound.stream.tls.settings.fingerprint" style="width: 170px" <a-switch v-model="inbound.stream.tls.settings.allowInsecure"></a-switch>
:dropdown-class-name="themeSwitcher.currentTheme"> </a-form-item>
<a-select-option value=''>None</a-select-option> </td>
<a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option> </tr>
</a-select> <tr>
</a-form-item> <td>Reject Unknown SNI</td>
</td> <td>
</tr> <a-form-item>
<tr> <a-switch v-model="inbound.stream.tls.rejectUnknownSni"></a-switch>
<td> </a-form-item>
<span>Alpn</span> </td>
</td> </tr>
<td> <template v-for="cert,index in inbound.stream.tls.certs">
<a-form-item> <tr>
<a-select mode="multiple" style="width: 250px" :dropdown-class-name="themeSwitcher.currentTheme" <td>{{ i18n "certificate" }}</td>
v-model="inbound.stream.tls.alpn"> <td>
<a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option> <a-form-item>
</a-select> <a-radio-group v-model="cert.useFile" button-style="solid">
</a-form-item> <a-radio-button
</td> :value="true">{{ i18n "pages.inbounds.certificatePath"}}
</tr> </a-radio-button>
<tr> <a-radio-button
<td> :value="false">{{ i18n "pages.inbounds.certificateContent"}}
<span>Allow insecure</span> </a-radio-button>
</td> </a-radio-group>
<td> <a-button v-if="index === 0" type="primary" size="small"
<a-form-item> @click="inbound.stream.tls.addCert()" style="margin-left: 10px">+</a-button>
<a-switch v-model="inbound.stream.tls.settings.allowInsecure"></a-switch> <a-button v-if="inbound.stream.tls.certs.length>1" type="primary" size="small"
</a-form-item> @click="inbound.stream.tls.removeCert(index)" style="margin-left: 10px">-</a-button>
</td> </a-form-item>
</tr> </td>
<tr> </tr>
<td> <template v-if="cert.useFile">
<span>Reject Unknown SNI</span> <tr>
</td> <td>{{ i18n "pages.inbounds.publicKeyPath" }}</td>
<td> <td>
<a-form-item> <a-form-item>
<a-switch v-model="inbound.stream.tls.rejectUnknownSni"></a-switch> <a-input v-model.trim="cert.certFile" style="width:250px;"></a-input>
</a-form-item> </a-form-item>
</td> </td>
</tr> </tr>
<tr v-for="cert,index in inbound.stream.tls.certs"> <tr>
<td> <td>{{ i18n "pages.inbounds.keyPath" }}</td>
<span>{{ i18n "certificate" }}</span> <td>
</td> <a-form-item>
<td> <a-input v-model.trim="cert.keyFile" style="width:250px;"></a-input>
<a-form-item> </a-form-item>
<a-radio-group v-model="cert.useFile" button-style="solid"> </td>
<a-radio-button :value="true">{{ i18n "pages.inbounds.certificatePath" }}</a-radio-button> </tr>
<a-radio-button :value="false">{{ i18n "pages.inbounds.certificateContent" }}</a-radio-button> <tr>
</a-radio-group> <td></td>
<a-button v-if="index === 0" type="primary" size="small" @click="inbound.stream.tls.addCert()" <td>
style="margin-left: 10px">+</a-button> <a-button type="primary" icon="import" @click="setDefaultCertData(index)">
<a-button v-if="inbound.stream.tls.certs.length>1" type="primary" size="small" {{ i18n "pages.inbounds.setDefaultCert" }}
@click="inbound.stream.tls.removeCert(index)" style="margin-left: 10px">-</a-button> </a-button>
</a-form-item> </td>
</td> </tr>
</tr> </template>
<tr v-for="cert,index in inbound.stream.tls.certs" v-if="cert.useFile"> <template v-else>
<td> <tr>
<span>{{ i18n "pages.inbounds.publicKeyPath" }}</span> <td>{{ i18n "pages.inbounds.publicKeyContent" }}</td>
</td> <td>
<td> <a-form-item>
<a-form-item> <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.cert"></a-input>
<a-input v-model.trim="cert.certFile" style="width:300px;"></a-input> </a-form-item>
</a-form-item> </td>
</td> </tr>
</tr> <tr>
<tr v-for="cert,index in inbound.stream.tls.certs" v-if="cert.useFile"> <td>{{ i18n "pages.inbounds.keyContent" }}</td>
<td> <td>
<span>{{ i18n "pages.inbounds.keyPath" }}</span> <a-form-item>
</td> <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.key"></a-input>
<td> </a-form-item>
<a-form-item> </td>
<a-input v-model.trim="cert.keyFile" style="width:300px;"></a-input> </tr>
</a-form-item> </template>
</td> <tr>
</tr> <td>ocspStapling</td>
<tr v-for="cert,index in inbound.stream.tls.certs" v-if="cert.useFile"> <td>
<td> <a-form-item>
<a-button type="primary" icon="import" @click="setDefaultCertData(index)">{{ i18n <a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
"pages.inbounds.setDefaultCert" }}</a-button> </a-form-item>
</td> </td>
</tr> </tr>
<tr v-for="cert,index in inbound.stream.tls.certs" v-else> </template>
<td> </template>
<span>{{ i18n "pages.inbounds.publicKeyContent" }}</span>
</td>
<td>
<a-form-item>
<a-input type="textarea" :rows="3" style="width:300px;" v-model="cert.cert"></a-input>
</a-form-item>
</td>
</tr>
<tr v-for="cert,index in inbound.stream.tls.certs" v-else>
<td>
<span>{{ i18n "pages.inbounds.keyContent" }}</span>
</td>
<td>
<a-form-item>
<a-input type="textarea" :rows="3" style="width:300px;" v-model="cert.key"></a-input>
</a-form-item>
</td>
</tr>
<tr v-for="cert,index in inbound.stream.tls.certs">
<td>
<span>ocspStapling</span>
</td>
<td>
<a-form-item>
<a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
</a-form-item>
</td>
</tr>
</table>
</a-form>
<!-- xtls settings --> <!-- xtls settings -->
<a-form v-else-if="inbound.xtls" layout="inline"> <template v-else-if="inbound.xtls">
<table width="100%" class="ant-table-tbody"> <tr>
<tr> <td>
<td> <span>SNI</span>
<span>SNI</span> </td>
</td> <td>
<td> <a-form-item>
<a-form-item> <a-input v-model.trim="inbound.stream.xtls.server" style="width: 250px"></a-input>
<a-input v-model.trim="inbound.stream.xtls.server" style="width: 250px"></a-input> </a-form-item>
</a-form-item> </td>
</td> </tr>
</tr> <tr>
<tr> <td>
<td> <span>Alpn</span>
<span>Alpn</span> </td>
</td> <td>
<td> <a-form-item>
<a-form-item> <a-select mode="multiple" style="width: 250px" :dropdown-class-name="themeSwitcher.currentTheme"
<a-select mode="multiple" style="width: 250px" :dropdown-class-name="themeSwitcher.currentTheme" v-model="inbound.stream.xtls.alpn">
v-model="inbound.stream.xtls.alpn"> <a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
<a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option> </a-select>
</a-select> </a-form-item>
</a-form-item> </td>
</td> </tr>
</tr> <tr>
<tr> <td>
<td> <span>Allow insecure</span>
<span>Allow insecure</span> </td>
</td> <td>
<td> <a-form-item>
<a-form-item> <a-switch v-model="inbound.stream.xtls.settings.allowInsecure"></a-switch>
<a-switch v-model="inbound.stream.xtls.settings.allowInsecure"></a-switch> </a-form-item>
</a-form-item> </td>
</td> </tr>
</tr> <template v-for="cert,index in inbound.stream.xtls.certs">
<tr v-for="cert,index in inbound.stream.xtls.certs"> <tr>
<td> <td>{{ i18n "certificate" }}</td>
<span>{{ i18n "certificate" }}</span> <td>
</td> <a-form-item>
<td> <a-radio-group v-model="cert.useFile" button-style="solid">
<a-form-item> <a-radio-button :value="true">{{ i18n "pages.inbounds.certificatePath"
<a-radio-group v-model="cert.useFile" button-style="solid"> }}</a-radio-button>
<a-radio-button :value="true">{{ i18n "pages.inbounds.certificatePath" }}</a-radio-button> <a-radio-button :value="false">{{ i18n "pages.inbounds.certificateContent"
<a-radio-button :value="false">{{ i18n "pages.inbounds.certificateContent" }}</a-radio-button> }}</a-radio-button>
</a-radio-group> </a-radio-group>
<a-button v-if="index === 0" type="primary" size="small" @click="inbound.stream.xtls.addCert()" <a-button v-if="index === 0" type="primary" size="small"
style="margin-left: 10px">+</a-button> @click="inbound.stream.xtls.addCert()" style="margin-left: 10px">+</a-button>
<a-button v-if="inbound.stream.xtls.certs.length>1" type="primary" size="small" <a-button v-if="inbound.stream.xtls.certs.length>1" type="primary" size="small"
@click="inbound.stream.xtls.removeCert(index)" style="margin-left: 10px">-</a-button> @click="inbound.stream.xtls.removeCert(index)" style="margin-left: 10px">-</a-button>
</a-form-item> </a-form-item>
</td> </td>
</tr> </tr>
<tr v-for="cert,index in inbound.stream.xtls.certs" v-if="cert.useFile"> <template v-if="cert.useFile">
<td> <tr>
<span>{{ i18n "pages.inbounds.publicKeyPath" }}</span> <td>{{ i18n "pages.inbounds.publicKeyPath" }}</td>
</td> <td>
<td> <a-form-item>
<a-form-item> <a-input v-model.trim="cert.certFile" style="width:250px;"></a-input>
<a-input v-model.trim="cert.certFile" style="width:300px;"></a-input> </a-form-item>
</a-form-item> </td>
</td> </tr>
</tr> <tr>
<tr v-for="cert,index in inbound.stream.xtls.certs" v-if="cert.useFile"> <td>{{ i18n "pages.inbounds.keyPath" }}</td>
<td> <td>
<span>{{ i18n "pages.inbounds.keyPath" }}</span> <a-form-item>
</td> <a-input v-model.trim="cert.keyFile" style="width:250px;"></a-input>
<td> </a-form-item>
<a-form-item> </td>
<a-input v-model.trim="cert.keyFile" style="width:300px;"></a-input> </tr>
</a-form-item> <tr>
</td> <td></td>
</tr> <td>
<tr v-for="cert,index in inbound.stream.xtls.certs" v-if="cert.useFile"> <a-button type="primary" icon="import" @click="setDefaultCertData(index)">{{ i18n
<td> "pages.inbounds.setDefaultCert" }}</a-button>
<a-button type="primary" icon="import" @click="setDefaultCertXtls(index)">{{ i18n </td>
"pages.inbounds.setDefaultCert" }}</a-button> </tr>
</td> </template>
</tr> <template v-else>
<tr v-for="cert,index in inbound.stream.xtls.certs" v-else> <tr>
<td> <td>{{ i18n "pages.inbounds.publicKeyContent" }}</td>
<span>{{ i18n "pages.inbounds.publicKeyContent" }}</span> <td>
</td> <a-form-item>
<td> <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.cert"></a-input>
<a-form-item> </a-form-item>
<a-input type="textarea" :rows="3" style="width:300px;" v-model="cert.cert"></a-input> </td>
</a-form-item> </tr>
</td> <tr>
</tr> <td>{{ i18n "pages.inbounds.keyContent" }}</td>
<tr v-for="cert,index in inbound.stream.xtls.certs" v-else> <td>
<td> <a-form-item>
<span>{{ i18n "pages.inbounds.keyContent" }}</span> <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.key"></a-input>
</td> </a-form-item>
<td> </td>
<a-form-item> </tr>
<a-input type="textarea" :rows="3" style="width:300px;" v-model="cert.key"></a-input> </template>
</a-form-item> </template>
</td> </template>
</tr>
</table>
</a-form>
<!-- reality settings --> <!-- reality settings -->
<a-form v-else-if="inbound.reality" layout="inline"> <template v-else-if="inbound.reality">
<table width="100%" class="ant-table-tbody"> <tr>
<tr> <td>
<td> <span>Show</span>
<span>Show</span> </td>
</td> <td>
<td> <a-form-item>
<a-form-item> <a-switch v-model="inbound.stream.reality.show"></a-switch>
<a-switch v-model="inbound.stream.reality.show"></a-switch> </a-form-item>
</a-form-item> </td>
</td> </tr>
</tr> <tr>
<tr> <td>
<td> <span>xVer</span>
<span>xVer</span> </td>
</td> <td>
<td> <a-form-item>
<a-form-item> <a-input-number v-model="inbound.stream.reality.xver" :min="0"
<a-input-number v-model="inbound.stream.reality.xver" :min="0" style="width: 60px"></a-input-number> style="width: 60px"></a-input-number>
</a-form-item> </a-form-item>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<span>uTLS</span> <span>uTLS</span>
</td> </td>
<td> <td>
<a-form-item> <a-form-item>
<a-select v-model="inbound.stream.reality.settings.fingerprint" style="width: 135px" <a-select v-model="inbound.stream.reality.settings.fingerprint" style="width: 135px"
:dropdown-class-name="themeSwitcher.currentTheme"> :dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option> <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<span>Dest</span> <span>Dest</span>
</td> </td>
<td> <td>
<a-form-item> <a-form-item>
<a-input v-model.trim="inbound.stream.reality.dest" style="width: 300px"></a-input> <a-input v-model.trim="inbound.stream.reality.dest" style="width: 300px"></a-input>
</a-form-item> </a-form-item>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<span>Server Names</span> <span>Server Names</span>
</td> </td>
<td> <td>
<a-form-item> <a-form-item>
<a-input v-model.trim="inbound.stream.reality.serverNames" style="width: 300px"></a-input> <a-input v-model.trim="inbound.stream.reality.serverNames" style="width: 300px"></a-input>
</a-form-item> </a-form-item>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<span>ShortIds</span> <a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortId()" type="sync"> </a-icon> <span>ShortIds</span> <a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortId()"
</td> type="sync"> </a-icon>
<td> </td>
<a-form-item> <td>
<a-form-item>
<a-input v-model.trim="inbound.stream.reality.shortIds" style="width: 150px;"></a-input>
</a-form-item> <a-input v-model.trim="inbound.stream.reality.shortIds" style="width: 150px;"></a-input>
</td> </a-form-item>
</tr> </td>
<tr> </tr>
<td> <tr>
<span>SpiderX</span> <td>
</td> <span>SpiderX</span>
<td> </td>
<a-form-item> <td>
<a-input v-model.trim="inbound.stream.reality.settings.spiderX" style="width: 150px;"></a-input> <a-form-item>
</a-form-item> <a-input v-model.trim="inbound.stream.reality.settings.spiderX" style="width: 150px;"></a-input>
</td> </a-form-item>
</tr> </td>
<tr> </tr>
<td> <tr>
<span>Private Key</span> <td>
</td> <span>Private Key</span>
<td> </td>
<a-form-item> <td>
<a-input v-model.trim="inbound.stream.reality.privateKey" style="width: 300px"></a-input> <a-form-item>
</a-form-item> <a-input v-model.trim="inbound.stream.reality.privateKey" style="width: 300px"></a-input>
</td> </a-form-item>
</tr> </td>
<tr> </tr>
<td> <tr>
<span>Public Key</span> <td>
</td> <span>Public Key</span>
<td> </td>
<a-form-item> <td>
<a-input v-model.trim="inbound.stream.reality.settings.publicKey" style="width: 300px"></a-input> <a-form-item>
</a-form-item> <a-input v-model.trim="inbound.stream.reality.settings.publicKey"
</td> style="width: 300px"></a-input>
</tr> </a-form-item>
<tr> </td>
<td colspan="2"> </tr>
<a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Key</a-button> <tr>
</td> <td colspan="2">
</tr> <a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Key</a-button>
</td>
</tr>
</template>
</table> </table>
</a-form> </a-form>
{{end}} {{end}}