mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 10:10:28 +08:00
安全设置检查IP时同时也检查直接连接管理平台的上游IP
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -35,6 +36,11 @@ func (this *UserShouldAuth) BeforeAction(actionPtr actions.ActionWrapper, paramN
|
||||
action.ResponseWriter.WriteHeader(http.StatusForbidden)
|
||||
return false
|
||||
}
|
||||
remoteAddr, _, _ := net.SplitHostPort(action.Request.RemoteAddr)
|
||||
if len(remoteAddr) > 0 && remoteAddr != action.RequestRemoteIP() && !checkIP(securityConfig, remoteAddr) {
|
||||
action.ResponseWriter.WriteHeader(http.StatusForbidden)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user