Add support for UNIX socket VNC target

This change add support for targeting a VNC server via a local UNIX
socket. It introduces a new `-target` CLI flag able to handle both TCP
"address:port" and "/path/to/unix.socket" formats, and deprecates the
previous `-targHost` and `-targPort` flags for future removal.
This commit is contained in:
Marc Falzon
2018-11-01 10:14:15 +01:00
parent 06e555775f
commit 9a52a433ea
3 changed files with 24 additions and 7 deletions

View File

@@ -14,8 +14,9 @@ func main() {
var wsPort = flag.String("wsPort", "", "websocket port")
var vncPass = flag.String("vncPass", "", "password on incoming vnc connections to the proxy, defaults to no password")
var recordDir = flag.String("recDir", "", "path to save FBS recordings WILL NOT RECORD if not defined.")
var targetVncPort = flag.String("targPort", "", "target vnc server port")
var targetVncHost = flag.String("targHost", "", "target vnc server host")
var targetVnc = flag.String("target", "", "target vnc server (host:port or /path/to/unix.socket)")
var targetVncPort = flag.String("targPort", "", "target vnc server port (deprecated, use -target)")
var targetVncHost = flag.String("targHost", "", "target vnc server host (deprecated, use -target)")
var targetVncPass = flag.String("targPass", "", "target vnc password")
var logLevel = flag.String("logLevel", "info", "change logging level")
@@ -28,8 +29,8 @@ func main() {
os.Exit(1)
}
if *targetVncPort == "" {
logger.Error("no target vnc server port defined")
if *targetVnc == "" && *targetVncPort == "" {
logger.Error("no target vnc server host/port or socket defined")
flag.Usage()
os.Exit(1)
}
@@ -48,6 +49,7 @@ func main() {
TcpListeningUrl: tcpUrl,
ProxyVncPassword: *vncPass, //empty = no auth
SingleSession: &vncproxy.VncSession{
Target: *targetVnc,
TargetHostname: *targetVncHost,
TargetPort: *targetVncPort,
TargetPassword: *targetVncPass, //"vncPass",