Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh client and server is unusable: Error trying to change window size #256

Open
MatthewCroughan opened this issue Jul 1, 2024 · 0 comments

Comments

@MatthewCroughan
Copy link

When using the scion ssh client and server, the client is able to connect and it is almost fully functional, however the client tries to connect and believes the server failed to spawn the shell. But the server does successfully spawn the shell, and throws an error failing to set the window size via /dev/ptmx. It should also be noted the server not only successfully spawns bash, it also creates a /dev/pts/2 node when the client connection is made:

 |         \-+= 240249 root sudo -E scion-ssh-server -oPort=2200 -oAuthorizedKeysFile=/home/ma
 |           \-+= 240252 root sudo -E scion-ssh-server -oPort=2200 -oAuthorizedKeysFile=/home/
 |             \-+= 240253 root scion-ssh-server -oPort=2200 -oAuthorizedKeysFile=/home/matthe
 |               \--= 245473 matthew bash 
Client
scion-ssh-client -p 2200 17-ffaa:1:xxxx,127.0.0.1 -i ~/.ssh/id_rsa
2024/07/01 14:24:38 Error while updating config: unknown config option: ForwardX11 <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: GlobalKnownHostsFile <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: AddressFamily <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: Host <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: VerifyHostKeyDNS <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: Match <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: HostName <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: Host <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: Host <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: Host <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: ControlPersist <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: ControlPath <invalid reflect.Value>
2024/07/01 14:24:38 Error while updating config: unknown config option: ControlMaster <invalid reflect.Value>
DBUG[07-01|14:24:38] Loaded private key                       IdentityFile=/home/matthew/.ssh/id_rsa
DBUG[07-01|14:24:38] Error loading private key, skipped.      IdentityFile=~/.ssh/identity err="open /home/matthew/.ssh/identity: no such file or directory"
DBUG[07-01|14:24:38] Loaded private key                       IdentityFile=~/.ssh/id_rsa
DBUG[07-01|14:24:38] Error loading private key, skipped.      IdentityFile=~/.ssh/id_dsa err="open /home/matthew/.ssh/id_dsa: no such file or directory"
DBUG[07-01|14:24:38] Error loading private key, skipped.      IdentityFile=~/.ssh/id_ecdsa err="open /home/matthew/.ssh/id_ecdsa: no such file or directory"
DBUG[07-01|14:24:38] Loaded private key                       IdentityFile=~/.ssh/id_ed25519
DBUG[07-01|14:24:38] Configuring password auth 
DBUG[07-01|14:24:39] Checking new host signature host         remote=17-ffaa:1:xxxx,127.0.0.1:2200
2024/07/01 14:24:39 Error starting shell: ssh: could not start shell
panic: Error starting shell: ssh: could not start shell

goroutine 1 [running]:
log.Panicf({0xeb3f97?, 0xffeed8?}, {0xc00059ff28?, 0xff3358?, 0x2?})
	log/log.go:439 +0x65
main.main()
	github.com/netsec-ethz/scion-apps/ssh/client/main.go:189 +0x49d
Server
$ sudo -E scion-ssh-server -oPort=2200 -oAuthorizedKeysFile=/home/matthew/authkeys --config-file /home/matthew/sshd_config 
[sudo] password for matthew: 
DBUG[07-01|13:24:13] Starting SCION SSH server... 
DBUG[07-01|13:24:13] Currently, ListenAddress.Port is ignored (only value from config taken) 
DBUG[07-01|13:24:13] Starting to wait for connections 
DBUG[07-01|13:24:39] Handling new connection 
DBUG[07-01|13:24:39] New SSH connection                       remoteAddress=17-ffaa:1:xxx,127.0.0.1:32790 clientVersion="[83 83 72 45 50 46 48 45 71 111]"
DBUG[07-01|13:24:39] Creating pty... 
DBUG[07-01|13:24:39] Error trying to change window size       error="errno 0" w=191 h=47
EROR[07-01|13:25:09] Could not close connection               error=EOF
DBUG[07-01|13:25:09] Connection to pty copy ended             error=nil
DBUG[07-01|13:25:09] Pty to connection copy ended             error="read /dev/ptmx: input/output error"
EROR[07-01|13:25:09] Error waiting for bash to end            error="signal: killed"
EROR[07-01|13:25:09] Error sending exit status                error=EOF
DBUG[07-01|13:25:09] Session closed 

The code for size setting via ptmx is located in

// setWinsize sets the size of the given pty.
func setWinsize(fd uintptr, w, h uint32) error {
ws := &winsize{Width: uint16(w), Height: uint16(h)}
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws)))
return err
}

Things I've tried to no avail
  • upgrading the creack/pty dependency to v1.1.21
  • using go 1.17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant