mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-09-28 16:15:17 +08:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9d926edabb | ||
|
7329603c47 | ||
|
a7c6791c1e | ||
|
96c95bb6cd | ||
|
6d3dab6798 | ||
|
b313c6fa00 | ||
|
75b138a7a8 | ||
|
641d6127ba | ||
|
2828d1038d | ||
|
cb902a6b9b | ||
|
1b066ef602 | ||
|
5e804a3483 | ||
|
6e0c0efa85 | ||
|
8f196cb4e2 | ||
|
9182ccfba2 | ||
|
39d89b8c84 | ||
|
24e30509e4 | ||
|
4f56ea49c3 | ||
|
e55b2b6f0a | ||
|
15573a6ef3 | ||
|
38b8f0b2aa | ||
|
8df34428dd | ||
|
26483533a9 | ||
|
380a8cb3fb | ||
|
fa5ced4660 | ||
|
bac497475f | ||
|
f43b413ed4 | ||
|
356e135ea1 | ||
|
e5c6533c9b | ||
|
8d92cac37d | ||
|
eb7401f6e5 | ||
|
8777501391 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
.idea/
|
||||
anylink-deploy
|
||||
anylink-deploy.tar.gz
|
||||
anylink-deploy-*
|
||||
anylink
|
||||
anylink.db
|
||||
|
||||
|
18
README.md
18
README.md
@@ -23,10 +23,10 @@ AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同
|
||||
AnyLink 基于 [ietf-openconnect](https://tools.ietf.org/html/draft-mavrogiannopoulos-openconnect-02)
|
||||
协议开发,并且借鉴了 [ocserv](http://ocserv.gitlab.io/www/index.html) 的开发思路,使其可以同时兼容 AnyConnect 客户端。
|
||||
|
||||
AnyLink 使用 TLS/DTLS 进行数据加密,因此需要 RSA 或 ECC 证书,可以通过 Let's Encrypt 和 TrustAsia 申请免费的 SSL 证书。
|
||||
AnyLink 使用 TLS/DTLS 进行数据加密,因此需要 RSA 或 ECC 证书,可以使用私有自签证书,可以通过 Let's Encrypt 和 TrustAsia 申请免费的 SSL 证书。
|
||||
|
||||
AnyLink 服务端仅在 CentOS 7、CentOS 8、Ubuntu 18.04、Ubuntu 20.04 测试通过,如需要安装在其他系统,需要服务端支持 tun/tap
|
||||
功能、ip 设置命令。
|
||||
功能、ip 设置命令、iptables命令。
|
||||
|
||||
## Screenshot
|
||||
|
||||
@@ -60,9 +60,9 @@ AnyLink 服务端仅在 CentOS 7、CentOS 8、Ubuntu 18.04、Ubuntu 20.04 测试
|
||||
|
||||
### 使用问题
|
||||
|
||||
> 对于测试环境,可以使用 vpn.test.vqilu.cn 绑定host进行测试
|
||||
> 对于测试环境,可以直接进行测试,需要客户端取消勾选【阻止不受信任的服务器(Block connections to untrusted servers)】
|
||||
>
|
||||
> 对于线上环境,必须申请安全的https证书(跟nginx使用的证书类型一致),不支持私有证书连接
|
||||
> 对于线上环境,尽量申请安全的https证书(跟nginx使用的pem证书类型一致)
|
||||
>
|
||||
> 群共享文件有相关客户端软件下载,其他版本没有测试过,不保证使用正常
|
||||
>
|
||||
@@ -74,18 +74,22 @@ AnyLink 服务端仅在 CentOS 7、CentOS 8、Ubuntu 18.04、Ubuntu 20.04 测试
|
||||
|
||||
### 自行编译安装
|
||||
|
||||
> 需要提前安装好 golang >= 1.20 和 nodejs = 16.x 和 yarn >= v1.22.x
|
||||
> 需要提前安装好 docker
|
||||
|
||||
```shell
|
||||
git clone https://github.com/bjdgyc/anylink.git
|
||||
|
||||
# 编译参考软件版本
|
||||
# docker编译 参考软件版本(不需要安装)
|
||||
# go 1.20.12
|
||||
# node v16.20.2
|
||||
# yarn 1.22.19
|
||||
|
||||
|
||||
cd anylink
|
||||
|
||||
# 编译前端
|
||||
bash build_web.sh
|
||||
# 编译 anylink-deploy 发布文件
|
||||
bash build.sh
|
||||
|
||||
# 注意使用root权限运行
|
||||
@@ -129,6 +133,7 @@ sudo ./anylink
|
||||
- [x] 流量压缩功能
|
||||
- [x] 出口 IP 自动放行
|
||||
- [x] 支持多服务的配置区分
|
||||
- [x] 支持私有自签证书
|
||||
- [ ] 基于 ipvtap 设备的桥接访问模式
|
||||
|
||||
## Config
|
||||
@@ -432,6 +437,7 @@ ipv4_end = "10.1.2.200"
|
||||
- [三方文档-男孩的天职](https://note.youdao.com/s/X4AxyWfL)
|
||||
- [三方文档-issues](https://github.com/bjdgyc/anylink/issues)
|
||||
- [三方文档-思有云](https://www.ioiox.com/archives/128.html)
|
||||
- [三方文档-啵品](https://yangpin.link/archives/1633.html)
|
||||
|
||||
## Support Client
|
||||
|
||||
|
19
build.sh
19
build.sh
@@ -7,15 +7,22 @@ ver=$(cat version)
|
||||
echo $ver
|
||||
|
||||
#前端编译 仅需要执行一次
|
||||
bash ./build_web.sh
|
||||
#bash ./build_web.sh
|
||||
|
||||
cd $cpath/server
|
||||
bash build_docker.sh
|
||||
|
||||
go build -v -o anylink
|
||||
|
||||
./anylink -v
|
||||
deploy="anylink-deploy-$ver"
|
||||
docker container rm $deploy
|
||||
docker container create --name $deploy bjdgyc/anylink:$ver
|
||||
rm -rf anylink-deploy anylink-deploy.tar.gz
|
||||
docker cp -a $deploy:/app ./anylink-deploy
|
||||
tar zcf ${deploy}.tar.gz anylink-deploy
|
||||
|
||||
|
||||
echo "anylink 编译完成,目录: $cpath/server/anylink"
|
||||
./anylink-deploy/anylink -v
|
||||
|
||||
|
||||
echo "anylink 编译完成,目录: anylink-deploy"
|
||||
ls -lh anylink-deploy
|
||||
|
||||
|
||||
|
@@ -11,8 +11,9 @@ echo $ver
|
||||
#bash ./build_web.sh
|
||||
|
||||
# docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 本地不生成镜像
|
||||
docker build -t bjdgyc/anylink:latest --no-cache --progress=plain --platform linux/amd64 \
|
||||
--build-arg CN="yes" --build-arg appVer=$ver --build-arg commitId=$(git rev-parse HEAD) -f docker/Dockerfile .
|
||||
docker build -t bjdgyc/anylink:latest --no-cache --progress=plain \
|
||||
--build-arg CN="yes" --build-arg appVer=$ver --build-arg commitId=$(git rev-parse HEAD) \
|
||||
-f docker/Dockerfile .
|
||||
|
||||
echo "docker tag latest $ver"
|
||||
docker tag bjdgyc/anylink:latest bjdgyc/anylink:$ver
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -rf web/ui server/ui
|
||||
|
||||
docker run -it --rm -v $PWD/web:/app -w /app node:16-alpine \
|
||||
sh -c "yarn install --registry=https://registry.npmmirror.com && yarn run build"
|
||||
|
||||
rm -rf server/ui
|
||||
|
||||
cp -r web/ui server/ui
|
||||
|
@@ -10,6 +10,10 @@
|
||||
|
||||
> 请使用手机安装 freeotp ,然后扫描otp二维码,生成的数字即是动态码
|
||||
|
||||
### 用户策略问题
|
||||
|
||||
> 只要有用户策略,组策略就不生效,相当于覆盖了组策略的配置
|
||||
|
||||
### 远程桌面连接
|
||||
|
||||
> 本软件已经支持远程桌面里面连接anyconnect。
|
||||
|
165
index_template/自定义首页2.html
Normal file
165
index_template/自定义首页2.html
Normal file
@@ -0,0 +1,165 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset=UTF-8">
|
||||
<title id="pageTitle">客户端下载</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: #fff;
|
||||
background-image: linear-gradient(0deg, transparent 24%, rgba(207, 207, 207, 0.2) 25%, rgba(207, 207, 207, 0.2) 26%, transparent 27%, transparent 74%, rgba(207, 207, 207, 0.2) 75%, rgba(207, 207, 207, 0.2) 76%, transparent 77%, transparent),
|
||||
linear-gradient(90deg, transparent 24%, rgba(207, 207, 207, 0.2) 25%, rgba(207, 207, 207, 0.2) 26%, transparent 27%, transparent 74%, rgba(207, 207, 207, 0.2) 75%, rgba(207, 207, 207, 0.2) 76%, transparent 77%, transparent);
|
||||
background-size: 50px 50px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
#box {
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
max-width: 550px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
font-size: 28px;
|
||||
margin: 0 0 20px 0;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #666;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.button {
|
||||
background-color: #ddd;
|
||||
text-decoration: none;
|
||||
line-height: 44px;
|
||||
padding: 9px 42px;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
-webkit-transition: background-color 0.25s ease-out 0s;
|
||||
-moz-transition: background-color 0.25s ease-out 0s;
|
||||
transition: background-color 0.25s ease-out 0s;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: #CCC;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.button:active {
|
||||
background-color: #666;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.blue {
|
||||
background-color: #007BFF;
|
||||
}
|
||||
|
||||
.deep-blue {
|
||||
background-color: #0056B3;
|
||||
}
|
||||
|
||||
.green {
|
||||
background-color: #28A745;
|
||||
}
|
||||
|
||||
.grey {
|
||||
background-color: #6C757D;
|
||||
}
|
||||
|
||||
.black {
|
||||
background-color: #343A40;
|
||||
}
|
||||
|
||||
.light-blue {
|
||||
background-color: #17A2B8;
|
||||
}
|
||||
|
||||
.dark-grey {
|
||||
background-color: #495057;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 7px 35px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="box">
|
||||
<h2 id="title">请选择对应平台下载</h2>
|
||||
<p id="windowsTab">Windows 系统</p>
|
||||
<a id="linkWindowsX86_64" class="button blue" href="#">Win X86_64</a>
|
||||
<a id="linkWindowsARM64" class="button deep-blue" href="#">Win ARM64</a>
|
||||
|
||||
<p id="mobileTab">移动端</p>
|
||||
<a id="linkAndroid" class="button green" href="#">Android</a>
|
||||
<a id="linkIphone" class="button grey" href="#" target="_blank">iPhone</a>
|
||||
|
||||
<p id="macOSTab">MacOS 系统</p>
|
||||
<a id="linkMacos" class="button black" href="#">Mac Intel</a>
|
||||
<a id="linkMacosARM64" class="button blue" href="#">Mac ARM64</a>
|
||||
|
||||
<p id="totpTab">TOTP 移动客户端</p>
|
||||
<a id="linkTotpAndroid" class="button light-blue" href="#">Android</a>
|
||||
<a id="linkTotpIphone" class="button dark-grey" href="#" target="_blank">iPhone</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const data = {
|
||||
links: {
|
||||
windowsX86_64: '/files/anyconnect-win-4.10.05111.msi',
|
||||
windowsARM64: '/files/anyconnect-win-4.10.05111.msi',
|
||||
android: '/files/CiscoSecureClientAnyConnect_v5.0.00247.apk',
|
||||
iphone: 'https://apps.apple.com/cn/app/cisco-anyconnect/id1135064690',
|
||||
macosIntel: '/files/anyconnect-macos-4.10.05111.dmg',
|
||||
macosARM64: '/files/anyconnect-macos-4.10.05111.dmg',
|
||||
totpAndroid: '/files/Authenticator_v5.10_apkpure.com.apk',
|
||||
totpIphone: 'https://apps.apple.com/cn/app/google-authenticator/id388497605',
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function () {
|
||||
document.getElementById('linkWindowsX86_64').href = data.links.windowsX86_64;
|
||||
document.getElementById('linkWindowsARM64').href = data.links.windowsARM64;
|
||||
document.getElementById('linkAndroid').href = data.links.android;
|
||||
document.getElementById('linkIphone').href = data.links.iphone;
|
||||
document.getElementById('linkMacos').href = data.links.macosIntel;
|
||||
document.getElementById('linkMacosARM64').href = data.links.macosARM64;
|
||||
document.getElementById('linkTotpAndroid').href = data.links.totpAndroid;
|
||||
document.getElementById('linkTotpIphone').href = data.links.totpIphone;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -75,6 +75,10 @@ func GroupDetail(w http.ResponseWriter, r *http.Request) {
|
||||
if len(data.Auth) == 0 {
|
||||
data.Auth["type"] = "local"
|
||||
}
|
||||
// 兼容旧数据
|
||||
if data.SplitDns == nil {
|
||||
data.SplitDns = []dbdata.ValData{}
|
||||
}
|
||||
RespSucess(w, data)
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/bjdgyc/anylink/dbdata"
|
||||
"github.com/bjdgyc/anylink/sessdata"
|
||||
"github.com/skip2/go-qrcode"
|
||||
mail "github.com/xhit/go-simple-mail/v2"
|
||||
)
|
||||
|
||||
func UserList(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -213,6 +214,7 @@ type userAccountMailData struct {
|
||||
PinCode string
|
||||
OtpImg string
|
||||
OtpImgBase64 string
|
||||
DisableOtp bool
|
||||
}
|
||||
|
||||
func userAccountMail(user *dbdata.User) error {
|
||||
@@ -264,6 +266,7 @@ func userAccountMail(user *dbdata.User) error {
|
||||
PinCode: user.PinCode,
|
||||
OtpImg: fmt.Sprintf("https://%s/otp_qr?id=%d&jwt=%s", setting.LinkAddr, user.Id, tokenString),
|
||||
OtpImgBase64: "data:image/png;base64," + otpData,
|
||||
DisableOtp: user.DisableOtp,
|
||||
}
|
||||
w := bytes.NewBufferString("")
|
||||
t, _ := template.New("auth_complete").Parse(htmlBody)
|
||||
@@ -272,5 +275,19 @@ func userAccountMail(user *dbdata.User) error {
|
||||
return err
|
||||
}
|
||||
// fmt.Println(w.String())
|
||||
return SendMail(base.Cfg.Issuer+"平台通知", user.Email, w.String())
|
||||
|
||||
var attach *mail.File
|
||||
if user.DisableOtp {
|
||||
attach = nil
|
||||
} else {
|
||||
imgData, _ := userOtpQr(user.Id, false)
|
||||
attach = &mail.File{
|
||||
MimeType: "image/png",
|
||||
Name: "userOtpQr.png",
|
||||
Data: []byte(imgData),
|
||||
Inline: true,
|
||||
}
|
||||
}
|
||||
|
||||
return SendMail(base.Cfg.Issuer, user.Email, w.String(), attach)
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ func GetJwtData(jwtToken string) (map[string]interface{}, error) {
|
||||
return claims, nil
|
||||
}
|
||||
|
||||
func SendMail(subject, to, htmlBody string) error {
|
||||
func SendMail(subject, to, htmlBody string, attach *mail.File) error {
|
||||
|
||||
dataSmtp := &dbdata.SettingSmtp{}
|
||||
err := dbdata.SettingGet(dataSmtp)
|
||||
@@ -102,6 +102,10 @@ func SendMail(subject, to, htmlBody string) error {
|
||||
AddTo(to).
|
||||
SetSubject(subject)
|
||||
|
||||
if attach != nil {
|
||||
email.Attach(attach)
|
||||
}
|
||||
|
||||
email.SetBody(mail.TextHTML, htmlBody)
|
||||
|
||||
// Call Send and pass the client
|
||||
|
@@ -111,12 +111,6 @@ func StartAdmin() {
|
||||
selectedCipherSuites = append(selectedCipherSuites, s.ID)
|
||||
}
|
||||
|
||||
if tlscert, _, err := dbdata.ParseCert(); err != nil {
|
||||
base.Fatal("证书加载失败", err)
|
||||
} else {
|
||||
dbdata.LoadCertificate(tlscert)
|
||||
}
|
||||
|
||||
// 设置tls信息
|
||||
tlsConfig := &tls.Config{
|
||||
NextProtos: []string{"http/1.1"},
|
||||
|
@@ -55,9 +55,9 @@ var configs = []config{
|
||||
{Typ: cfgInt, Name: "max_client", Usage: "最大用户连接", ValInt: 200},
|
||||
{Typ: cfgInt, Name: "max_user_client", Usage: "最大单用户连接", ValInt: 3},
|
||||
{Typ: cfgInt, Name: "cstp_keepalive", Usage: "keepalive时间(秒)", ValInt: 3},
|
||||
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 10},
|
||||
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 20},
|
||||
{Typ: cfgInt, Name: "mobile_keepalive", Usage: "移动端keepalive接检测时间(秒)", ValInt: 4},
|
||||
{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 15},
|
||||
{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 60},
|
||||
{Typ: cfgInt, Name: "mtu", Usage: "最大传输单元MTU", ValInt: 1460},
|
||||
{Typ: cfgInt, Name: "idle_timeout", Usage: "空闲链接超时时间(秒)-超时后断开链接,0关闭此功能", ValInt: 0},
|
||||
{Typ: cfgInt, Name: "session_timeout", Usage: "session过期时间(秒)-用于断线重连,0永不过期", ValInt: 3600},
|
||||
|
@@ -9,6 +9,7 @@
|
||||
<RestrictTunnelProtocols>IPSec</RestrictTunnelProtocols>
|
||||
<BypassDownloader>true</BypassDownloader>
|
||||
<AutoUpdate UserControllable="false">false</AutoUpdate>
|
||||
<LocalLanAccess UserControllable="true">true</LocalLanAccess>
|
||||
<WindowsVPNEstablishment>AllowRemoteUsers</WindowsVPNEstablishment>
|
||||
<LinuxVPNEstablishment>AllowRemoteUsers</LinuxVPNEstablishment>
|
||||
<CertEnrollmentPin>pinAllowed</CertEnrollmentPin>
|
||||
|
@@ -12,9 +12,15 @@ cert_key = "./conf/vpn_cert.key"
|
||||
files_path = "./conf/files"
|
||||
profile = "./conf/profile.xml"
|
||||
#profile name(用于区分不同服务端的配置)
|
||||
#客户端存放位置 C:\ProgramData\Cisco\Cisco Secure Client\VPN\Profile
|
||||
#客户端存放位置
|
||||
#Windows 10
|
||||
#%ProgramData%Cisco\Cisco AnyConnect Secure Mobility Client\Profile
|
||||
#Mac Os X
|
||||
#/opt/cisco/anyconnect/profile
|
||||
#Linux
|
||||
#/opt/cisco/anyconnect/profile
|
||||
profile_name = "anylink"
|
||||
#日志目录,为空写入标准输出
|
||||
#日志目录,默认为空写入标准输出
|
||||
#log_path = "./log"
|
||||
log_path = ""
|
||||
log_level = "debug"
|
||||
@@ -66,9 +72,9 @@ default_group = "one"
|
||||
|
||||
#客户端失效检测时间(秒) dpd > keepalive
|
||||
cstp_keepalive = 3
|
||||
cstp_dpd = 10
|
||||
cstp_dpd = 20
|
||||
mobile_keepalive = 4
|
||||
mobile_dpd = 15
|
||||
mobile_dpd = 60
|
||||
|
||||
# 根据实际情况修改
|
||||
#cstp_keepalive = 20
|
||||
|
@@ -10,6 +10,9 @@ db_source = "./conf/anylink.db"
|
||||
cert_file = "./conf/vpn_cert.pem"
|
||||
cert_key = "./conf/vpn_cert.key"
|
||||
files_path = "./conf/files"
|
||||
|
||||
#日志目录,默认为空写入标准输出
|
||||
#log_path = "./log"
|
||||
log_level = "debug"
|
||||
|
||||
#系统名称
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package dbdata
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/bjdgyc/anylink/base"
|
||||
@@ -121,6 +122,7 @@ func addInitData() error {
|
||||
other := &SettingOther{
|
||||
LinkAddr: "vpn.xx.com",
|
||||
Banner: "您已接入公司网络,请按照公司规定使用。\n请勿进行非工作下载及视频行为!",
|
||||
Homecode: http.StatusOK,
|
||||
Homeindex: "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。",
|
||||
AccountMail: accountMail,
|
||||
}
|
||||
@@ -172,6 +174,9 @@ func CheckErrNotFound(err error) bool {
|
||||
return err == ErrNotFound
|
||||
}
|
||||
|
||||
// base64 图片
|
||||
// 用户动态码(请妥善保存):<br/>
|
||||
// <img src="{{.OtpImgBase64}}"/><br/>
|
||||
const accountMail = `<p>您好:</p>
|
||||
<p> 您的{{.Issuer}}账号已经审核开通。</p>
|
||||
<p>
|
||||
@@ -179,12 +184,18 @@ const accountMail = `<p>您好:</p>
|
||||
用户组: <b>{{.Group}}</b> <br/>
|
||||
用户名: <b>{{.Username}}</b> <br/>
|
||||
用户PIN码: <b>{{.PinCode}}</b> <br/>
|
||||
{{if .DisableOtp}}
|
||||
<!-- nothing -->
|
||||
{{else}}
|
||||
|
||||
<!--
|
||||
用户动态码(3天后失效):<br/>
|
||||
<img src="{{.OtpImg}}"/>
|
||||
<img src="{{.OtpImg}}"/><br/>
|
||||
-->
|
||||
用户动态码(请妥善保存):<br/>
|
||||
<img src="{{.OtpImgBase64}}"/>
|
||||
<img src="cid:userOtpQr.png" alt="userOtpQr" /><br/>
|
||||
|
||||
{{end}}
|
||||
</p>
|
||||
<div>
|
||||
使用说明:
|
||||
|
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -24,11 +25,12 @@ const DsMaxLen = 20000
|
||||
|
||||
type GroupLinkAcl struct {
|
||||
// 自上而下匹配 默认 allow * *
|
||||
Action string `json:"action"` // allow、deny
|
||||
Val string `json:"val"`
|
||||
Port uint16 `json:"port"`
|
||||
IpNet *net.IPNet `json:"ip_net"`
|
||||
Note string `json:"note"`
|
||||
Action string `json:"action"` // allow、deny
|
||||
Val string `json:"val"`
|
||||
Port string `json:"port"` // 兼容单端口历史数据类型uint16
|
||||
Ports map[uint16]int8 `json:"ports"`
|
||||
IpNet *net.IPNet `json:"ip_net"`
|
||||
Note string `json:"note"`
|
||||
}
|
||||
|
||||
type ValData struct {
|
||||
@@ -161,14 +163,59 @@ func SetGroup(g *Group) error {
|
||||
return errors.New("GroupLinkAcl 错误" + err.Error())
|
||||
}
|
||||
v.IpNet = ipNet
|
||||
linkAcl = append(linkAcl, v)
|
||||
|
||||
portsStr := v.Port
|
||||
v.Port = strings.TrimSpace(portsStr)
|
||||
// switch vp := v.Port.(type) {
|
||||
// case float64:
|
||||
// portsStr = strconv.Itoa(int(vp))
|
||||
// case string:
|
||||
// portsStr = vp
|
||||
// }
|
||||
|
||||
if regexp.MustCompile(`^\d{1,5}(-\d{1,5})?(,\d{1,5}(-\d{1,5})?)*$`).MatchString(portsStr) {
|
||||
ports := map[uint16]int8{}
|
||||
for _, p := range strings.Split(portsStr, ",") {
|
||||
if p == "" {
|
||||
continue
|
||||
}
|
||||
if regexp.MustCompile(`^\d{1,5}-\d{1,5}$`).MatchString(p) {
|
||||
rp := strings.Split(p, "-")
|
||||
portfrom, err := strconv.Atoi(rp[0])
|
||||
if err != nil {
|
||||
return errors.New("端口:" + rp[0] + " 格式错误, " + err.Error())
|
||||
}
|
||||
portto, err := strconv.Atoi(rp[1])
|
||||
if err != nil {
|
||||
return errors.New("端口:" + rp[1] + " 格式错误, " + err.Error())
|
||||
}
|
||||
for i := portfrom; i <= portto; i++ {
|
||||
ports[uint16(i)] = 1
|
||||
}
|
||||
|
||||
} else {
|
||||
port, err := strconv.Atoi(p)
|
||||
if err != nil {
|
||||
return errors.New("端口:" + p + " 格式错误, " + err.Error())
|
||||
}
|
||||
ports[uint16(port)] = 1
|
||||
}
|
||||
}
|
||||
v.Ports = ports
|
||||
linkAcl = append(linkAcl, v)
|
||||
} else {
|
||||
return errors.New("端口: " + portsStr + " 格式错误,请用逗号分隔的端口,比如: 22,80,443 连续端口用-,比如:1234-5678")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
g.LinkAcl = linkAcl
|
||||
|
||||
// DNS 判断
|
||||
clientDns := []ValData{}
|
||||
for _, v := range g.ClientDns {
|
||||
v.Val = strings.TrimSpace(v.Val)
|
||||
if v.Val != "" {
|
||||
ip := net.ParseIP(v.Val)
|
||||
if ip.String() != v.Val {
|
||||
@@ -183,6 +230,20 @@ func SetGroup(g *Group) error {
|
||||
return errors.New("默认路由,必须设置一个DNS")
|
||||
}
|
||||
g.ClientDns = clientDns
|
||||
|
||||
splitDns := []ValData{}
|
||||
for _, v := range g.SplitDns {
|
||||
v.Val = strings.TrimSpace(v.Val)
|
||||
if v.Val != "" {
|
||||
ValidateDomainName(v.Val)
|
||||
if !ValidateDomainName(v.Val) {
|
||||
return errors.New("域名 错误")
|
||||
}
|
||||
splitDns = append(splitDns, v)
|
||||
}
|
||||
}
|
||||
g.SplitDns = splitDns
|
||||
|
||||
// 域名拆分隧道,不能同时填写
|
||||
g.DsIncludeDomains = strings.TrimSpace(g.DsIncludeDomains)
|
||||
g.DsExcludeDomains = strings.TrimSpace(g.DsExcludeDomains)
|
||||
@@ -238,6 +299,15 @@ func SetGroup(g *Group) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func ContainsInPorts(ports map[uint16]int8, port uint16) bool {
|
||||
_, ok := ports[port]
|
||||
if ok {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func GroupAuthLogin(name, pwd string, authData map[string]interface{}) error {
|
||||
g := &Group{Auth: authData}
|
||||
authType := g.Auth["type"].(string)
|
||||
|
@@ -29,6 +29,7 @@ type SettingAuditLog struct {
|
||||
type SettingOther struct {
|
||||
LinkAddr string `json:"link_addr"`
|
||||
Banner string `json:"banner"`
|
||||
Homecode int `json:"homecode"`
|
||||
Homeindex string `json:"homeindex"`
|
||||
AccountMail string `json:"account_mail"`
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ type Group struct {
|
||||
Note string `json:"note" xorm:"varchar(255)"`
|
||||
AllowLan bool `json:"allow_lan" xorm:"Bool"`
|
||||
ClientDns []ValData `json:"client_dns" xorm:"Text"`
|
||||
SplitDns []ValData `json:"split_dns" xorm:"Text"`
|
||||
RouteInclude []ValData `json:"route_include" xorm:"Text"`
|
||||
RouteExclude []ValData `json:"route_exclude" xorm:"Text"`
|
||||
DsExcludeDomains string `json:"ds_exclude_domains" xorm:"Text"`
|
||||
|
@@ -17,7 +17,10 @@ import (
|
||||
"github.com/bjdgyc/anylink/sessdata"
|
||||
)
|
||||
|
||||
var profileHash = ""
|
||||
var (
|
||||
profileHash = ""
|
||||
certHash = ""
|
||||
)
|
||||
|
||||
func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO 调试信息输出
|
||||
@@ -138,7 +141,7 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
||||
other := &dbdata.SettingOther{}
|
||||
_ = dbdata.SettingGet(other)
|
||||
rd := RequestData{SessionId: sess.Sid, SessionToken: sess.Sid + "@" + sess.Token,
|
||||
Banner: other.Banner, ProfileName: base.Cfg.ProfileName, ProfileHash: profileHash}
|
||||
Banner: other.Banner, ProfileName: base.Cfg.ProfileName, ProfileHash: profileHash, CertHash: certHash}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
tplRequest(tpl_complete, w, rd)
|
||||
base.Info("login", cr.Auth.Username, userAgent)
|
||||
@@ -178,6 +181,7 @@ type RequestData struct {
|
||||
Banner string
|
||||
ProfileName string
|
||||
ProfileHash string
|
||||
CertHash string
|
||||
}
|
||||
|
||||
var auth_request = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
@@ -223,7 +227,7 @@ var auth_complete = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
</capabilities>
|
||||
<config client="vpn" type="private">
|
||||
<vpn-base-config>
|
||||
<server-cert-hash>240B97A685B2BFA66AD699B90AAC49EA66495D69</server-cert-hash>
|
||||
<server-cert-hash>{{.CertHash}}</server-cert-hash>
|
||||
</vpn-base-config>
|
||||
<opaque is-for="vpn-client"></opaque>
|
||||
<vpn-profile-manifest>
|
||||
|
@@ -27,10 +27,16 @@ func LinkHome(w http.ResponseWriter, r *http.Request) {
|
||||
if err := dbdata.SettingGet(index); err != nil {
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
if index.Homeindex == "" {
|
||||
index.Homeindex = "AnyLink 是一个企业级远程办公 SSL VPN 软件,可以支持多人同时在线使用。"
|
||||
|
||||
if index.Homecode > 0 {
|
||||
w.WriteHeader(index.Homecode)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
// if index.Homeindex == "" {
|
||||
// index.Homeindex = "AnyLink 是一个企业级远程办公 SSL VPN 软件,可以支持多人同时在线使用。"
|
||||
// }
|
||||
fmt.Fprintln(w, index.Homeindex)
|
||||
}
|
||||
|
||||
|
@@ -51,6 +51,9 @@ func checkTun() {
|
||||
// 添加注释
|
||||
natRule := []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-m", "comment",
|
||||
"--comment", "AnyLink", "-j", "MASQUERADE"}
|
||||
if base.InContainer {
|
||||
natRule = []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-j", "MASQUERADE"}
|
||||
}
|
||||
err = ipt.InsertUnique("nat", "POSTROUTING", 1, natRule...)
|
||||
if err != nil {
|
||||
base.Error(err)
|
||||
@@ -58,6 +61,9 @@ func checkTun() {
|
||||
|
||||
// 添加注释
|
||||
forwardRule := []string{"-m", "comment", "--comment", "AnyLink", "-j", "ACCEPT"}
|
||||
if base.InContainer {
|
||||
forwardRule = []string{"-j", "ACCEPT"}
|
||||
}
|
||||
err = ipt.InsertUnique("filter", "FORWARD", 1, forwardRule...)
|
||||
if err != nil {
|
||||
base.Error(err)
|
||||
|
@@ -86,7 +86,7 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
cSess.CstpDpd = cstpDpd
|
||||
|
||||
dtlsPort := "4433"
|
||||
dtlsPort := "443"
|
||||
if strings.Contains(base.Cfg.ServerDTLSAddr, ":") {
|
||||
ss := strings.Split(base.Cfg.ServerDTLSAddr, ":")
|
||||
dtlsPort = ss[1]
|
||||
@@ -131,6 +131,11 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
for _, v := range cSess.Group.ClientDns {
|
||||
HttpAddHeader(w, "X-CSTP-DNS", v.Val)
|
||||
}
|
||||
// 分割dns
|
||||
for _, v := range cSess.Group.SplitDns {
|
||||
HttpAddHeader(w, "X-CSTP-Split-DNS", v.Val)
|
||||
}
|
||||
|
||||
// 允许的路由
|
||||
for _, v := range cSess.Group.RouteInclude {
|
||||
if strings.ToLower(v.Val) == dbdata.All {
|
||||
@@ -156,9 +161,9 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
HttpSetHeader(w, "X-CSTP-Keep", "true")
|
||||
HttpSetHeader(w, "X-CSTP-Tunnel-All-DNS", "false")
|
||||
|
||||
HttpSetHeader(w, "X-CSTP-Rekey-Time", "43200") // 172800
|
||||
HttpSetHeader(w, "X-CSTP-Rekey-Time", "86400") // 172800
|
||||
HttpSetHeader(w, "X-CSTP-Rekey-Method", "new-tunnel")
|
||||
HttpSetHeader(w, "X-DTLS-Rekey-Time", "43200")
|
||||
HttpSetHeader(w, "X-DTLS-Rekey-Time", "86400")
|
||||
HttpSetHeader(w, "X-DTLS-Rekey-Method", "new-tunnel")
|
||||
|
||||
HttpSetHeader(w, "X-CSTP-DPD", fmt.Sprintf("%d", cstpDpd))
|
||||
@@ -180,7 +185,7 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
HttpSetHeader(w, "X-CSTP-Routing-Filtering-Ignore", "false")
|
||||
HttpSetHeader(w, "X-CSTP-Quarantine", "false")
|
||||
HttpSetHeader(w, "X-CSTP-Disable-Always-On-VPN", "false")
|
||||
HttpSetHeader(w, "X-CSTP-Client-Bypass-Protocol", "false")
|
||||
HttpSetHeader(w, "X-CSTP-Client-Bypass-Protocol", "true")
|
||||
HttpSetHeader(w, "X-CSTP-TCP-Keepalive", "false")
|
||||
// 设置域名拆分隧道(移动端不支持)
|
||||
if mobile != "mobile" {
|
||||
|
@@ -88,8 +88,21 @@ func checkLinkAcl(group *dbdata.Group, pl *sessdata.Payload) bool {
|
||||
for _, v := range group.LinkAcl {
|
||||
// 循环判断ip和端口
|
||||
if v.IpNet.Contains(ipDst) {
|
||||
|
||||
// 放行允许ip的ping
|
||||
if v.Port == ipPort || v.Port == 0 || ipProto == waterutil.ICMP {
|
||||
// if v.Ports == nil || len(v.Ports) == 0 {
|
||||
// //单端口历史数据兼容
|
||||
// port := uint16(v.Port.(float64))
|
||||
// if port == ipPort || port == 0 || ipProto == waterutil.ICMP {
|
||||
// if v.Action == dbdata.Allow {
|
||||
// return true
|
||||
// } else {
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
|
||||
if dbdata.ContainsInPorts(v.Ports, ipPort) || dbdata.ContainsInPorts(v.Ports, 0) || ipProto == waterutil.ICMP {
|
||||
if v.Action == dbdata.Allow {
|
||||
return true
|
||||
} else {
|
||||
|
@@ -1,13 +1,16 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"crypto/tls"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/bjdgyc/anylink/base"
|
||||
@@ -36,6 +39,19 @@ func startTls() {
|
||||
// certs[0], err = tls.LoadX509KeyPair(certFile, keyFile)
|
||||
// }
|
||||
|
||||
tlscert, _, err := dbdata.ParseCert()
|
||||
if err != nil {
|
||||
base.Fatal("证书加载失败", err)
|
||||
}
|
||||
dbdata.LoadCertificate(tlscert)
|
||||
|
||||
// 计算证书hash值
|
||||
s1 := sha1.New()
|
||||
s1.Write(tlscert.Certificate[0])
|
||||
h2s := hex.EncodeToString(s1.Sum(nil))
|
||||
certHash = strings.ToUpper(h2s)
|
||||
base.Info("certHash", certHash)
|
||||
|
||||
// 修复 CVE-2016-2183
|
||||
// https://segmentfault.com/a/1190000038486901
|
||||
// nmap -sV --script ssl-enum-ciphers -p 443 www.example.com
|
||||
|
@@ -17,6 +17,12 @@ func Start() {
|
||||
sessdata.Start()
|
||||
cron.Start()
|
||||
|
||||
// 开启服务器转发
|
||||
err := execCmd([]string{"sysctl -w net.ipv4.ip_forward=1"})
|
||||
if err != nil {
|
||||
base.Fatal(err)
|
||||
}
|
||||
|
||||
switch base.Cfg.LinkMode {
|
||||
case base.LinkModeTUN:
|
||||
checkTun()
|
||||
|
@@ -49,10 +49,11 @@
|
||||
prop="bandwidth"
|
||||
label="带宽限制"
|
||||
width="90">
|
||||
<template slot-scope="scope">
|
||||
<el-row v-if="scope.row.bandwidth > 0">{{ convertBandwidth(scope.row.bandwidth, 'BYTE', 'Mbps') }} Mbps</el-row>
|
||||
<el-row v-else>不限</el-row>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-row v-if="scope.row.bandwidth > 0">{{ convertBandwidth(scope.row.bandwidth, 'BYTE', 'Mbps') }} Mbps
|
||||
</el-row>
|
||||
<el-row v-else>不限</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
@@ -69,12 +70,20 @@
|
||||
label="路由包含"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-row v-for="(item,inx) in scope.row.route_include.slice(0, readMinRows)" :key="inx">{{ item.val }}</el-row>
|
||||
<el-row v-for="(item,inx) in scope.row.route_include.slice(0, readMinRows)" :key="inx">{{
|
||||
item.val
|
||||
}}
|
||||
</el-row>
|
||||
<div v-if="scope.row.route_include.length > readMinRows">
|
||||
<div v-if="readMore[`ri_${ scope.row.id }`]">
|
||||
<el-row v-for="(item,inx) in scope.row.route_include.slice(readMinRows)" :key="inx">{{ item.val }}</el-row>
|
||||
<el-row v-for="(item,inx) in scope.row.route_include.slice(readMinRows)" :key="inx">{{
|
||||
item.val
|
||||
}}
|
||||
</el-row>
|
||||
</div>
|
||||
<el-button size="mini" type="text" @click="toggleMore(`ri_${ scope.row.id }`)">{{ readMore[`ri_${ scope.row.id }`] ? "▲ 收起" : "▼ 更多" }}</el-button>
|
||||
<el-button size="mini" type="text" @click="toggleMore(`ri_${ scope.row.id }`)">
|
||||
{{ readMore[`ri_${scope.row.id}`] ? "▲ 收起" : "▼ 更多" }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -84,12 +93,20 @@
|
||||
label="路由排除"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-row v-for="(item,inx) in scope.row.route_exclude.slice(0, readMinRows)" :key="inx">{{ item.val }}</el-row>
|
||||
<el-row v-for="(item,inx) in scope.row.route_exclude.slice(0, readMinRows)" :key="inx">{{
|
||||
item.val
|
||||
}}
|
||||
</el-row>
|
||||
<div v-if="scope.row.route_exclude.length > readMinRows">
|
||||
<div v-if="readMore[`re_${ scope.row.id }`]">
|
||||
<el-row v-for="(item,inx) in scope.row.route_exclude.slice(readMinRows)" :key="inx">{{ item.val }}</el-row>
|
||||
<el-row v-for="(item,inx) in scope.row.route_exclude.slice(readMinRows)" :key="inx">{{
|
||||
item.val
|
||||
}}
|
||||
</el-row>
|
||||
</div>
|
||||
<el-button size="mini" type="text" @click="toggleMore(`re_${ scope.row.id }`)">{{ readMore[`re_${ scope.row.id }`] ? "▲ 收起" : "▼ 更多" }}</el-button>
|
||||
<el-button size="mini" type="text" @click="toggleMore(`re_${ scope.row.id }`)">
|
||||
{{ readMore[`re_${scope.row.id}`] ? "▲ 收起" : "▼ 更多" }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -108,7 +125,9 @@
|
||||
{{ item.action }} => {{ item.val }} : {{ item.port }}
|
||||
</el-row>
|
||||
</div>
|
||||
<el-button size="mini" type="text" @click="toggleMore(`la_${ scope.row.id }`)">{{ readMore[`la_${ scope.row.id }`] ? "▲ 收起" : "▼ 更多" }}</el-button>
|
||||
<el-button size="mini" type="text" @click="toggleMore(`la_${ scope.row.id }`)">
|
||||
{{ readMore[`la_${scope.row.id}`] ? "▲ 收起" : "▼ 更多" }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -178,217 +197,263 @@
|
||||
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="ruleForm">
|
||||
<el-tabs v-model="activeTab" :before-leave="beforeTabLeave">
|
||||
<el-tab-pane label="通用" name="general">
|
||||
<el-form-item label="用户组ID" prop="id">
|
||||
<el-input v-model="ruleForm.id" disabled></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="组名" prop="name">
|
||||
<el-input v-model="ruleForm.name" :disabled="ruleForm.id > 0"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="note">
|
||||
<el-input v-model="ruleForm.note"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="带宽限制" prop="bandwidth_format" style="width:260px;">
|
||||
<el-input v-model="ruleForm.bandwidth_format" oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''">
|
||||
<template slot="append">Mbps</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排除本地网络" prop="allow_lan">
|
||||
<el-switch
|
||||
v-model="ruleForm.allow_lan"
|
||||
active-text="开启后 用户本地所在网段将不通过anylink加密传输">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="客户端DNS" prop="client_dns">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="20">输入IP格式如: 192.168.0.10</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.client_dns)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-for="(item,index) in ruleForm.client_dns"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="item.val"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.client_dns,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="ruleForm.status">
|
||||
<el-radio :label="1" border>启用</el-radio>
|
||||
<el-radio :label="0" border>停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="认证方式" name="authtype">
|
||||
<el-form-item label="认证" prop="authtype">
|
||||
<el-radio-group v-model="ruleForm.auth.type" @change="authTypeChange">
|
||||
<el-radio label="local" border>本地</el-radio>
|
||||
<el-radio label="radius" border>Radius</el-radio>
|
||||
<el-radio label="ldap" border>LDAP</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<template v-if="ruleForm.auth.type == 'radius'">
|
||||
<el-form-item label="服务器地址" prop="auth.radius.addr" :rules="this.ruleForm.auth.type== 'radius' ? this.rules['auth.radius.addr'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.radius.addr" placeholder="例如 ip:1812"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密钥" prop="auth.radius.secret" :rules="this.ruleForm.auth.type== 'radius' ? this.rules['auth.radius.secret'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.radius.secret" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<template v-if="ruleForm.auth.type == 'ldap'">
|
||||
<el-form-item label="服务器地址" prop="auth.ldap.addr" :rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.addr'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.addr" placeholder="例如 ip:389 / 域名:389"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="开启TLS" prop="auth.ldap.tls">
|
||||
<el-switch v-model="ruleForm.auth.ldap.tls"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员 DN" prop="auth.ldap.bind_name" :rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.bind_name'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.bind_name" placeholder="例如 CN=bindadmin,DC=abc,DC=COM"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员密码" prop="auth.ldap.bind_pwd" :rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.bind_pwd'] : [{ required: false }]">
|
||||
<el-input type="password" v-model="ruleForm.auth.ldap.bind_pwd" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Base DN" prop="auth.ldap.base_dn" :rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.base_dn'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.base_dn" placeholder="例如 DC=abc,DC=com"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户对象类" prop="auth.ldap.object_class" :rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.object_class'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.object_class" placeholder="例如 person / user / posixAccount"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户唯一ID" prop="auth.ldap.search_attr" :rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.search_attr'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.search_attr" placeholder="例如 sAMAccountName / uid / cn"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="受限用户组" prop="auth.ldap.member_of">
|
||||
<el-input v-model="ruleForm.auth.ldap.member_of" placeholder="选填, 只允许指定组登入, 例如 CN=HomeWork,DC=abc,DC=com"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="路由设置" name="route">
|
||||
<el-form-item label="包含路由" prop="route_include">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="18">输入CIDR格式如: 192.168.1.0/24</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.route_include)"></el-button>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="info" icon="el-icon-edit" circle
|
||||
@click.prevent="openIpListDialog('route_include')"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<templete v-if="activeTab == 'route'">
|
||||
<el-row v-for="(item,index) in ruleForm.route_include"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="item.val"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.route_include,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</templete>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="排除路由" prop="route_exclude">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="18">输入CIDR格式如: 192.168.2.0/24</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.route_exclude)"></el-button>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="info" icon="el-icon-edit" circle
|
||||
@click.prevent="openIpListDialog('route_exclude')"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<templete v-if="activeTab == 'route'">
|
||||
<el-row v-for="(item,index) in ruleForm.route_exclude"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="item.val"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.route_exclude,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</templete>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="权限控制" name="link_acl">
|
||||
<el-form-item label="权限控制" prop="link_acl">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="20">输入CIDR格式如: 192.168.3.0/24 端口0表示所有端口</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.link_acl)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-for="(item,index) in ruleForm.link_acl"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="5">
|
||||
<el-col :span="11">
|
||||
<el-input placeholder="请输入CIDR地址" v-model="item.val">
|
||||
<el-select v-model="item.action" slot="prepend">
|
||||
<el-option label="允许" value="allow"></el-option>
|
||||
<el-option label="禁止" value="deny"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input v-model.number="item.port" placeholder="端口"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.link_acl,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="域名拆分隧道" name="ds_domains">
|
||||
<el-form-item label="包含域名" prop="ds_include_domains">
|
||||
<el-input type="textarea" :rows="5" v-model="ruleForm.ds_include_domains" placeholder="输入域名用,号分隔,默认匹配所有子域名, 如baidu.com,163.com"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排除域名" prop="ds_exclude_domains">
|
||||
<el-input type="textarea" :rows="5" v-model="ruleForm.ds_exclude_domains" placeholder="输入域名用,号分隔,默认匹配所有子域名, 如baidu.com,163.com"></el-input>
|
||||
<div class="msg-info">注:域名拆分隧道,仅支持AnyConnect的桌面客户端,不支持移动端.</div>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
<el-form-item>
|
||||
<templete v-if="activeTab == 'authtype' && ruleForm.auth.type != 'local'">
|
||||
<el-button @click="openAuthLoginDialog()" style="margin-right:10px">测试登录</el-button>
|
||||
</templete>
|
||||
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-tab-pane label="通用" name="general">
|
||||
<el-form-item label="用户组ID" prop="id">
|
||||
<el-input v-model="ruleForm.id" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
|
||||
<el-form-item label="组名" prop="name">
|
||||
<el-input v-model="ruleForm.name" :disabled="ruleForm.id > 0"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="note">
|
||||
<el-input v-model="ruleForm.note"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="带宽限制" prop="bandwidth_format" style="width:260px;">
|
||||
<el-input v-model="ruleForm.bandwidth_format"
|
||||
oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''">
|
||||
<template slot="append">Mbps</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排除本地网络" prop="allow_lan">
|
||||
<!-- active-text="开启后 用户本地所在网段将不通过anylink加密传输" -->
|
||||
<el-switch v-model="ruleForm.allow_lan"></el-switch>
|
||||
<div class="msg-info">
|
||||
注:本地网络 指的是:
|
||||
运行 anyconnect 客户端的PC 所在的的网络,即本地路由网段。
|
||||
开启后,PC本地路由网段的数据就不会走隧道链路转发数据了。
|
||||
同时 anyconnect 客户端需要勾选本地网络(Allow Local Lan)的开关,功能才能生效。
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="客户端DNS" prop="client_dns">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="20">输入IP格式如: 192.168.0.10</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.client_dns)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-for="(item,index) in ruleForm.client_dns"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="item.val"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.client_dns,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="内网域名" prop="split_dns">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="20">(分割DNS)一般留空。如果输入域名,只有配置的域名(包含子域名)走配置的dns</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.split_dns)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-for="(item,index) in ruleForm.split_dns"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="item.val"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.split_dns,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="ruleForm.status">
|
||||
<el-radio :label="1" border>启用</el-radio>
|
||||
<el-radio :label="0" border>停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="认证方式" name="authtype">
|
||||
<el-form-item label="认证" prop="authtype">
|
||||
<el-radio-group v-model="ruleForm.auth.type" @change="authTypeChange">
|
||||
<el-radio label="local" border>本地</el-radio>
|
||||
<el-radio label="radius" border>Radius</el-radio>
|
||||
<el-radio label="ldap" border>LDAP</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<template v-if="ruleForm.auth.type == 'radius'">
|
||||
<el-form-item label="服务器地址" prop="auth.radius.addr"
|
||||
:rules="this.ruleForm.auth.type== 'radius' ? this.rules['auth.radius.addr'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.radius.addr" placeholder="例如 ip:1812"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密钥" prop="auth.radius.secret"
|
||||
:rules="this.ruleForm.auth.type== 'radius' ? this.rules['auth.radius.secret'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.radius.secret" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<template v-if="ruleForm.auth.type == 'ldap'">
|
||||
<el-form-item label="服务器地址" prop="auth.ldap.addr"
|
||||
:rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.addr'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.addr" placeholder="例如 ip:389 / 域名:389"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="开启TLS" prop="auth.ldap.tls">
|
||||
<el-switch v-model="ruleForm.auth.ldap.tls"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员 DN" prop="auth.ldap.bind_name"
|
||||
:rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.bind_name'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.bind_name"
|
||||
placeholder="例如 CN=bindadmin,DC=abc,DC=COM"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员密码" prop="auth.ldap.bind_pwd"
|
||||
:rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.bind_pwd'] : [{ required: false }]">
|
||||
<el-input type="password" v-model="ruleForm.auth.ldap.bind_pwd" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Base DN" prop="auth.ldap.base_dn"
|
||||
:rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.base_dn'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.base_dn" placeholder="例如 DC=abc,DC=com"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户对象类" prop="auth.ldap.object_class"
|
||||
:rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.object_class'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.object_class"
|
||||
placeholder="例如 person / user / posixAccount"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户唯一ID" prop="auth.ldap.search_attr"
|
||||
:rules="this.ruleForm.auth.type== 'ldap' ? this.rules['auth.ldap.search_attr'] : [{ required: false }]">
|
||||
<el-input v-model="ruleForm.auth.ldap.search_attr"
|
||||
placeholder="例如 sAMAccountName / uid / cn"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="受限用户组" prop="auth.ldap.member_of">
|
||||
<el-input v-model="ruleForm.auth.ldap.member_of"
|
||||
placeholder="选填, 只允许指定组登入, 例如 CN=HomeWork,DC=abc,DC=com"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="路由设置" name="route">
|
||||
<el-form-item label="包含路由" prop="route_include">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="18">输入CIDR格式如: 192.168.1.0/24</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.route_include)"></el-button>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="info" icon="el-icon-edit" circle
|
||||
@click.prevent="openIpListDialog('route_include')"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<templete v-if="activeTab == 'route'">
|
||||
<el-row v-for="(item,index) in ruleForm.route_include"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="item.val"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.route_include,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</templete>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="排除路由" prop="route_exclude">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="18">输入CIDR格式如: 192.168.2.0/24</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.route_exclude)"></el-button>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button size="mini" type="info" icon="el-icon-edit" circle
|
||||
@click.prevent="openIpListDialog('route_exclude')"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<templete v-if="activeTab == 'route'">
|
||||
<el-row v-for="(item,index) in ruleForm.route_exclude"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-input v-model="item.val"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.route_exclude,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</templete>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="权限控制" name="link_acl">
|
||||
<el-form-item label="权限控制" prop="link_acl">
|
||||
<el-row class="msg-info">
|
||||
<el-col :span="22">输入CIDR格式如: 192.168.3.0/24
|
||||
端口0表示所有端口,多个端口用','号分隔,连续端口:1234-5678
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" circle
|
||||
@click.prevent="addDomain(ruleForm.link_acl)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-for="(item,index) in ruleForm.link_acl"
|
||||
:key="index" style="margin-bottom: 5px" :gutter="1">
|
||||
<el-col :span="10">
|
||||
<el-input placeholder="请输入CIDR地址" v-model="item.val">
|
||||
<el-select v-model="item.action" slot="prepend">
|
||||
<el-option label="允许" value="allow"></el-option>
|
||||
<el-option label="禁止" value="deny"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<!-- type="textarea" :autosize="{ minRows: 1, maxRows: 2}" -->
|
||||
<el-input v-model="item.port" placeholder="多端口,号分隔"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-input v-model="item.note" placeholder="备注"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" circle
|
||||
@click.prevent="removeDomain(ruleForm.link_acl,index)"></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="域名拆分隧道" name="ds_domains">
|
||||
<el-form-item label="包含域名" prop="ds_include_domains">
|
||||
<el-input type="textarea" :rows="5" v-model="ruleForm.ds_include_domains"
|
||||
placeholder="输入域名用,号分隔,默认匹配所有子域名, 如baidu.com,163.com"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排除域名" prop="ds_exclude_domains">
|
||||
<el-input type="textarea" :rows="5" v-model="ruleForm.ds_exclude_domains"
|
||||
placeholder="输入域名用,号分隔,默认匹配所有子域名, 如baidu.com,163.com"></el-input>
|
||||
<div class="msg-info">注:域名拆分隧道,仅支持AnyConnect的windows和MacOS桌面客户端,不支持移动端.</div>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
<el-form-item>
|
||||
<templete v-if="activeTab == 'authtype' && ruleForm.auth.type != 'local'">
|
||||
<el-button @click="openAuthLoginDialog()" style="margin-right:10px">测试登录</el-button>
|
||||
</templete>
|
||||
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
<!--测试用户登录弹出框-->
|
||||
<el-dialog
|
||||
@@ -398,36 +463,41 @@
|
||||
width="600px"
|
||||
custom-class="valgin-dialog"
|
||||
center>
|
||||
<el-form :model="authLoginForm" :rules="authLoginRules" ref="authLoginForm" label-width="100px">
|
||||
<el-form-item label="账号" prop="name">
|
||||
<el-input v-model="authLoginForm.name" ref="authLoginFormName" @keydown.enter.native="testAuthLogin"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="pwd">
|
||||
<el-input type="password" v-model="authLoginForm.pwd" @keydown.enter.native="testAuthLogin"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="testAuthLogin()" :loading="authLoginLoading">登录</el-button>
|
||||
<el-button @click="authLoginDialog = false">取 消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :model="authLoginForm" :rules="authLoginRules" ref="authLoginForm" label-width="100px">
|
||||
<el-form-item label="账号" prop="name">
|
||||
<el-input v-model="authLoginForm.name" ref="authLoginFormName"
|
||||
@keydown.enter.native="testAuthLogin"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="pwd">
|
||||
<el-input type="password" v-model="authLoginForm.pwd" @keydown.enter.native="testAuthLogin"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="testAuthLogin()" :loading="authLoginLoading">登录</el-button>
|
||||
<el-button @click="authLoginDialog = false">取 消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
<!--编辑模式弹窗-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
title="编辑模式"
|
||||
:visible.sync="ipListDialog"
|
||||
width="650px"
|
||||
custom-class="valgin-dialog"
|
||||
center>
|
||||
:close-on-click-modal="false"
|
||||
title="编辑模式"
|
||||
:visible.sync="ipListDialog"
|
||||
width="650px"
|
||||
custom-class="valgin-dialog"
|
||||
center>
|
||||
<el-form ref="ipEditForm" label-width="80px">
|
||||
<el-form-item label="路由表" prop="ip_list">
|
||||
<el-input type="textarea" :rows="10" v-model="ipEditForm.ip_list" placeholder="每行一条路由,例:192.168.1.0/24,备注 或 192.168.1.0/24"></el-input>
|
||||
<div class="msg-info">当前共 {{ ipEditForm.ip_list.trim() === '' ? 0 : ipEditForm.ip_list.trim().split("\n").length }} 条(注:AnyConnect客户端最多支持{{ this.maxRouteRows }}条路由)</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="ipEdit()" :loading="ipEditLoading">更新</el-button>
|
||||
<el-button @click="ipListDialog = false">取 消</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="路由表" prop="ip_list">
|
||||
<el-input type="textarea" :rows="10" v-model="ipEditForm.ip_list"
|
||||
placeholder="每行一条路由,例:192.168.1.0/24,备注 或 192.168.1.0/24"></el-input>
|
||||
<div class="msg-info">当前共
|
||||
{{ ipEditForm.ip_list.trim() === '' ? 0 : ipEditForm.ip_list.trim().split("\n").length }}
|
||||
条(注:AnyConnect客户端最多支持{{ this.maxRouteRows }}条路由)
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="ipEdit()" :loading="ipEditLoading">更新</el-button>
|
||||
<el-button @click="ipListDialog = false">取 消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@@ -453,47 +523,48 @@ export default {
|
||||
page: 1,
|
||||
tableData: [],
|
||||
count: 10,
|
||||
activeTab : "general",
|
||||
activeTab: "general",
|
||||
readMore: {},
|
||||
readMinRows : 5,
|
||||
maxRouteRows : 2500,
|
||||
defAuth : {
|
||||
type:'local',
|
||||
radius:{addr:"", secret:""},
|
||||
ldap:{
|
||||
addr:"",
|
||||
tls:false,
|
||||
base_dn:"",
|
||||
object_class:"person",
|
||||
search_attr:"sAMAccountName",
|
||||
member_of:"",
|
||||
bind_name:"",
|
||||
bind_pwd:"",
|
||||
},
|
||||
readMinRows: 5,
|
||||
maxRouteRows: 2500,
|
||||
defAuth: {
|
||||
type: 'local',
|
||||
radius: {addr: "", secret: ""},
|
||||
ldap: {
|
||||
addr: "",
|
||||
tls: false,
|
||||
base_dn: "",
|
||||
object_class: "person",
|
||||
search_attr: "sAMAccountName",
|
||||
member_of: "",
|
||||
bind_name: "",
|
||||
bind_pwd: "",
|
||||
},
|
||||
},
|
||||
ruleForm: {
|
||||
bandwidth: 0,
|
||||
bandwidth_format: '0',
|
||||
status: 1,
|
||||
allow_lan: true,
|
||||
client_dns: [{val: '114.114.114.114'}],
|
||||
client_dns: [{val: '114.114.114.114', note: '默认dns'}],
|
||||
split_dns: [],
|
||||
route_include: [{val: 'all', note: '默认全局代理'}],
|
||||
route_exclude: [],
|
||||
link_acl: [],
|
||||
auth : {},
|
||||
auth: {},
|
||||
},
|
||||
authLoginDialog : false,
|
||||
ipListDialog : false,
|
||||
authLoginLoading : false,
|
||||
authLoginForm : {
|
||||
name : "",
|
||||
pwd : "",
|
||||
authLoginDialog: false,
|
||||
ipListDialog: false,
|
||||
authLoginLoading: false,
|
||||
authLoginForm: {
|
||||
name: "",
|
||||
pwd: "",
|
||||
},
|
||||
ipEditForm: {
|
||||
ip_list: "",
|
||||
type : "",
|
||||
type: "",
|
||||
},
|
||||
ipEditLoading : false,
|
||||
ipEditLoading: false,
|
||||
authLoginRules: {
|
||||
name: [
|
||||
{required: true, message: '请输入账号', trigger: 'blur'},
|
||||
@@ -544,11 +615,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
setAuthData(row) {
|
||||
if (! row) {
|
||||
if (!row) {
|
||||
this.ruleForm.auth = JSON.parse(JSON.stringify(this.defAuth));
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
if (row.auth.type == "ldap" && ! row.auth.ldap.object_class) {
|
||||
if (row.auth.type == "ldap" && !row.auth.ldap.object_class) {
|
||||
row.auth.ldap.object_class = this.defAuth.ldap.object_class;
|
||||
}
|
||||
this.ruleForm.auth = Object.assign(JSON.parse(JSON.stringify(this.defAuth)), row.auth);
|
||||
@@ -620,7 +691,8 @@ export default {
|
||||
// arr.pop()
|
||||
},
|
||||
addDomain(arr) {
|
||||
arr.push({val: "", action: "allow", port: 0});
|
||||
console.log("arr", arr)
|
||||
arr.push({val: "", action: "allow", port: "0", note: ""});
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
@@ -646,29 +718,31 @@ export default {
|
||||
});
|
||||
},
|
||||
testAuthLogin() {
|
||||
this.$refs["authLoginForm"].validate((valid) => {
|
||||
if (!valid) {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
this.authLoginLoading = true;
|
||||
axios.post('/group/auth_login', {name:this.authLoginForm.name,
|
||||
pwd:this.authLoginForm.pwd,
|
||||
auth:this.ruleForm.auth}).then(resp => {
|
||||
const rdata = resp.data;
|
||||
if (rdata.code === 0) {
|
||||
this.$message.success("登录成功");
|
||||
} else {
|
||||
this.$message.error(rdata.msg);
|
||||
}
|
||||
this.authLoginLoading = false;
|
||||
console.log(rdata);
|
||||
}).catch(error => {
|
||||
this.$message.error('哦,请求出错');
|
||||
console.log(error);
|
||||
this.authLoginLoading = false;
|
||||
});
|
||||
this.$refs["authLoginForm"].validate((valid) => {
|
||||
if (!valid) {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
this.authLoginLoading = true;
|
||||
axios.post('/group/auth_login', {
|
||||
name: this.authLoginForm.name,
|
||||
pwd: this.authLoginForm.pwd,
|
||||
auth: this.ruleForm.auth
|
||||
}).then(resp => {
|
||||
const rdata = resp.data;
|
||||
if (rdata.code === 0) {
|
||||
this.$message.success("登录成功");
|
||||
} else {
|
||||
this.$message.error(rdata.msg);
|
||||
}
|
||||
this.authLoginLoading = false;
|
||||
console.log(rdata);
|
||||
}).catch(error => {
|
||||
this.$message.error('哦,请求出错');
|
||||
console.log(error);
|
||||
this.authLoginLoading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
openAuthLoginDialog() {
|
||||
this.$refs["ruleForm"].validate((valid) => {
|
||||
@@ -679,7 +753,7 @@ export default {
|
||||
this.authLoginDialog = true;
|
||||
// set authLoginFormName focus
|
||||
this.$nextTick(() => {
|
||||
this.$refs['authLoginFormName'].focus();
|
||||
this.$refs['authLoginFormName'].focus();
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -689,63 +763,63 @@ export default {
|
||||
this.ipEditForm.ip_list = this.ruleForm[type].map(item => item.val + (item.note ? "," + item.note : "")).join("\n");
|
||||
},
|
||||
ipEdit() {
|
||||
this.ipEditLoading = true;
|
||||
let ipList = [];
|
||||
if (this.ipEditForm.ip_list.trim() !== "") {
|
||||
ipList = this.ipEditForm.ip_list.trim().split("\n");
|
||||
this.ipEditLoading = true;
|
||||
let ipList = [];
|
||||
if (this.ipEditForm.ip_list.trim() !== "") {
|
||||
ipList = this.ipEditForm.ip_list.trim().split("\n");
|
||||
}
|
||||
let arr = [];
|
||||
for (let i = 0; i < ipList.length; i++) {
|
||||
let item = ipList[i];
|
||||
if (item.trim() === "") {
|
||||
continue;
|
||||
}
|
||||
let arr = [];
|
||||
for (let i = 0; i < ipList.length; i++) {
|
||||
let item = ipList[i];
|
||||
if (item.trim() === "") {
|
||||
continue;
|
||||
}
|
||||
let ip = item.split(",");
|
||||
if (ip.length > 2) {
|
||||
ip[1] = ip.slice(1).join(",");
|
||||
}
|
||||
let note = ip[1] ? ip[1] : "";
|
||||
const pushToArr = () => {
|
||||
arr.push({val: ip[0], note: note});
|
||||
};
|
||||
if (this.ipEditForm.type == "route_include" && ip[0] == "all") {
|
||||
pushToArr();
|
||||
continue;
|
||||
}
|
||||
let valid = this.isValidCIDR(ip[0]);
|
||||
if (!valid.valid) {
|
||||
this.$message.error("错误:CIDR格式错误,建议 " + ip[0] + " 改为 " + valid.suggestion);
|
||||
this.ipEditLoading = false;
|
||||
return;
|
||||
}
|
||||
let ip = item.split(",");
|
||||
if (ip.length > 2) {
|
||||
ip[1] = ip.slice(1).join(",");
|
||||
}
|
||||
let note = ip[1] ? ip[1] : "";
|
||||
const pushToArr = () => {
|
||||
arr.push({val: ip[0], note: note});
|
||||
};
|
||||
if (this.ipEditForm.type == "route_include" && ip[0] == "all") {
|
||||
pushToArr();
|
||||
continue;
|
||||
}
|
||||
this.ruleForm[this.ipEditForm.type] = arr;
|
||||
this.ipEditLoading = false;
|
||||
this.ipListDialog = false;
|
||||
let valid = this.isValidCIDR(ip[0]);
|
||||
if (!valid.valid) {
|
||||
this.$message.error("错误:CIDR格式错误,建议 " + ip[0] + " 改为 " + valid.suggestion);
|
||||
this.ipEditLoading = false;
|
||||
return;
|
||||
}
|
||||
pushToArr();
|
||||
}
|
||||
this.ruleForm[this.ipEditForm.type] = arr;
|
||||
this.ipEditLoading = false;
|
||||
this.ipListDialog = false;
|
||||
},
|
||||
isValidCIDR(input) {
|
||||
const cidrRegex = /^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)\/([12]?\d|3[0-2])$/;
|
||||
if (!cidrRegex.test(input)) {
|
||||
return { valid: false, suggestion: null };
|
||||
const cidrRegex = /^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)\/([12]?\d|3[0-2])$/;
|
||||
if (!cidrRegex.test(input)) {
|
||||
return {valid: false, suggestion: null};
|
||||
}
|
||||
const [ip, mask] = input.split('/');
|
||||
const maskNum = parseInt(mask);
|
||||
const ipParts = ip.split('.').map(part => parseInt(part));
|
||||
const binaryIP = ipParts.map(part => part.toString(2).padStart(8, '0')).join('');
|
||||
for (let i = maskNum; i < 32; i++) {
|
||||
if (binaryIP[i] === '1') {
|
||||
const binaryNetworkPart = binaryIP.substring(0, maskNum).padEnd(32, '0');
|
||||
const networkIPParts = [];
|
||||
for (let j = 0; j < 4; j++) {
|
||||
const octet = binaryNetworkPart.substring(j * 8, (j + 1) * 8);
|
||||
networkIPParts.push(parseInt(octet, 2));
|
||||
}
|
||||
const suggestedIP = networkIPParts.join('.');
|
||||
return {valid: false, suggestion: `${suggestedIP}/${mask}`};
|
||||
}
|
||||
const [ip, mask] = input.split('/');
|
||||
const maskNum = parseInt(mask);
|
||||
const ipParts = ip.split('.').map(part => parseInt(part));
|
||||
const binaryIP = ipParts.map(part => part.toString(2).padStart(8, '0')).join('');
|
||||
for (let i = maskNum; i < 32; i++) {
|
||||
if (binaryIP[i] === '1') {
|
||||
const binaryNetworkPart = binaryIP.substring(0, maskNum).padEnd(32, '0');
|
||||
const networkIPParts = [];
|
||||
for (let j = 0; j < 4; j++) {
|
||||
const octet = binaryNetworkPart.substring(j * 8, (j + 1) * 8);
|
||||
networkIPParts.push(parseInt(octet, 2));
|
||||
}
|
||||
const suggestedIP = networkIPParts.join('.');
|
||||
return { valid: false, suggestion: `${suggestedIP}/${mask}` };
|
||||
}
|
||||
}
|
||||
return { valid: true, suggestion: null };
|
||||
}
|
||||
return {valid: true, suggestion: null};
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
@@ -762,7 +836,7 @@ export default {
|
||||
},
|
||||
beforeTabLeave() {
|
||||
var isSwitch = true
|
||||
if (! this.user_edit_dialog) {
|
||||
if (!this.user_edit_dialog) {
|
||||
return isSwitch;
|
||||
}
|
||||
this.$refs['ruleForm'].validate((valid) => {
|
||||
@@ -779,16 +853,16 @@ export default {
|
||||
this.activeTab = "general";
|
||||
},
|
||||
convertBandwidth(bandwidth, fromUnit, toUnit) {
|
||||
const units = {
|
||||
bps: 1,
|
||||
Kbps: 1000,
|
||||
Mbps: 1000000,
|
||||
Gbps: 1000000000,
|
||||
BYTE: 8,
|
||||
};
|
||||
const result = bandwidth * units[fromUnit] / units[toUnit];
|
||||
const fixedResult = result.toFixed(2);
|
||||
return parseFloat(fixedResult);
|
||||
const units = {
|
||||
bps: 1,
|
||||
Kbps: 1000,
|
||||
Mbps: 1000000,
|
||||
Gbps: 1000000000,
|
||||
BYTE: 8,
|
||||
};
|
||||
const result = bandwidth * units[fromUnit] / units[toUnit];
|
||||
const fixedResult = result.toFixed(2);
|
||||
return parseFloat(fixedResult);
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -809,19 +883,20 @@ export default {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
::v-deep .valgin-dialog{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin:0 !important;
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
transform:translate(-50%,-50%);
|
||||
max-height:calc(100% - 30px);
|
||||
max-width:calc(100% - 30px);
|
||||
::v-deep .valgin-dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0 !important;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
max-height: calc(100% - 30px);
|
||||
max-width: calc(100% - 30px);
|
||||
}
|
||||
::v-deep .valgin-dialog .el-dialog__body{
|
||||
flex:1;
|
||||
overflow: auto;
|
||||
|
||||
::v-deep .valgin-dialog .el-dialog__body {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
@@ -3,11 +3,11 @@
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="邮件配置" name="dataSmtp">
|
||||
<el-form
|
||||
:model="dataSmtp"
|
||||
ref="dataSmtp"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
class="tab-one"
|
||||
:model="dataSmtp"
|
||||
ref="dataSmtp"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
class="tab-one"
|
||||
>
|
||||
<el-form-item label="服务器地址" prop="host">
|
||||
<el-input v-model="dataSmtp.host"></el-input>
|
||||
@@ -20,9 +20,9 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input
|
||||
type="password"
|
||||
v-model="dataSmtp.password"
|
||||
placeholder="密码为空则不修改"
|
||||
type="password"
|
||||
v-model="dataSmtp.password"
|
||||
placeholder="密码为空则不修改"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="加密类型" prop="encryption">
|
||||
@@ -37,7 +37,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('dataSmtp')"
|
||||
>保存</el-button
|
||||
>保存
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('dataSmtp')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -46,19 +47,19 @@
|
||||
|
||||
<el-tab-pane label="审计日志" name="dataAuditLog">
|
||||
<el-form
|
||||
:model="dataAuditLog"
|
||||
ref="dataAuditLog"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
class="tab-one"
|
||||
:model="dataAuditLog"
|
||||
ref="dataAuditLog"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
class="tab-one"
|
||||
>
|
||||
<el-form-item label="审计去重间隔" prop="audit_interval">
|
||||
<el-input-number
|
||||
v-model="dataAuditLog.audit_interval"
|
||||
:min="-1"
|
||||
size="small"
|
||||
label="秒"
|
||||
:disabled="true"
|
||||
v-model="dataAuditLog.audit_interval"
|
||||
:min="-1"
|
||||
size="small"
|
||||
label="秒"
|
||||
:disabled="true"
|
||||
></el-input-number>
|
||||
秒
|
||||
<p class="input_tip">
|
||||
@@ -68,11 +69,11 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="存储时长" prop="life_day">
|
||||
<el-input-number
|
||||
v-model="dataAuditLog.life_day"
|
||||
:min="0"
|
||||
:max="365"
|
||||
size="small"
|
||||
label="天数"
|
||||
v-model="dataAuditLog.life_day"
|
||||
:min="0"
|
||||
:max="365"
|
||||
size="small"
|
||||
label="天数"
|
||||
></el-input-number>
|
||||
天
|
||||
<p class="input_tip">
|
||||
@@ -82,22 +83,23 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="清理时间" prop="clear_time">
|
||||
<el-time-select
|
||||
v-model="dataAuditLog.clear_time"
|
||||
:picker-options="{
|
||||
v-model="dataAuditLog.clear_time"
|
||||
:picker-options="{
|
||||
start: '00:00',
|
||||
step: '01:00',
|
||||
end: '23:00',
|
||||
}"
|
||||
:editable="false"
|
||||
size="small"
|
||||
placeholder="请选择"
|
||||
style="width: 130px"
|
||||
:editable="false"
|
||||
size="small"
|
||||
placeholder="请选择"
|
||||
style="width: 130px"
|
||||
>
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('dataAuditLog')"
|
||||
>保存</el-button
|
||||
>保存
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('dataAuditLog')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -105,33 +107,34 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="证书设置" name="datacertManage">
|
||||
<el-tabs
|
||||
tab-position="left"
|
||||
v-model="datacertManage"
|
||||
@tab-click="handleClick"
|
||||
tab-position="left"
|
||||
v-model="datacertManage"
|
||||
@tab-click="handleClick"
|
||||
>
|
||||
<el-tab-pane label="自定义证书" name="customCert">
|
||||
<el-form
|
||||
ref="customCert"
|
||||
:model="customCert"
|
||||
label-width="100px"
|
||||
size="small"
|
||||
class="tab-one"
|
||||
ref="customCert"
|
||||
:model="customCert"
|
||||
label-width="100px"
|
||||
size="small"
|
||||
class="tab-one"
|
||||
>
|
||||
<el-form-item>
|
||||
<el-upload
|
||||
class="uploadCert"
|
||||
:before-upload="beforeCertUpload"
|
||||
:action="certUpload"
|
||||
:limit="1"
|
||||
class="uploadCert"
|
||||
:before-upload="beforeCertUpload"
|
||||
:action="certUpload"
|
||||
:limit="1"
|
||||
>
|
||||
<el-button size="mini" icon="el-icon-plus" slot="trigger"
|
||||
>证书文件</el-button
|
||||
>证书文件
|
||||
</el-button
|
||||
>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
content="请上传 .pem 格式的 cert 文件"
|
||||
placement="top"
|
||||
class="item"
|
||||
effect="dark"
|
||||
content="请上传 .pem 格式的 cert 文件"
|
||||
placement="top"
|
||||
>
|
||||
<i class="el-icon-info"></i>
|
||||
</el-tooltip>
|
||||
@@ -139,19 +142,20 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-upload
|
||||
class="uploadCert"
|
||||
:before-upload="beforeKeyUpload"
|
||||
:action="certUpload"
|
||||
:limit="1"
|
||||
class="uploadCert"
|
||||
:before-upload="beforeKeyUpload"
|
||||
:action="certUpload"
|
||||
:limit="1"
|
||||
>
|
||||
<el-button size="mini" icon="el-icon-plus" slot="trigger"
|
||||
>私钥文件</el-button
|
||||
>私钥文件
|
||||
</el-button
|
||||
>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
content="请上传 .pem 格式的 key 文件"
|
||||
placement="top"
|
||||
class="item"
|
||||
effect="dark"
|
||||
content="请上传 .pem 格式的 key 文件"
|
||||
placement="top"
|
||||
>
|
||||
<i class="el-icon-info"></i>
|
||||
</el-tooltip>
|
||||
@@ -159,23 +163,24 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
size="small"
|
||||
icon="el-icon-upload"
|
||||
type="primary"
|
||||
@click="submitForm('customCert')"
|
||||
>上传</el-button
|
||||
size="small"
|
||||
icon="el-icon-upload"
|
||||
type="primary"
|
||||
@click="submitForm('customCert')"
|
||||
>上传
|
||||
</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="Let's Encrypt证书" name="letsCert">
|
||||
<el-form
|
||||
:model="letsCert"
|
||||
ref="letsCert"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
size="small"
|
||||
class="tab-one"
|
||||
:model="letsCert"
|
||||
ref="letsCert"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
size="small"
|
||||
class="tab-one"
|
||||
>
|
||||
<el-form-item label="域名" prop="domain">
|
||||
<el-input v-model="letsCert.domain"></el-input>
|
||||
@@ -191,30 +196,31 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-for="component in dnsProvider[letsCert.name]"
|
||||
:key="component.prop"
|
||||
:label="component.label"
|
||||
:rules="component.rules"
|
||||
v-for="component in dnsProvider[letsCert.name]"
|
||||
:key="component.prop"
|
||||
:label="component.label"
|
||||
:rules="component.rules"
|
||||
>
|
||||
<component
|
||||
:is="component.component"
|
||||
:type="component.type"
|
||||
v-model="letsCert[letsCert.name][component.prop]"
|
||||
:is="component.component"
|
||||
:type="component.type"
|
||||
v-model="letsCert[letsCert.name][component.prop]"
|
||||
></component>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-switch
|
||||
style="display: block"
|
||||
v-model="letsCert.renew"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
inactive-text="自动续期"
|
||||
style="display: block"
|
||||
v-model="letsCert.renew"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
inactive-text="自动续期"
|
||||
>
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('letsCert')"
|
||||
>申请</el-button
|
||||
>申请
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('letsCert')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -224,11 +230,11 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="其他设置" name="dataOther">
|
||||
<el-form
|
||||
:model="dataOther"
|
||||
ref="dataOther"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
class="tab-one"
|
||||
:model="dataOther"
|
||||
ref="dataOther"
|
||||
:rules="rules"
|
||||
label-width="130px"
|
||||
class="tab-one"
|
||||
>
|
||||
<el-form-item label="vpn对外地址" prop="link_addr">
|
||||
<el-input placeholder="请输入内容" v-model="dataOther.link_addr">
|
||||
@@ -237,49 +243,58 @@
|
||||
|
||||
<el-form-item label="Banner信息" prop="banner">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
placeholder="请输入内容"
|
||||
v-model="dataOther.banner"
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
placeholder="请输入内容"
|
||||
v-model="dataOther.banner"
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="自定义首页状态码" prop="homecode">
|
||||
<el-input-number
|
||||
v-model="dataOther.homecode"
|
||||
:min="0"
|
||||
:max="1000"
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="自定义首页" prop="homeindex">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
placeholder="请输入内容"
|
||||
v-model="dataOther.homeindex"
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
placeholder="请输入内容"
|
||||
v-model="dataOther.homeindex"
|
||||
>
|
||||
</el-input>
|
||||
<el-tooltip content="自定义内容可以参考 home 目录下的文件" placement="top">
|
||||
<el-tooltip content="自定义内容可以参考 index_template 目录下的文件" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="账户开通邮件" prop="account_mail">
|
||||
<el-form-item label="账户开通邮件模板" prop="account_mail">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
placeholder="请输入内容"
|
||||
v-model="dataOther.account_mail"
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
placeholder="请输入内容"
|
||||
v-model="dataOther.account_mail"
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="邮件展示">
|
||||
<iframe
|
||||
width="500px"
|
||||
height="300px"
|
||||
:srcdoc="dataOther.account_mail"
|
||||
width="500px"
|
||||
height="300px"
|
||||
:srcdoc="dataOther.account_mail"
|
||||
>
|
||||
</iframe>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('dataOther')"
|
||||
>保存</el-button
|
||||
>保存
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('dataOther')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -324,19 +339,19 @@ export default {
|
||||
authToken: "",
|
||||
},
|
||||
},
|
||||
customCert: { cert: "", key: "" },
|
||||
customCert: {cert: "", key: ""},
|
||||
dataOther: {},
|
||||
rules: {
|
||||
host: { required: true, message: "请输入服务器地址", trigger: "blur" },
|
||||
host: {required: true, message: "请输入服务器地址", trigger: "blur"},
|
||||
port: [
|
||||
{ required: true, message: "请输入服务器端口", trigger: "blur" },
|
||||
{required: true, message: "请输入服务器端口", trigger: "blur"},
|
||||
{
|
||||
type: "number",
|
||||
message: "请输入正确的服务器端口",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
],
|
||||
issuer: { required: true, message: "请输入系统名称", trigger: "blur" },
|
||||
issuer: {required: true, message: "请输入系统名称", trigger: "blur"},
|
||||
domain: {
|
||||
required: true,
|
||||
message: "请输入需要申请证书的域名",
|
||||
@@ -347,7 +362,7 @@ export default {
|
||||
message: "请输入申请证书的邮箱地址",
|
||||
trigger: "blur",
|
||||
},
|
||||
name: { required: true, message: "请选择域名服务商", trigger: "blur" },
|
||||
name: {required: true, message: "请选择域名服务商", trigger: "blur"},
|
||||
},
|
||||
certUpload: "/set/other/customcert",
|
||||
dnsProvider: {
|
||||
@@ -449,71 +464,71 @@ export default {
|
||||
},
|
||||
getSmtp() {
|
||||
axios
|
||||
.get("/set/other/smtp")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.dataSmtp = rdata.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
.get("/set/other/smtp")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.dataSmtp = rdata.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
getAuditLog() {
|
||||
axios
|
||||
.get("/set/other/audit_log")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.dataAuditLog = rdata.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
.get("/set/other/audit_log")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.dataAuditLog = rdata.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
getletsCert() {
|
||||
axios
|
||||
.get("/set/other/getcertset")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.letsCert = Object.assign({}, this.letsCert, rdata.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
.get("/set/other/getcertset")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.letsCert = Object.assign({}, this.letsCert, rdata.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
getOther() {
|
||||
axios
|
||||
.get("/set/other")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.dataOther = rdata.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
.get("/set/other")
|
||||
.then((resp) => {
|
||||
let rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code !== 0) {
|
||||
this.$message.error(rdata.msg);
|
||||
return;
|
||||
}
|
||||
this.dataOther = rdata.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$message.error("哦,请求出错");
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
@@ -535,16 +550,16 @@ export default {
|
||||
break;
|
||||
case "dataAuditLog":
|
||||
axios
|
||||
.post("/set/other/audit_log/edit", this.dataAuditLog)
|
||||
.then((resp) => {
|
||||
var rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code === 0) {
|
||||
this.$message.success(rdata.msg);
|
||||
} else {
|
||||
this.$message.error(rdata.msg);
|
||||
}
|
||||
});
|
||||
.post("/set/other/audit_log/edit", this.dataAuditLog)
|
||||
.then((resp) => {
|
||||
var rdata = resp.data;
|
||||
console.log(rdata);
|
||||
if (rdata.code === 0) {
|
||||
this.$message.success(rdata.msg);
|
||||
} else {
|
||||
this.$message.error(rdata.msg);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "letsCert":
|
||||
var loading = this.$loading({
|
||||
|
Reference in New Issue
Block a user