|
|
@@ -7,6 +7,11 @@ Lib::loadClass('UI');
|
|
|
|
|
|
class Route_Install extends RouteBase {
|
|
|
|
|
|
+ public function __construct() {
|
|
|
+ $this->sshArgsSkipHostKey = ' -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ';
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function handleAuth() {
|
|
|
if (!User::logged()) {
|
|
|
throw new HttpException('Unauthorized', 401);
|
|
|
@@ -631,7 +636,9 @@ jQuery(document).ready(function () {
|
|
|
$sshHostUsr = "{$appLicenceInfo->rootLogin}@{$appLicenceInfo->mainServer}";
|
|
|
$sshArgs = (22 != $appLicenceInfo->sshPort)? "-p {$appLicenceInfo->sshPort}" : '';
|
|
|
$rsyncSshPort = (22 != $appLicenceInfo->sshPort)? "-e 'ssh -p {$appLicenceInfo->sshPort}'" : '';
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (V::get('DBG_REMOTE', '', $_GET)) {// DBG
|
|
|
$cmd = "echo ~";
|
|
|
V::exec("ssh {$sshArgs} {$sshHostUsr} '{$cmd}'", $out, $ret);
|
|
|
@@ -643,7 +650,7 @@ jQuery(document).ready(function () {
|
|
|
}
|
|
|
|
|
|
$cmd = "echo ~";
|
|
|
- V::exec("ssh {$sshArgs} {$sshHostUsr} '{$cmd}'", $out, $ret);
|
|
|
+ V::exec("ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} '{$cmd}'", $out, $ret);
|
|
|
DBG::log([ 'cmd-remote' => $cmd, 'output' => $out ], 'array', "return: {$ret}");
|
|
|
if (empty($out) || empty($out[0])) throw new Exception("Cannot fetch remote home dir");
|
|
|
return $out[0];
|
|
|
@@ -793,7 +800,7 @@ chmod 600 ~/.ssh/authorized_keys;
|
|
|
//$cmd = "ssh server@{$appLicenceInfo->mainServer} 'ls -1 .ssh/'";
|
|
|
//$cmd = "ssh -i ~/.ssh/id_rsa server@{$appLicenceInfo->mainServer} 'ls -1'";
|
|
|
$sshPort = (22 != $appLicenceInfo->sshPort)? "-p {$appLicenceInfo->sshPort}" : '';
|
|
|
- $cmd = "ssh {$sshPort} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no {$appLicenceInfo->rootLogin}@{$appLicenceInfo->mainServer} 'ls -1'";
|
|
|
+ $cmd = "ssh {$sshPort} {$this->sshArgsSkipHostKey} {$appLicenceInfo->rootLogin}@{$appLicenceInfo->mainServer} 'ls -1'";
|
|
|
V::exec("$cmd 2>&1", $out, $ret); // http://php.net/manual/pl/function.exec.php says I saw the exec, system, shell_exec and passthru functions,
|
|
|
//and deduced that the solution was to
|
|
|
//redirect the standard error (stderr) to the standard output (stdout). It's not very clean, since it mixes stderr with stdout, and I only wanted to log the stderr.
|