Closed prozorecJP closed 1 year ago
That's a known but undocumented edge case. I didn't figure it would be required. :) Do you need this feature or were you just exploring?
Yes, I need that feature if possible.
Okay, I've pushed out a patch. Could you test it and see if this fixes your use case?
Thank you for implementing the feature. I tried but scp failed.
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o SendEnv=TMPDIR -o StrictHostKeyChecking=accept-new -o ControlPath=/tmp/perl_ff_m_ee4F5yYfhkC/control.sock -o ControlMaster=yes -o ControlPersist=30 foxy@192.168.3.2 uname || ver
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_ee4F5yYfhkC/control.sock -o ControlMaster=no foxy@192.168.3.2 which firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_ee4F5yYfhkC/control.sock -o ControlMaster=no foxy@192.168.3.2 "firefox" --version
** ssh -V
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_ee4F5yYfhkC/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_ee4F5yYfhkC/scp/get/file_1.dat
Failed to successfully execute scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_ee4F5yYfhkC/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_ee4F5yYfhkC/scp/get/file_1.dat:scp exited with a 1
It seems that ssh control socket isn't created yet when scp is executed.
Hmmmm. It looks like it can't find the .mozilla/firefox/profiles.ini for the foxy@192.168.3.2 user. Does this file exist? I'll try to put some better diagnostics in to cope with this situation.
Yes, the remote site has the file. I notice that remote log file shows
Oct 15 16:15:19 local ssh-auth-cmd-marionette[60449]: Unrecognisable command "scp -p -f .mozilla/firefox/profiles.ini" with a quoted TMPDIR of "\/tmp" and a root directory regex of "(?^msx:(?^msx:(?:/var)?/tmp)/firefox_marionette_remote\w+)"
It looks that ssh-auth-cmd-marionette can't identify the command.
That's a good catch. Have you copied out the most recent ssh-auth-cmd-marionette file to the remote site?
Yes, I copied the file with 1 modification. FreeBSD perl is located /usr/loca/bin so that I changed the "hash-bang" on the first line.
Since regular expression in ssh-auth-cmd-marionette is too complicated for me, I modified it to accept most commands without strict checking like this.
1c1
< #! /usr/bin/perl -wT
---
> #! /usr/local/bin/perl -wT
190c190
< if ( $ENV{SSH_ORIGINAL_COMMAND} =~ m/^($allowed_commands_regex)$/smx ) {
---
> if ( $ENV{SSH_ORIGINAL_COMMAND} =~ /^([-\@\w. \/\|"\\]+)$/) {
Now I can move a bit forward.
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o SendEnv=TMPDIR -o StrictHostKeyChecking=accept-new -o ControlPath=/tmp/perl_ff_m_npLbsECfiMH/control.sock -o ControlMaster=yes -o ControlPersist=30 foxy@192.168.3.2 uname || ver
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_npLbsECfiMH/control.sock -o ControlMaster=no foxy@192.168.3.2 which firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_npLbsECfiMH/control.sock -o ControlMaster=no foxy@192.168.3.2 "firefox" --version
** ssh -V
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_npLbsECfiMH/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_npLbsECfiMH/scp/get/file_1.dat
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o SendEnv=TMPDIR -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_npLbsECfiMH/control.sock -o ControlMaster=no foxy@192.168.3.2 "firefox" -marionette -safe-mode -headless -P marionette
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_npLbsECfiMH/control.sock -o ControlMaster=no foxy@192.168.3.2 grep -e marionette\.port -e security\.sandbox\.content\.tempDirSuffix -e security\.sandbox\.plugin\.tempDirSuffix .mozilla/firefox/yk5ibwz4.default-release/prefs.js
Command 'ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_npLbsECfiMH/control.sock -o ControlMaster=no foxy@192.168.3.2 grep -e marionette\.port -e security\.sandbox\.content\.tempDirSuffix -e security\.sandbox\.plugin\.tempDirSuffix .mozilla/firefox/yk5ibwz4.default-release/prefs.js did not complete successfully:ssh exited with a 1
The remote file .mozilla/firefox/yk5ibwz4.default-release/prefs.js doesn't contain anything like marionette.port, etc, so that the exist status is 1. This is anticipated and the script shouldn't stop there, should it?
My test suite was not performing correctly. This should now have been corrected. Can you check the latest version? I've updated the #! line in the ssh-auth-cmd-marionette file so it should work on FreeBSD as well.
Thank you for updating. I didn't modify ssh-auth-cmd-marionette at all this time and just copied it. The debug output is a bit different but still scp failed.
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o SendEnv=TMPDIR -o StrictHostKeyChecking=accept-new -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=yes -o ControlPersist=30 foxy@192.168.3.2 uname || ver
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=no foxy@192.168.3.2 which firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=no foxy@192.168.3.2 readlink -f /usr/local/bin/firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=no foxy@192.168.3.2 ls -1 "/usr/local/lib/firefox"
** ssh -V
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=no foxy@192.168.3.2:/usr/local/lib/firefox/application.ini /tmp/perl_ff_m_DfW7kpBKGOf/scp/get/file_1.dat
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=no foxy@192.168.3.2 "firefox" --version
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_DfW7kpBKGOf/scp/get/file_2.dat
Failed to successfully execute scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_DfW7kpBKGOf/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_DfW7kpBKGOf/scp/get/file_2.dat:scp exited with a 1
The log file at remote site showed
Oct 17 20:38:34 local ssh-auth-cmd-marionette[99768]: Executing 'uname || ver'
Oct 17 20:38:34 local ssh-auth-cmd-marionette[99771]: Executing 'which firefox'
Oct 17 20:38:34 local ssh-auth-cmd-marionette[99773]: Executing 'readlink -f /usr/local/bin/firefox'
Oct 17 20:38:35 local ssh-auth-cmd-marionette[99775]: Executing 'ls -1 "/usr/local/lib/firefox"'
Oct 17 20:38:35 local ssh-auth-cmd-marionette[99779]: Unrecognisable command "scp -p -f /usr/local/lib/firefox/application.ini" with a quoted TMPDIR of "\/tmp" and a root directory regex of "(?^msx:(?^msx:(?:/var)?/tmp)/firefox_marionette_remote\w+)"
Oct 17 20:38:35 local ssh-auth-cmd-marionette[99781]: Executing '"firefox" --version'
Oct 17 20:38:35 local ssh-auth-cmd-marionette[99785]: Unrecognisable command "scp -p -f .mozilla/firefox/profiles.ini" with a quoted TMPDIR of "\/tmp" and a root directory regex of "(?^msx:(?^msx:(?:/var)?/tmp)/firefox_marionette_remote\w+)"
Again because regular expression in ssh-auth-cmd-marionette is too complicated to me, I'm not too sure about this path.
165c165
< qr/(?:$root_dir_regex\/profile|[.]mozilla\/firefox\/[[:alnum:].]+)/smx;
---
> qr/(?:$root_dir_regex\/profile|[.]mozilla\/firefox\/[[:alnum:].\-]+)/smx;
177a178
> qr/scp$scp_parameters_regex$profile_path_regex/smx,
but this helps accept commands at remote side, I can create firefox::marionett instance. I don't try much yet but I can browse pages.
Hi, sorry about the delay. I've just pushed another patch, can you give it a go?
It's been quite difficult being able to install an OS that still uses scp server side. Can I ask what you are using?
Ok, thank you for updating. I tried the new one but scp still failed.
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o SendEnv=TMPDIR -o StrictHostKeyChecking=accept-new -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=yes -o ControlPersist=30 foxy@192.168.3.2 uname || ver
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=no foxy@192.168.3.2 which firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=no foxy@192.168.3.2 readlink -f /usr/local/bin/firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=no foxy@192.168.3.2 ls -1 "/usr/local/lib/firefox"
** ssh -V
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=no foxy@192.168.3.2:/usr/local/lib/firefox/application.ini /tmp/perl_ff_m_RVldkwNHwWr/scp/get/file_1.dat
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=no foxy@192.168.3.2 "firefox" --version
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_RVldkwNHwWr/scp/get/file_2.dat
Failed to successfully execute scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_RVldkwNHwWr/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_RVldkwNHwWr/scp/get/file_2.dat:scp exited with a 1
This is log at remote side
Oct 27 20:25:13 local ssh-auth-cmd-marionette[77065]: Executing 'uname || ver'
Oct 27 20:25:13 local ssh-auth-cmd-marionette[77068]: Executing 'which firefox'
Oct 27 20:25:13 local ssh-auth-cmd-marionette[77070]: Executing 'readlink -f /usr/local/bin/firefox'
Oct 27 20:25:13 local ssh-auth-cmd-marionette[77072]: Executing 'ls -1 "/usr/local/lib/firefox"'
Oct 27 20:25:13 local ssh-auth-cmd-marionette[77076]: Unrecognisable command "scp -p -f /usr/local/lib/firefox/application.ini" with a quoted TMPDIR of "\/tmp" and a root directory regex of "(?^msx:(?^msx:(?:/var)?/tmp)/firefox_marionette_remote\w+)"
Oct 27 20:25:14 local ssh-auth-cmd-marionette[77078]: Executing '"firefox" --version'
Oct 27 20:25:14 local ssh-auth-cmd-marionette[77082]: Unrecognisable command "scp -p -f .mozilla/firefox/profiles.ini" with a quoted TMPDIR of "\/tmp" and a root directory regex of "(?^msx:(?^msx:(?:/var)?/tmp)/firefox_marionette_remote\w+)"
I'm using FreeBSD 13.1 at both side.
Okay, that took a long time to re-create the issue. I've started using the -O option to force the old scp protocol in tests. This will be visible with the scp parameter to the new method. Things should be working for this use case now.
Thank you for updating. I tried and grep failed in this case.
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o SendEnv=TMPDIR -o StrictHostKeyChecking=accept-new -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=yes -o ControlPersist=30 foxy@192.168.3.2 uname || ver
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2 which firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2 readlink -f /usr/local/bin/firefox
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2 ls -1 "/usr/local/lib/firefox"
** ssh -V
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2:/usr/local/lib/firefox/application.ini /tmp/perl_ff_m_i0w6QR807Ex/scp/get/file_1.dat
** scp -p -T -P 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2:.mozilla/firefox/profiles.ini /tmp/perl_ff_m_i0w6QR807Ex/scp/get/file_2.dat
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2 ls -1 "/usr/local/lib/firefox"
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o SendEnv=TMPDIR -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2 "firefox" -marionette -safe-mode -headless -P marionette
** ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2 grep -e marionette -e security .mozilla/firefox/yk5ibwz4.default-release/prefs.js
Command 'ssh -2 -p 22 -q -o ServerAliveInterval=15 -o BatchMode=yes -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=yes -o ControlPath=/tmp/perl_ff_m_i0w6QR807Ex/control.sock -o ControlMaster=no foxy@192.168.3.2 grep -e marionette -e security .mozilla/firefox/yk5ibwz4.default-release/prefs.js did not complete successfully:ssh exited with a 1
This is remote side log.
Oct 30 20:58:17 local ssh-auth-cmd-marionette[26175]: Executing 'uname || ver'
Oct 30 20:58:17 local ssh-auth-cmd-marionette[26178]: Executing 'which firefox'
Oct 30 20:58:17 local ssh-auth-cmd-marionette[26180]: Executing 'readlink -f /usr/local/bin/firefox'
Oct 30 20:58:17 local ssh-auth-cmd-marionette[26182]: Executing 'ls -1 "/usr/local/lib/firefox"'
Oct 30 20:58:17 local ssh-auth-cmd-marionette[26186]: Executing 'scp -p -f /usr/local/lib/firefox/application.ini'
Oct 30 20:58:18 local ssh-auth-cmd-marionette[26189]: Executing 'scp -p -f .mozilla/firefox/profiles.ini'
Oct 30 20:58:18 local ssh-auth-cmd-marionette[26193]: Executing 'ls -1 "/usr/local/lib/firefox"'
Oct 30 20:58:18 local ssh-auth-cmd-marionette[26192]: Executing '"firefox" -marionette -safe-mode -headless -P marionette'
Oct 30 20:58:18 local ssh-auth-cmd-marionette[26195]: Unrecognisable command "grep -e marionette -e security .mozilla/firefox/yk5ibwz4.default-release/prefs.js" with a quoted TMPDIR of "\/tmp" and a root directory regex of "(?^msx:(?^msx:(?:/var)?/tmp)/firefox_marionette_remote\w+)"
Because my prefs.js path contains "-", $profile_path_regex should accept "-" as well.
166c166
< qr/(?:$root_dir_regex\/profile|(?:[.]mozilla\/firefox|Library\/Application\\\ Support\/Firefox\/Profiles)\/[[:alnum:].]+)/smx;
---
> qr/(?:$root_dir_regex\/profile|(?:[.]mozilla\/firefox|Library\/Application\\\ Support\/Firefox\/Profiles)\/[[:alnum:].\-]+)/smx;
I locally modified ssh-auth-cmd-marionette and then grep worked, firefox::marionette instance was created.
okay. git pushed.
also added the --scp-only option to ssh-auth-cmd-marionette to disable the option of the sftp protocol
Thank you very much for your all effort. I also checked again and it worked.
Hello.
I tried Firefox::Marionette via ssh with specifying profile but it fails. The script is something like this.
The debug output is
It looks that $self->{_profile_directory} is undef.