mirror of https://github.com/bjdgyc/anylink.git
commit
c2642bc183
|
@ -18,3 +18,4 @@ ui/
|
||||||
.idea/
|
.idea/
|
||||||
anylink
|
anylink
|
||||||
data.db
|
data.db
|
||||||
|
conf/*.db
|
|
@ -88,6 +88,7 @@ func addInitData() error {
|
||||||
other := &SettingOther{
|
other := &SettingOther{
|
||||||
LinkAddr: "vpn.xx.com",
|
LinkAddr: "vpn.xx.com",
|
||||||
Banner: "您已接入公司网络,请按照公司规定使用。\n请勿进行非工作下载及视频行为!",
|
Banner: "您已接入公司网络,请按照公司规定使用。\n请勿进行非工作下载及视频行为!",
|
||||||
|
Homeindex: "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。",
|
||||||
AccountMail: accountMail,
|
AccountMail: accountMail,
|
||||||
}
|
}
|
||||||
err = SettingSessAdd(sess, other)
|
err = SettingSessAdd(sess, other)
|
||||||
|
|
|
@ -22,6 +22,7 @@ type SettingSmtp struct {
|
||||||
type SettingOther struct {
|
type SettingOther struct {
|
||||||
LinkAddr string `json:"link_addr"`
|
LinkAddr string `json:"link_addr"`
|
||||||
Banner string `json:"banner"`
|
Banner string `json:"banner"`
|
||||||
|
Homeindex string `json:"homeindex"`
|
||||||
AccountMail string `json:"account_mail"`
|
AccountMail string `json:"account_mail"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
@ -28,7 +27,7 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(r.Body)
|
body, err := io.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
|
@ -188,39 +187,40 @@ var auth_complete = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
</config-auth>
|
</config-auth>
|
||||||
`
|
`
|
||||||
|
|
||||||
var auth_profile = `<?xml version="1.0" encoding="UTF-8"?>
|
// var auth_profile = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">
|
// <AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">
|
||||||
|
|
||||||
<ClientInitialization>
|
// <ClientInitialization>
|
||||||
<UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon>
|
// <UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon>
|
||||||
<StrictCertificateTrust>false</StrictCertificateTrust>
|
// <StrictCertificateTrust>false</StrictCertificateTrust>
|
||||||
<RestrictPreferenceCaching>false</RestrictPreferenceCaching>
|
// <RestrictPreferenceCaching>false</RestrictPreferenceCaching>
|
||||||
<RestrictTunnelProtocols>IPSec</RestrictTunnelProtocols>
|
// <RestrictTunnelProtocols>IPSec</RestrictTunnelProtocols>
|
||||||
<BypassDownloader>true</BypassDownloader>
|
// <BypassDownloader>true</BypassDownloader>
|
||||||
<WindowsVPNEstablishment>AllowRemoteUsers</WindowsVPNEstablishment>
|
// <WindowsVPNEstablishment>AllowRemoteUsers</WindowsVPNEstablishment>
|
||||||
<CertEnrollmentPin>pinAllowed</CertEnrollmentPin>
|
// <CertEnrollmentPin>pinAllowed</CertEnrollmentPin>
|
||||||
<CertificateMatch>
|
// <CertificateMatch>
|
||||||
<KeyUsage>
|
// <KeyUsage>
|
||||||
<MatchKey>Digital_Signature</MatchKey>
|
// <MatchKey>Digital_Signature</MatchKey>
|
||||||
</KeyUsage>
|
// </KeyUsage>
|
||||||
<ExtendedKeyUsage>
|
// <ExtendedKeyUsage>
|
||||||
<ExtendedMatchKey>ClientAuth</ExtendedMatchKey>
|
// <ExtendedMatchKey>ClientAuth</ExtendedMatchKey>
|
||||||
</ExtendedKeyUsage>
|
// </ExtendedKeyUsage>
|
||||||
</CertificateMatch>
|
// </CertificateMatch>
|
||||||
|
|
||||||
<BackupServerList>
|
// <BackupServerList>
|
||||||
<HostAddress>localhost</HostAddress>
|
// <HostAddress>localhost</HostAddress>
|
||||||
</BackupServerList>
|
// </BackupServerList>
|
||||||
</ClientInitialization>
|
// </ClientInitialization>
|
||||||
|
|
||||||
<ServerList>
|
// <ServerList>
|
||||||
<HostEntry>
|
// <HostEntry>
|
||||||
<HostName>VPN Server</HostName>
|
// <HostName>VPN Server</HostName>
|
||||||
<HostAddress>localhost</HostAddress>
|
// <HostAddress>localhost</HostAddress>
|
||||||
</HostEntry>
|
// </HostEntry>
|
||||||
</ServerList>
|
// </ServerList>
|
||||||
</AnyConnectProfile>
|
//
|
||||||
`
|
// </AnyConnectProfile>
|
||||||
|
// `
|
||||||
var ds_domains_xml = `
|
var ds_domains_xml = `
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<config-auth client="vpn" type="complete" aggregate-auth-version="2">
|
<config-auth client="vpn" type="complete" aggregate-auth-version="2">
|
||||||
|
|
|
@ -6,13 +6,13 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bjdgyc/anylink/admin"
|
"github.com/bjdgyc/anylink/admin"
|
||||||
|
"github.com/bjdgyc/anylink/dbdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LinkHome(w http.ResponseWriter, r *http.Request) {
|
func LinkHome(w http.ResponseWriter, r *http.Request) {
|
||||||
// fmt.Println(r.RemoteAddr)
|
// fmt.Println(r.RemoteAddr)
|
||||||
// hu, _ := httputil.DumpRequest(r, true)
|
// hu, _ := httputil.DumpRequest(r, true)
|
||||||
// fmt.Println("DumpHome: ", string(hu))
|
// fmt.Println("DumpHome: ", string(hu))
|
||||||
|
|
||||||
connection := strings.ToLower(r.Header.Get("Connection"))
|
connection := strings.ToLower(r.Header.Get("Connection"))
|
||||||
userAgent := strings.ToLower(r.UserAgent())
|
userAgent := strings.ToLower(r.UserAgent())
|
||||||
if connection == "close" && (strings.Contains(userAgent, "anyconnect") || strings.Contains(userAgent, "openconnect")) {
|
if connection == "close" && (strings.Contains(userAgent, "anyconnect") || strings.Contains(userAgent, "openconnect")) {
|
||||||
|
@ -20,9 +20,11 @@ func LinkHome(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
index := &dbdata.SettingOther{}
|
||||||
|
dbdata.SettingGet(index)
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
fmt.Fprintln(w, "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。")
|
fmt.Fprintln(w, index.Homeindex)
|
||||||
|
// fmt.Fprintln(w, "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。")
|
||||||
}
|
}
|
||||||
|
|
||||||
func LinkOtpQr(w http.ResponseWriter, r *http.Request) {
|
func LinkOtpQr(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ func checkMacvtap() {
|
||||||
|
|
||||||
ifName := "anylinkMacvtap"
|
ifName := "anylinkMacvtap"
|
||||||
// 加载 macvtap
|
// 加载 macvtap
|
||||||
cmdstr0 := fmt.Sprintf("modprobe -i macvtap")
|
cmdstr0 := fmt.Sprintln("modprobe -i macvtap")
|
||||||
// 开启主网卡混杂模式
|
// 开启主网卡混杂模式
|
||||||
cmdstr1 := fmt.Sprintf("ip link set dev %s promisc on", base.Cfg.Ipv4Master)
|
cmdstr1 := fmt.Sprintf("ip link set dev %s promisc on", base.Cfg.Ipv4Master)
|
||||||
// 测试 macvtap 功能
|
// 测试 macvtap 功能
|
||||||
|
@ -66,9 +66,9 @@ func LinkMacvtap(cSess *sessdata.ConnSession) error {
|
||||||
return createVtap(cSess, ifName)
|
return createVtap(cSess, ifName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkIpvtap() {
|
// func checkIpvtap() {
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 创建 Ipvtap 网卡
|
// 创建 Ipvtap 网卡
|
||||||
func LinkIpvtap(cSess *sessdata.ConnSession) error {
|
func LinkIpvtap(cSess *sessdata.ConnSession) error {
|
||||||
|
|
|
@ -51,6 +51,15 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="自定义首页" prop="homeindex">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:rows="5"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
v-model="dataOther.homeindex">
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="账户开通邮件" prop="account_mail">
|
<el-form-item label="账户开通邮件" prop="account_mail">
|
||||||
<el-input
|
<el-input
|
||||||
type="textarea"
|
type="textarea"
|
||||||
|
|
Loading…
Reference in New Issue