ServerAlive and ClientAlive not working when using Tunnel=point-to-point
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openssh (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
The full IPv4 tunnel don't quit the ssh process when network connectivity fails, thus invalidating the potential benefit of Server/
Here are some config file snippets.
-------
# cat /etc/ssh/
GSSAPIAuthentic
ChallengeRespon
PermitRootLogin yes
Port 22
Protocol 2
HostKey /etc/ssh/
HostKey /etc/ssh/
UsePrivilegeSep
KeyRegeneration
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
StrictModes yes
RSAAuthentication yes
PubkeyAuthentic
IgnoreRhosts yes
RhostsRSAAuthen
HostbasedAuthen
PermitEmptyPass
ChallengeRespon
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/
UsePAM yes
PasswordAuthent
UseDNS no
PermitTunnel yes
ClientAliveInterval 20
ClientAliveCountMax 3
Match User sshtun
ForceCommand /bin/true
# cat /etc/ssh/ssh_config |uncomment
Host *
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentic
GSSAPIDelegateC
ServerAliveInterval 20
ServerAliveCountMax 3
# grep sshtun /etc/passwd
sshtun:
# grep sshtun /etc/shadow
sshtun:
# grep -A6 tun203 /etc/network/
auto tun203
iface tun203 inet manual
pre-up /sbin/ifup venet0:0 >/dev/null 2>&1 || true
pre-up /sbin/ip tuntap add $IFACE mode tun user sshtun
pre-up /sbin/ip link set dev $IFACE up
pre-up /sbin/ip address add 100.127.0.2/32 dev lo >/dev/null 2>&1 || true
post-up /sbin/ip route add 100.127.0.3 dev $IFACE src 100.127.0.2 >/dev/null 2>&1 || true
post-down /sbin/ip link del $IFACE
-------
The purpose of this configuration is to establish a full IPv4 tunnel between initiatorserver
Down below an ssh command that don't show any "client_
-------
sudo -u sshtun ssh -N -T -i /home/sshtun/
debug1: Reading configuration data /home/sshtun/
debug1: /home/sshtun/
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to w1.example.com [203.0.113.1] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 10000 ms remain after connect
debug1: identity file /home/sshtun/
debug1: key_load_public: No such file or directory
debug1: identity file /home/sshtun/
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "w1.example.com" from file "/home/
debug3: load_hostkeys: found key type ED25519 in file /home/sshtun/
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: <email address hidden>,ssh-ed25519
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: <email address hidden>
debug2: kex_parse_kexinit: <email address hidden>
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: none,<email address hidden>,zlib
debug2: kex_parse_kexinit: none,<email address hidden>,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: <email address hidden>
debug2: kex_parse_kexinit: ssh-rsa,ssh-ed25519
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: none,<email address hidden>
debug2: kex_parse_kexinit: none,<email address hidden>
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup <email address hidden>
debug1: kex: server->client aes128-ctr <email address hidden> none
debug2: mac_setup: setup <email address hidden>
debug1: kex: client->server aes128-ctr <email address hidden> none
debug1: sending SSH2_MSG_
debug1: expecting SSH2_MSG_
debug1: Server host key: ED25519 0b:09:31:
debug3: load_hostkeys: loading entries for host "w1.example.com" from file "/home/
debug3: load_hostkeys: found key type ED25519 in file /home/sshtun/
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "203.0.113.1" from file "/home/
debug3: load_hostkeys: found key type ED25519 in file /home/sshtun/
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'w1.example.com' is known and matches the ED25519 host key.
debug1: Found key in /home/sshtun/
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_
debug2: key: /home/sshtun/
debug1: Authentications that can continue: publickey,
debug3: start over, passed a different list publickey,
debug3: preferred gssapi-
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-
debug3: authmethod_
debug1: Next authentication method: publickey
debug1: Offering ED25519 public key: /home/sshtun/
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-ed25519 blen 51
debug2: input_userauth_
debug3: sign_and_
debug1: Authentication succeeded (publickey).
Authenticated to w1.example.com ([203.0.113.1]:22).
debug1: Requesting tun unit 203 in mode 1
debug1: sys_tun_open: tun203 mode 1 fd 4
debug2: fd 4 setting O_NONBLOCK
debug3: fd 4 is O_NONBLOCK
debug1: channel 0: new [tun]
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug1: Requesting <email address hidden>
debug1: Entering interactive session.
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
-------
Please note that the tunnel works and the only thing that lacks is the non-spoofable alive messages system that will quit the process when the ssh vpn partners are unreachable.
Here below there's another ssh command, made by the same initiatorserver, that uses only TCP forwarding.
In the log below, please find the lines with "client_
Those lines show that the alive messages system is working fine, and those lines are what is missing in the previous scenario.
-------
sudo -u sshtun ssh -N -T -i /home/sshtun/
debug1: Reading configuration data /home/sshtun/
debug1: /home/sshtun/
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to w1.example.com [203.0.113.1] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 10000 ms remain after connect
debug1: identity file /home/sshtun/
debug1: key_load_public: No such file or directory
debug1: identity file /home/sshtun/
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "w1.example.com" from file "/home/
debug3: load_hostkeys: found key type ED25519 in file /home/sshtun/
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: <email address hidden>,ssh-ed25519
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: <email address hidden>
debug2: kex_parse_kexinit: <email address hidden>
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: none,<email address hidden>,zlib
debug2: kex_parse_kexinit: none,<email address hidden>,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: <email address hidden>
debug2: kex_parse_kexinit: ssh-rsa,ssh-ed25519
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: none,<email address hidden>
debug2: kex_parse_kexinit: none,<email address hidden>
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup <email address hidden>
debug1: kex: server->client aes128-ctr <email address hidden> none
debug2: mac_setup: setup <email address hidden>
debug1: kex: client->server aes128-ctr <email address hidden> none
debug1: sending SSH2_MSG_
debug1: expecting SSH2_MSG_
debug1: Server host key: ED25519 0b:09:31:
debug3: load_hostkeys: loading entries for host "w1.example.com" from file "/home/
debug3: load_hostkeys: found key type ED25519 in file /home/sshtun/
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "203.0.113.1" from file "/home/
debug3: load_hostkeys: found key type ED25519 in file /home/sshtun/
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'w1.example.com' is known and matches the ED25519 host key.
debug1: Found key in /home/sshtun/
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_
debug2: key: /home/sshtun/
debug1: Authentications that can continue: publickey,
debug3: start over, passed a different list publickey,
debug3: preferred gssapi-
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-
debug3: authmethod_
debug1: Next authentication method: publickey
debug1: Offering ED25519 public key: /home/sshtun/
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-ed25519 blen 51
debug2: input_userauth_
debug3: sign_and_
debug1: Authentication succeeded (publickey).
Authenticated to w1.example.com ([203.0.113.1]:22).
debug1: Local connections to LOCALHOST:55203 forwarded to remote address 127.0.0.1:55203
debug3: channel_
debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY
debug1: Local forwarding listening on ::1 port 55203.
debug2: fd 4 setting O_NONBLOCK
debug3: fd 4 is O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 55203.
debug2: fd 5 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 1: new [port listener]
debug1: Remote connections from LOCALHOST:55302 forwarded to local address 127.0.0.1:55302
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug1: Requesting <email address hidden>
debug1: Entering interactive session.
debug1: remote forward success for: listen 55302, connect 127.0.0.1:55302
debug1: All remote forwarding requests processed
debug1: client_
debug1: client_
debug1: client_
debug1: client_
Timeout, server w1.example.com not responding.