-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Basic auth + Support TLS verification skip (for self signed certs) + Added trend analysis + Added referer and file type analysis + Added cert expire day display + Moved subdomain proxy logic to dpcore
- Loading branch information
Showing
18 changed files
with
792 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ src/conf/* | |
src/ReverseProxy_*_* | ||
src/Zoraxy_*_* | ||
src/certs/* | ||
src/rules/* | ||
src/rules/* | ||
src/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package dynamicproxy | ||
|
||
import ( | ||
"errors" | ||
"net/http" | ||
|
||
"imuslab.com/zoraxy/mod/auth" | ||
) | ||
|
||
/* | ||
BasicAuth.go | ||
This file handles the basic auth on proxy endpoints | ||
if RequireBasicAuth is set to true | ||
*/ | ||
|
||
func (h *ProxyHandler) handleBasicAuthRouting(w http.ResponseWriter, r *http.Request, pe *ProxyEndpoint) error { | ||
proxyType := "vdir-auth" | ||
if pe.ProxyType == ProxyType_Subdomain { | ||
proxyType = "subd-auth" | ||
} | ||
u, p, ok := r.BasicAuth() | ||
if !ok { | ||
w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`) | ||
w.WriteHeader(401) | ||
return errors.New("unauthorized") | ||
} | ||
|
||
//Check for the credentials to see if there is one matching | ||
hashedPassword := auth.Hash(p) | ||
matchingFound := false | ||
for _, cred := range pe.BasicAuthCredentials { | ||
if u == cred.Username && hashedPassword == cred.PasswordHash { | ||
matchingFound = true | ||
break | ||
} | ||
} | ||
|
||
if !matchingFound { | ||
h.logRequest(r, false, 401, proxyType, pe.Domain) | ||
w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`) | ||
w.WriteHeader(401) | ||
return errors.New("unauthorized") | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.