Compare commits
4 Commits
v1.2.0-sta
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
56f0a8dd64 | ||
|
c85e21231b | ||
|
6146f74c72 | ||
|
c2a03bfdcf |
105
Main.go
105
Main.go
@ -1,48 +1,57 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/SommerEngineering/SSHTunnel/Tunnel"
|
"github.com/SommerEngineering/SSHTunnel/Tunnel"
|
||||||
"golang.org/x/crypto/ssh"
|
"github.com/howeyc/gopass"
|
||||||
"runtime"
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
"log"
|
||||||
|
"os"
|
||||||
func main() {
|
"runtime"
|
||||||
|
)
|
||||||
// Show the current version:
|
|
||||||
fmt.Println(`SSHTunnel v1.2.0`)
|
func main() {
|
||||||
|
|
||||||
// Allow Go to use all CPUs:
|
// Show the current version:
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
log.Println(`SSHTunnel v1.3.0`)
|
||||||
|
|
||||||
// Read the configuration from the command-line args:
|
// Allow Go to use all CPUs:
|
||||||
readFlags()
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
||||||
// Check if the password was provided:
|
// Read the configuration from the command-line args:
|
||||||
for true {
|
readFlags()
|
||||||
if password == `` {
|
|
||||||
// Promt for the password:
|
// Check if the password was provided:
|
||||||
fmt.Println(`Please provide the password for the connection:`)
|
for true {
|
||||||
fmt.Scanln(&password)
|
if password == `` {
|
||||||
} else {
|
// Promt for the password:
|
||||||
break
|
fmt.Println(`Please provide the password for the connection:`)
|
||||||
}
|
if pass, errPass := gopass.GetPasswd(); errPass != nil {
|
||||||
}
|
log.Println(`There was an error reading the password securely: ` + errPass.Error())
|
||||||
|
os.Exit(1)
|
||||||
// Create the SSH configuration:
|
return
|
||||||
Tunnel.SetPassword4Callback(password)
|
} else {
|
||||||
config := &ssh.ClientConfig{
|
password = string(pass)
|
||||||
User: username,
|
}
|
||||||
Auth: []ssh.AuthMethod{
|
} else {
|
||||||
ssh.Password(password),
|
break
|
||||||
ssh.PasswordCallback(Tunnel.PasswordCallback),
|
}
|
||||||
ssh.KeyboardInteractive(Tunnel.KeyboardInteractiveChallenge),
|
}
|
||||||
},
|
|
||||||
}
|
// Create the SSH configuration:
|
||||||
|
Tunnel.SetPassword4Callback(password)
|
||||||
// Create the local end-point:
|
config := &ssh.ClientConfig{
|
||||||
localListener := Tunnel.CreateLocalEndPoint(localAddrString)
|
User: username,
|
||||||
|
Auth: []ssh.AuthMethod{
|
||||||
// Accept client connections (will block forever):
|
ssh.Password(password),
|
||||||
Tunnel.AcceptClients(localListener, config, serverAddrString, remoteAddrString)
|
ssh.PasswordCallback(Tunnel.PasswordCallback),
|
||||||
}
|
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)
|
||||||
|
}
|
||||||
|
@ -22,6 +22,7 @@ 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).
|
||||||
|
Loading…
Reference in New Issue
Block a user