-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from k0sproject/ssh-header-windows-detect
Detect windows SSH from server header
- Loading branch information
Showing
2 changed files
with
63 additions
and
12 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
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,45 @@ | ||
package ssh | ||
|
||
import "strings" | ||
|
||
// A list of known ssh server version substrings that are used to aid in | ||
// identifying if a server is windows or not. | ||
|
||
var knownPosix = []string{ | ||
"linux", | ||
"darwin", | ||
"bsd", | ||
"unix", | ||
"alpine", | ||
"ubuntu", | ||
"debian", | ||
"suse", | ||
"oracle", | ||
"rhel", | ||
"rocky", | ||
"sles", | ||
"fedora", | ||
"amzn", | ||
"arch", | ||
"centos", | ||
"bodhi", | ||
"elementary", | ||
"gentoo", | ||
"kali", | ||
"mageia", | ||
"manjaro", | ||
"slackware", | ||
"solaris", | ||
"illumos", | ||
"aix", | ||
"dragonfly", | ||
} | ||
|
||
func isKnownPosix(s string) bool { | ||
for _, v := range knownPosix { | ||
if strings.Contains(s, v) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |