xxh
xxh copied to clipboard
++pexpect-timeout values in config.xxhc are ignored
Local OS (where xxh is installed): Ubuntu 20.04 Destination host OS: n/a xxh version: xxh/0.8.10 xxh-plugins installed: none
Problem statement
Some hosts I want to use xxh
with have very slow authentication procedures - I can see from ssh -vv
that it takes ~20s for the remote end to accept my private key, and additional ~10s to then launch a shell. It an enterprise environment, and likely the delay is caused by audit procedures and mounting network drives etc.
By default xxh
only waits 6s for the remote session to begin. By adding ++pexpect-timeout=60
to the command line I can extend this and use xxh
without issue. However, I cannot seem to set the same via config.xxhc
: it seems to be ignored!
Steps to Reproduce
For this experiment, I spun up a clean Ubuntu 20.04 LTS VM via Vagrant:
vagrant init bento/ubuntu-20.04 \
&& vagrant up \
&& vagrant ssh
and installed the latest portable xxh
Linux binaries:
cd
mkdir xxh
cd xxh
wget https://github.com/xxh/xxh/releases/download/0.8.10-release2/xxh-portable-musl-alpine-Linux-x86_64.tar.gz
tar -xzf xxh-portable-musl-alpine-Linux-x86_64.tar.gz
./xxh
Below is my baseline test, showing the default behaviour of xxh
. Note the presence of (timeout=6)
, and that I have not created a config.xxhc
configuration file yet:
vagrant@ubuntu-20:~/xxh$ time ./xxh +vv example.com </dev/null
ssh arguments: ['-o', 'StrictHostKeyChecking=accept-new']
RUN SHELL COMMAND: mkdir -v -p /home/vagrant/.xxh /home/vagrant/.xxh/.xxh/plugins /home/vagrant/.xxh/.xxh/shells
Pexpect command (timeout=6): bash -c 'echo -e "xxh_home_realpath=\$(dirname ~/.xxh)/\$(basename ~/.xxh)\n xxh_version=\"dir_not_found\"\n if [[ -d \$xxh_home_realpath ]]; then\n xxh_version=\$([ \"\$(ls -A \$xxh_home_realpath)\" ] && echo \"version_not_found\" || echo \"dir_empty\")\n settings_path=\$xxh_home_realpath/.xxh/xxh_version\n if [[ -f \$settings_path ]]; then\n xxh_version=\$(cat \$settings_path)\n fi\n fi\n echo xxh_home_realpath=\$xxh_home_realpath\n echo xxh_version=\$xxh_version\n echo xxh_shell_exists=\`[ -d \$xxh_home_realpath/.xxh/shells/xxh-shell-xonsh ] && echo \"1\" ||echo \"0\"\`\n echo xxh_home_writable=\`[ -w \$xxh_home_realpath ] && echo \"1\" ||echo \"0\"\`\n echo xxh_parent_home_writable=\$([ -w \$(dirname \$xxh_home_realpath) ] && echo \"1\" ||echo \"0\")\n echo rsync=\`command -v rsync\`\n echo scp=\`command -v scp\`\n echo shell=\`command -v xonsh\`\n echo kernel=\`uname -s\`\n echo arch=\`uname -m\`" | ssh -v "-o" "StrictHostKeyChecking=accept-new" example.com -T "bash -s"'
If I specify ++pexpect-timeout
at the command line the timeout notice changes to (timeout=60)
as desired:`
vagrant@ubuntu-20:~/xxh$ time ./xxh +vv ++pexpect-timeout=60 example.com </dev/null
ssh arguments: ['-o', 'StrictHostKeyChecking=accept-new']
RUN SHELL COMMAND: mkdir -v -p /home/vagrant/.xxh /home/vagrant/.xxh/.xxh/plugins /home/vagrant/.xxh/.xxh/shells
Pexpect command (timeout=60): bash -c 'echo -e "xxh_home_realpath=\$(dirname ~/.xxh)/\$(basename ~/.xxh)\n xxh_version=\"dir_not_found\"\n if [[ -d \$xxh_home_realpath ]]; then\n xxh_version=\$([ \"\$(ls -A \$xxh_home_realpath)\" ] && echo \"version_not_found\" || echo \"dir_empty\")\n settings_path=\$xxh_home_realpath/.xxh/xxh_version\n if [[ -f \$settings_path ]]; then\n xxh_version=\$(cat \$settings_path)\n fi\n fi\n echo xxh_home_realpath=\$xxh_home_realpath\n echo xxh_version=\$xxh_version\n echo xxh_shell_exists=\`[ -d \$xxh_home_realpath/.xxh/shells/xxh-shell-xonsh ] && echo \"1\" ||echo \"0\"\`\n echo xxh_home_writable=\`[ -w \$xxh_home_realpath ] && echo \"1\" ||echo \"0\"\`\n echo xxh_parent_home_writable=\$([ -w \$(dirname \$xxh_home_realpath) ] && echo \"1\" ||echo \"0\")\n echo rsync=\`command -v rsync\`\n echo scp=\`command -v scp\`\n echo shell=\`command -v xonsh\`\n echo kernel=\`uname -s\`\n echo arch=\`uname -m\`" | ssh -v "-o" "StrictHostKeyChecking=accept-new" example.com -T "bash -s"'
However, when I attempt to specify the same via this config.xxhc
:
vagrant@ubuntu-20:~/xxh$ cat ~/.config/xxh/config.xxhc
hosts:
".*":
++pexpect-timeout: "60"
I observe that ++pexpect-timeout
argument appears in the final argument list ( 👍 ), but not not affect the (timeout=)
notice ( 👎 ):
vagrant@ubuntu-20:~/xxh$ time ./xxh +vv example.com </dev/null
Load xxh config from /home/vagrant/.config/xxh/config.xxhc
Load xxh config for host .*
Final arguments list: ['++pexpect-timeout', '60', '+vv', 'example.com']
ssh arguments: ['-o', 'StrictHostKeyChecking=accept-new']
RUN SHELL COMMAND: mkdir -v -p /home/vagrant/.xxh /home/vagrant/.xxh/.xxh/plugins /home/vagrant/.xxh/.xxh/shells
Pexpect command (timeout=6): bash -c 'echo -e "xxh_home_realpath=\$(dirname ~/.xxh)/\$(basename ~/.xxh)\n xxh_version=\"dir_not_found\"\n if [[ -d \$xxh_home_realpath ]]; then\n xxh_version=\$([ \"\$(ls -A \$xxh_home_realpath)\" ] && echo \"version_not_found\" || echo \"dir_empty\")\n settings_path=\$xxh_home_realpath/.xxh/xxh_version\n if [[ -f \$settings_path ]]; then\n xxh_version=\$(cat \$settings_path)\n fi\n fi\n echo xxh_home_realpath=\$xxh_home_realpath\n echo xxh_version=\$xxh_version\n echo xxh_shell_exists=\`[ -d \$xxh_home_realpath/.xxh/shells/xxh-shell-xonsh ] && echo \"1\" ||echo \"0\"\`\n echo xxh_home_writable=\`[ -w \$xxh_home_realpath ] && echo \"1\" ||echo \"0\"\`\n echo xxh_parent_home_writable=\$([ -w \$(dirname \$xxh_home_realpath) ] && echo \"1\" ||echo \"0\")\n echo rsync=\`command -v rsync\`\n echo scp=\`command -v scp\`\n echo shell=\`command -v xonsh\`\n echo kernel=\`uname -s\`\n echo arch=\`uname -m\`" | ssh -v "-o" "StrictHostKeyChecking=accept-new" example.com -T "bash -s"'
Probably the connection takes more time than expected.
Try to increase the timeout by adding "++pexpect-timeout 10" argument.
Pexpect details:
<pexpect.pty_spawn.spawn object at 0x7f94119bc490>
command: /usr/bin/bash
args: ['/usr/bin/bash', '-c', 'echo -e "xxh_home_realpath=\\$(dirname ~/.xxh)/\\$(basename ~/.xxh)\\n xxh_version=\\"dir_not_found\\"\\n if [[ -d \\$xxh_home_realpath ]]; then\\n xxh_version=\\$([ \\"\\$(ls -A \\$xxh_home_realpath)\\" ] && echo \\"version_not_found\\" || echo \\"dir_empty\\")\\n settings_path=\\$xxh_home_realpath/.xxh/xxh_version\\n if [[ -f \\$settings_path ]]; then\\n xxh_version=\\$(cat \\$settings_path)\\n fi\\n fi\\n echo xxh_home_realpath=\\$xxh_home_realpath\\n echo xxh_version=\\$xxh_version\\n echo xxh_shell_exists=\\`[ -d \\$xxh_home_realpath/.xxh/shells/xxh-shell-xonsh ] && echo \\"1\\" ||echo \\"0\\"\\`\\n echo xxh_home_writable=\\`[ -w \\$xxh_home_realpath ] && echo \\"1\\" ||echo \\"0\\"\\`\\n echo xxh_parent_home_writable=\\$([ -w \\$(dirname \\$xxh_home_realpath) ] && echo \\"1\\" ||echo \\"0\\")\\n echo rsync=\\`command -v rsync\\`\\n echo scp=\\`command -v scp\\`\\n echo shell=\\`command -v xonsh\\`\\n echo kernel=\\`uname -s\\`\\n echo arch=\\`uname -m\\`" | ssh -v "-o" "StrictHostKeyChecking=accept-new" example.com -T "bash -s"']
buffer (last 100 chars): b'nfig line 21: Applying options for *\r\r\ndebug1: Connecting to example.com [93.184.216.34] port 22.\r\r\n'
before (last 100 chars): b'nfig line 21: Applying options for *\r\r\ndebug1: Connecting to example.com [93.184.216.34] port 22.\r\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 13198
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
Answer from host is empty. Try again with +v or +vv or try ssh before xxh.
real 0m6.217s
user 0m0.101s
sys 0m0.008s
vagrant@ubuntu-20:~/xxh$
I have also tried using the key=value
form of argument in the YAML, which again looked fine in the final argument list, but didn't have any affect:
hosts:
".*":
++pexpect-timeout=60:
For community:
⬇️ Please click the 👍 reaction instead of leaving a +1
or 👍 comment