Skip to content

Commit

Permalink
Force lower case aliases and subdomains
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomika committed Dec 12, 2022
1 parent 4b5c2db commit c54d681
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sshmuxer/aliashandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
func handleAliasListener(check *channelForwardMsg, stringPort string, requestMessages string, listenerHolder *utils.ListenerHolder, state *utils.State, sshConn *utils.SSHConnection) (*utils.AliasHolder, *url.URL, string, string, error) {
validAlias, aH := utils.GetOpenAlias(check.Addr, stringPort, state, sshConn)

if !strings.HasPrefix(validAlias, check.Addr) && viper.GetBool("force-requested-aliases") || validAlias == "" {
if !strings.HasPrefix(validAlias, strings.ToLower(check.Addr)) && viper.GetBool("force-requested-aliases") || validAlias == "" {
return nil, nil, "", "", fmt.Errorf("error assigning requested alias to tunnel")
}

Expand Down
2 changes: 1 addition & 1 deletion sshmuxer/httphandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
func handleHTTPListener(check *channelForwardMsg, stringPort string, requestMessages string, listenerHolder *utils.ListenerHolder, state *utils.State, sshConn *utils.SSHConnection, scheme string) (*utils.HTTPHolder, *url.URL, string, error) {
hostUrl, pH := utils.GetOpenHost(check.Addr, state, sshConn)

if (hostUrl == nil || !strings.HasPrefix(hostUrl.Host, check.Addr)) && viper.GetBool("force-requested-subdomains") {
if (hostUrl == nil || !strings.HasPrefix(hostUrl.Host, strings.ToLower(check.Addr))) && viper.GetBool("force-requested-subdomains") {
return nil, nil, "", fmt.Errorf("error assigning requested subdomain to tunnel")
}

Expand Down

0 comments on commit c54d681

Please sign in to comment.