Include IP address in RPC auth failure log message.
This commit is contained in:
parent
9a15453806
commit
97e0149dc3
1 changed files with 3 additions and 2 deletions
|
@ -265,7 +265,8 @@ func (s *rpcServer) checkAuth(r *http.Request, require bool) (bool, error) {
|
|||
authhdr := r.Header["Authorization"]
|
||||
if len(authhdr) <= 0 {
|
||||
if require {
|
||||
rpcsLog.Warnf("Auth failure.")
|
||||
rpcsLog.Warnf("RPC authentication failure from %s",
|
||||
r.RemoteAddr)
|
||||
return false, errors.New("auth failure")
|
||||
}
|
||||
|
||||
|
@ -275,7 +276,7 @@ func (s *rpcServer) checkAuth(r *http.Request, require bool) (bool, error) {
|
|||
authsha := sha256.Sum256([]byte(authhdr[0]))
|
||||
cmp := subtle.ConstantTimeCompare(authsha[:], s.authsha[:])
|
||||
if cmp != 1 {
|
||||
rpcsLog.Warnf("Auth failure.")
|
||||
rpcsLog.Warnf("RPC authentication failure from %s", r.RemoteAddr)
|
||||
return false, errors.New("auth failure")
|
||||
}
|
||||
return true, nil
|
||||
|
|
Loading…
Reference in a new issue