mod: add configuration for key.dir and key.name
This commit is contained in:
@@ -34,10 +34,10 @@ func setupLogging() {
|
||||
// all if no user is given) the application `name` with the provided arguments
|
||||
// `args` as the ssh session. The ssh session will always allocate an pty
|
||||
// (necessary for tui applications).
|
||||
func setupSshServer(host string, port string, users map[string]string, name string, args []string) (*ssh.Server, error) {
|
||||
func setupSshServer(host string, port string, host_key_path string, users map[string]string, name string, args []string) (*ssh.Server, error) {
|
||||
return wish.NewServer(
|
||||
wish.WithAddress(net.JoinHostPort(host, port)),
|
||||
wish.WithHostKeyPath(".ssh/ssh_host_ed25519_key"),
|
||||
wish.WithHostKeyPath(host_key_path),
|
||||
wish.WithPublicKeyAuth(func(_ ssh.Context, key ssh.PublicKey) bool {
|
||||
if len(users) == 0 {
|
||||
// no users provided, meaning there is no user authentication, everyone is allowed to connect
|
||||
@@ -69,9 +69,9 @@ func setupSshServer(host string, port string, users map[string]string, name stri
|
||||
}
|
||||
|
||||
// Serve an ssh application using the provided arguments.
|
||||
func Serve(host string, port string, users map[string]string, name string, args []string) {
|
||||
func Serve(host string, port string, host_key_path string, users map[string]string, name string, args []string) {
|
||||
setupLogging()
|
||||
srv, err := setupSshServer(host, port, users, name, args)
|
||||
srv, err := setupSshServer(host, port, host_key_path, users, name, args)
|
||||
if err != nil {
|
||||
log.Error("Could not start server", "error", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user