Updating.
This commit is contained in:
@ -9,11 +9,12 @@ import (
|
||||
|
||||
// Config - This struct will hold configuration components.
|
||||
type Config struct {
|
||||
Resolver string `json:"resolver"`
|
||||
ResolverPort int `json:"resolverPort"`
|
||||
Domains []string `json:"domains"`
|
||||
JumpHost string `json:"jumpHost"`
|
||||
SplitString string `json:"splitString"`
|
||||
Resolver string `json:"resolver"`
|
||||
ResolverPort int `json:"resolverPort"`
|
||||
Domains []string `json:"domains"`
|
||||
JumpHost string `json:"jumpHost"`
|
||||
SplitString string `json:"splitString"`
|
||||
WindowsGeometry string `json:"windowsGeometry"`
|
||||
}
|
||||
|
||||
//GetConfig gets the configuration values for the api using the file in the supplied configPath.
|
||||
|
@ -22,19 +22,35 @@ func CreateShellAliases(data []string, username string, config config.Config) {
|
||||
racOpts := "-AXt -l"
|
||||
hop := "ssh -AXt"
|
||||
prerac := ""
|
||||
windowsGeometry := config.WindowsGeometry
|
||||
|
||||
host := strings.TrimRight(hostname, stringSplit)
|
||||
fqdn := hostname
|
||||
|
||||
greentext := "tput -T xterm setaf 2; "
|
||||
// redtext := "tput -T xterm setaf 1; "
|
||||
redtext := "tput -T xterm setaf 1; "
|
||||
resettext := "tput -T xterm sgr0; "
|
||||
message := fmt.Sprintf("%vecho \"Authenticating as: %v\";%v", greentext, remoteUser, resettext)
|
||||
|
||||
if txt == "" {
|
||||
fmt.Printf("alias %v=\\'%v%v%v %v@%v \"%v %v %v %v %v\"'\n", host, message, prerac, hop, username, jump, rac, racOpts, remoteUser, fqdn, sudo)
|
||||
} else {
|
||||
fmt.Printf("alias %v=\\'%v%v%v %v@%v \"%v %v %v %v %v\"'\n", host, message, prerac, hop, username, jump, rac, racOpts, remoteUser, fqdn, sudo)
|
||||
// TXT Record Parsing
|
||||
if strings.Contains(txt, "SSH_PORT") {
|
||||
port := strings.TrimLeft(txt, "SSH_PORT=")
|
||||
racOpts = fmt.Sprintf("ssh -AXt -p %v -l", port)
|
||||
} else if strings.Contains(txt, "OS_FAMILY") {
|
||||
osFamily := strings.Split(txt, "=")
|
||||
if osFamily[1] == "ESXi" {
|
||||
sudo = ""
|
||||
remoteUser = "root"
|
||||
} else if osFamily[1] == "Windows" {
|
||||
prerac = fmt.Sprintf("%vecho \"Password: \"; %v", redtext, resettext)
|
||||
hop = "ssh -XCAT"
|
||||
rac = "rdesktop"
|
||||
windowsDomain := ""
|
||||
racOpts = fmt.Sprintf("-r clipboard:CLIPBOARD -a 16 -k en-us -g %v -p - %v -u", windowsGeometry, windowsDomain)
|
||||
sudo = ""
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("alias %v=\\'%v%v%v %v@%v \"%v %v %v %v %v\"'\n", host, message, prerac, hop, username, jump, rac, racOpts, remoteUser, fqdn, sudo)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user