Compare commits

..

No commits in common. "master" and "v1.2.0-stable" have entirely different histories.

2 changed files with 48 additions and 58 deletions

105
Main.go
View File

@ -1,57 +1,48 @@
package main package main
import ( import (
"fmt" "fmt"
"github.com/SommerEngineering/SSHTunnel/Tunnel" "github.com/SommerEngineering/SSHTunnel/Tunnel"
"github.com/howeyc/gopass" "golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh" "runtime"
"log" )
"os"
"runtime" func main() {
)
// Show the current version:
func main() { fmt.Println(`SSHTunnel v1.2.0`)
// Show the current version: // Allow Go to use all CPUs:
log.Println(`SSHTunnel v1.3.0`) runtime.GOMAXPROCS(runtime.NumCPU())
// Allow Go to use all CPUs: // Read the configuration from the command-line args:
runtime.GOMAXPROCS(runtime.NumCPU()) readFlags()
// Read the configuration from the command-line args: // Check if the password was provided:
readFlags() for true {
if password == `` {
// Check if the password was provided: // Promt for the password:
for true { fmt.Println(`Please provide the password for the connection:`)
if password == `` { fmt.Scanln(&password)
// Promt for the password: } else {
fmt.Println(`Please provide the password for the connection:`) break
if pass, errPass := gopass.GetPasswd(); errPass != nil { }
log.Println(`There was an error reading the password securely: ` + errPass.Error()) }
os.Exit(1)
return // Create the SSH configuration:
} else { Tunnel.SetPassword4Callback(password)
password = string(pass) config := &ssh.ClientConfig{
} User: username,
} else { Auth: []ssh.AuthMethod{
break ssh.Password(password),
} ssh.PasswordCallback(Tunnel.PasswordCallback),
} ssh.KeyboardInteractive(Tunnel.KeyboardInteractiveChallenge),
},
// Create the SSH configuration: }
Tunnel.SetPassword4Callback(password)
config := &ssh.ClientConfig{ // Create the local end-point:
User: username, localListener := Tunnel.CreateLocalEndPoint(localAddrString)
Auth: []ssh.AuthMethod{
ssh.Password(password), // Accept client connections (will block forever):
ssh.PasswordCallback(Tunnel.PasswordCallback), Tunnel.AcceptClients(localListener, config, serverAddrString, remoteAddrString)
ssh.KeyboardInteractive(Tunnel.KeyboardInteractiveChallenge), }
},
}
// Create the local end-point:
localListener := Tunnel.CreateLocalEndPoint(localAddrString)
// Accept client connections (will block forever):
Tunnel.AcceptClients(localListener, config, serverAddrString, remoteAddrString)
}

View File

@ -22,7 +22,6 @@ SSHTunnel is a tiny small program to tunnel something through a SSH without any
- At the moment, SSHTunnel uses only the password authentication methods. Therefore, it is currently not possible to use e.g. a certificate, etc. Nevertheless, the implementation of this feature is possible. - At the moment, SSHTunnel uses only the password authentication methods. Therefore, it is currently not possible to use e.g. a certificate, etc. Nevertheless, the implementation of this feature is possible.
- The configuration must be provided by using the command-line arguments. It is currently not possible to use e.g. a configuration file. - The configuration must be provided by using the command-line arguments. It is currently not possible to use e.g. a configuration file.
- You can avoid the password argument if you prefer to provide the password on demand. - You can avoid the password argument if you prefer to provide the password on demand.
- [Ocean Remote Connections](https://github.com/SommerEngineering/OceanRemoteConnections) is a simple GUI for SSH Tunnel, PuTTY, RDP and WinSCP.
### Download ### Download
Go and get the latest release from the [release page](https://github.com/SommerEngineering/SSHTunnel/releases). Go and get the latest release from the [release page](https://github.com/SommerEngineering/SSHTunnel/releases).