mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
Ticket 70 cut ".pub" in case user added it
https://github.com/easy-wi/developer/issues/70
This commit is contained in:
parent
cd55e416b9
commit
56388ce517
@ -129,9 +129,14 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
|||||||
$tsdnsExternalActive=true;
|
$tsdnsExternalActive=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$ssh2=false;
|
||||||
if ($row2['publickey']=='Y') {
|
if ($row2['publickey']=='Y') {
|
||||||
$pubkey="keys/".$row2['keyname'].".pub";
|
|
||||||
$key="keys/".$row2['keyname'];
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($row2['keyname']);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
if (file_exists($pubkey) and file_exists($key)) {
|
if (file_exists($pubkey) and file_exists($key)) {
|
||||||
$ssh2= @ssh2_connect($queryip,$row2['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
$ssh2= @ssh2_connect($queryip,$row2['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
||||||
}
|
}
|
||||||
@ -139,20 +144,12 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
|||||||
$ssh2= @ssh2_connect($queryip,$row2['decryptedssh2port']);
|
$ssh2= @ssh2_connect($queryip,$row2['decryptedssh2port']);
|
||||||
}
|
}
|
||||||
if ($ssh2) {
|
if ($ssh2) {
|
||||||
if ($row2['publickey']=='Y') {
|
$connect_ssh2=($row2['publickey']=='Y') ? @ssh2_auth_pubkey_file($ssh2,$row2['decryptedssh2user'],$pubkey,$key) : @ssh2_auth_password($ssh2,$row2['decryptedssh2user'],$row2['decryptedssh2password']);
|
||||||
$connect_ssh2= @ssh2_auth_pubkey_file($ssh2,$row2['decryptedssh2user'],$pubkey,$key);
|
|
||||||
} else {
|
|
||||||
$connect_ssh2= @ssh2_auth_password($ssh2,$row2['decryptedssh2user'],$row2['decryptedssh2password']);
|
|
||||||
}
|
|
||||||
if ($connect_ssh2) {
|
if ($connect_ssh2) {
|
||||||
$split_config=preg_split('/\//',$row2['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
|
$split_config=preg_split('/\//',$row2['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
|
||||||
$folderfilecount=count($split_config)-1;
|
$folderfilecount=count($split_config)-1;
|
||||||
$i=0;
|
$i=0;
|
||||||
if (substr($row2['serverdir'],0,1)=='/') {
|
$folders= (substr($row2['serverdir'],0,1)=='/') ? 'cd /' : 'cd ';
|
||||||
$folders='cd /';
|
|
||||||
} else {
|
|
||||||
$folders='cd ';
|
|
||||||
}
|
|
||||||
while ($i<=$folderfilecount) {
|
while ($i<=$folderfilecount) {
|
||||||
$folders=$folders.$split_config[$i]."/";
|
$folders=$folders.$split_config[$i]."/";
|
||||||
$i++;
|
$i++;
|
||||||
@ -170,7 +167,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
|||||||
$badLogin=true;
|
$badLogin=true;
|
||||||
print "Error: Can not connect via ssh2\r\n";
|
print "Error: Can not connect via ssh2\r\n";
|
||||||
}
|
}
|
||||||
if (!isset($badLogin) and $connect_ssh2) {
|
if (!isset($badLogin) and isset($connect_ssh2) and $connect_ssh2) {
|
||||||
$tsdown=false;
|
$tsdown=false;
|
||||||
$tsdnsdown=false;
|
$tsdnsdown=false;
|
||||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||||
|
@ -568,13 +568,16 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
|||||||
} else {
|
} else {
|
||||||
$tsdnsbin='tsdnsserver_linux_amd64';
|
$tsdnsbin='tsdnsserver_linux_amd64';
|
||||||
}
|
}
|
||||||
|
$ssh2_2=false;
|
||||||
if ($row['publickey']=='Y') {
|
if ($row['publickey']=='Y') {
|
||||||
$pubkey="keys/".$row['keyname'].".pub";
|
|
||||||
$key="keys/".$row['keyname'];
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($row['keyname']);
|
||||||
|
$pubkey='keys/'.$sshkey.'.pub';
|
||||||
|
$key='keys/'.$sshkey;
|
||||||
|
|
||||||
if (file_exists($pubkey) and file_exists($key)) {
|
if (file_exists($pubkey) and file_exists($key)) {
|
||||||
$ssh2_2= ssh2_connect($row['ssh2ip'],$row['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
$ssh2_2= ssh2_connect($row['ssh2ip'],$row['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
||||||
} else {
|
|
||||||
$ssh2_2=false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ssh2_2=ssh2_connect($row['ssh2ip'],$row['decryptedssh2port']);
|
$ssh2_2=ssh2_connect($row['ssh2ip'],$row['decryptedssh2port']);
|
||||||
@ -697,8 +700,12 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
|||||||
$pupdate->execute(array($ts3masternotified,$ts3masterid));
|
$pupdate->execute(array($ts3masternotified,$ts3masterid));
|
||||||
if (($autorestart=='Y' and $ts3masternotified>=$resellersettings[$resellerid]['down_checks']) or ($tsdown!=true and $tsdnsdown==true)) {
|
if (($autorestart=='Y' and $ts3masternotified>=$resellersettings[$resellerid]['down_checks']) or ($tsdown!=true and $tsdnsdown==true)) {
|
||||||
if ($vrow['publickey']=="Y") {
|
if ($vrow['publickey']=="Y") {
|
||||||
$pubkey="keys/".$vrow['keyname'].".pub";
|
|
||||||
$key="keys/".$vrow['keyname'];
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($vrow['keyname']);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($queryip,$vrow['decryptedssh2port'],array('hostkey'=>'ssh-rsa')) : false;
|
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($queryip,$vrow['decryptedssh2port'],array('hostkey'=>'ssh-rsa')) : false;
|
||||||
} else {
|
} else {
|
||||||
$ssh2= @ssh2_connect($queryip,$vrow['decryptedssh2port']);
|
$ssh2= @ssh2_connect($queryip,$vrow['decryptedssh2port']);
|
||||||
|
@ -256,8 +256,12 @@ class rootServer {
|
|||||||
$i=0;
|
$i=0;
|
||||||
unset($tempBad);
|
unset($tempBad);
|
||||||
if ($v['publickey']=="Y") {
|
if ($v['publickey']=="Y") {
|
||||||
$pubkey=EASYWIDIR."/keys/".$v['keyname'].".pub";
|
|
||||||
$key=EASYWIDIR."/keys/".$v['keyname'];
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($v['keyname']);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'],array('hostkey'=>'ssh-rsa')) : false;
|
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'],array('hostkey'=>'ssh-rsa')) : false;
|
||||||
} else {
|
} else {
|
||||||
$ssh2= @ssh2_connect($v['ip'],$v['port']);
|
$ssh2= @ssh2_connect($v['ip'],$v['port']);
|
||||||
@ -314,8 +318,12 @@ class rootServer {
|
|||||||
public function PXEFiles() {
|
public function PXEFiles() {
|
||||||
foreach($this->PXEData as $k=>$v) {
|
foreach($this->PXEData as $k=>$v) {
|
||||||
if ($v['publickey']=="Y") {
|
if ($v['publickey']=="Y") {
|
||||||
$pubkey=EASYWIDIR."/keys/".$v['keyname'].".pub";
|
|
||||||
$key=EASYWIDIR."/keys/".$v['keyname'];
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($v['keyname']);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'],array('hostkey'=>'ssh-rsa')) : false;
|
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'],array('hostkey'=>'ssh-rsa')) : false;
|
||||||
} else {
|
} else {
|
||||||
$ssh2= @ssh2_connect($v['ip'],$v['port']);
|
$ssh2= @ssh2_connect($v['ip'],$v['port']);
|
||||||
@ -444,8 +452,12 @@ class rootServer {
|
|||||||
public function VMWare(){
|
public function VMWare(){
|
||||||
foreach ($this->vmwareHosts as $hID =>$h) {
|
foreach ($this->vmwareHosts as $hID =>$h) {
|
||||||
if ($this->vmwareHosts[$hID]['vmIDs']['publickey']=='Y') {
|
if ($this->vmwareHosts[$hID]['vmIDs']['publickey']=='Y') {
|
||||||
$pubkey=EASYWIDIR."/keys/".$this->vmwareHosts[$hID['hostID']]['vmIDs']['keyname'].".pub";
|
|
||||||
$key=EASYWIDIR."/keys/".$this->vmwareHosts[$hID['hostID']]['vmIDs']['keyname'];
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($this->vmwareHosts[$hID['hostID']]['vmIDs']['keyname']);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport'],array('hostkey'=>'ssh-rsa')) : false;
|
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport'],array('hostkey'=>'ssh-rsa')) : false;
|
||||||
} else {
|
} else {
|
||||||
$ssh2=@ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport']);
|
$ssh2=@ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport']);
|
||||||
|
@ -587,8 +587,11 @@ class TS3 {
|
|||||||
|
|
||||||
function tsbackup ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$notified,$path,$virtualserver_id,$backupid,$reseller_id,$sql,$move=array()) {
|
function tsbackup ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$notified,$path,$virtualserver_id,$backupid,$reseller_id,$sql,$move=array()) {
|
||||||
if ($keyuse=="Y") {
|
if ($keyuse=="Y") {
|
||||||
$pubkey=EASYWIDIR."/keys/".$sshkey.".pub";
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
$key=EASYWIDIR."/keys/".$sshkey;
|
$sshkey=removePub($sshkey);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
if (file_exists($pubkey) and file_exists($key)) {
|
if (file_exists($pubkey) and file_exists($key)) {
|
||||||
$ssh2= @ssh2_connect($sship,$sshport,array('hostkey'=>'ssh-rsa'));
|
$ssh2= @ssh2_connect($sship,$sshport,array('hostkey'=>'ssh-rsa'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1335,4 +1335,12 @@ function workAroundForValveChaos ($appID,$shorten,$toApi=true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $appID;
|
return $appID;
|
||||||
|
}
|
||||||
|
|
||||||
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
function removePub ($string) {
|
||||||
|
if (substr(strtolower($string), -4) == '.pub') {
|
||||||
|
return substr($string, 0, -4);
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
}
|
}
|
@ -56,8 +56,12 @@ if (!function_exists('ssh2_execute')) {
|
|||||||
$ssh2User=$row['decrypteduser'];
|
$ssh2User=$row['decrypteduser'];
|
||||||
$ssh2Pass=$row['decryptedpass'];
|
$ssh2Pass=$row['decryptedpass'];
|
||||||
$ssh2Publickey=$row['publickey'];
|
$ssh2Publickey=$row['publickey'];
|
||||||
$pubkey=EASYWIDIR."/keys/${row['keyname']}.pub";
|
|
||||||
$key=EASYWIDIR."/keys/${row['keyname']}";
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($row['keyname']);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
$ssh2Socket=($ssh2Publickey=='Y') ? (file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($ssh2IP,$ssh2Port,array('hostkey'=>'ssh-rsa')) : false : @ssh2_connect($ssh2IP,$ssh2Port);
|
$ssh2Socket=($ssh2Publickey=='Y') ? (file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($ssh2IP,$ssh2Port,array('hostkey'=>'ssh-rsa')) : false : @ssh2_connect($ssh2IP,$ssh2Port);
|
||||||
if ($ssh2Socket==true) {
|
if ($ssh2Socket==true) {
|
||||||
$ssh2Connect=($ssh2Publickey=='Y') ? @ssh2_auth_pubkey_file($ssh2Socket,$ssh2User,$pubkey,$key) : @ssh2_auth_password($ssh2Socket,$ssh2User,$ssh2Pass);
|
$ssh2Connect=($ssh2Publickey=='Y') ? @ssh2_auth_pubkey_file($ssh2Socket,$ssh2User,$pubkey,$key) : @ssh2_auth_password($ssh2Socket,$ssh2User,$ssh2Pass);
|
||||||
|
@ -78,7 +78,9 @@ if ($ui->w('action',4,'post') and !token(true)) {
|
|||||||
if ($row['newlayout']=='Y') $customer=$customer.'-'.$row['id'];
|
if ($row['newlayout']=='Y') $customer=$customer.'-'.$row['id'];
|
||||||
}
|
}
|
||||||
$template=array();
|
$template=array();
|
||||||
foreach($ui->id('template',10,'post') as $id => $tpl) {
|
# https://github.com/easy-wi/developer/issues/69
|
||||||
|
$templates = (array) $ui->id('template',10,'post');
|
||||||
|
foreach($templates as $id => $tpl) {
|
||||||
if ($tpl>0) {
|
if ($tpl>0) {
|
||||||
$template[]=$tpl;
|
$template[]=$tpl;
|
||||||
if ($ui->active('type','post')=='Y') {
|
if ($ui->active('type','post')=='Y') {
|
||||||
|
@ -449,8 +449,12 @@ if ($ui->w('action',4,'post') and !token(true)) {
|
|||||||
}
|
}
|
||||||
if (($oldactive=='Y' and $active=='N') or ($oldactive=='N' and $active=='Y')) {
|
if (($oldactive=='Y' and $active=='N') or ($oldactive=='N' and $active=='Y')) {
|
||||||
if ($row['publickey']=="Y") {
|
if ($row['publickey']=="Y") {
|
||||||
$pubkey=EASYWIDIR."/keys/".$row['keyname'].".pub";
|
|
||||||
$key=EASYWIDIR."/keys/".$row['keyname'];
|
# https://github.com/easy-wi/developer/issues/70
|
||||||
|
$sshkey=removePub($row['keyname']);
|
||||||
|
$pubkey=EASYWIDIR.'/keys/'.$sshkey.'.pub';
|
||||||
|
$key=EASYWIDIR.'/keys/'.$sshkey;
|
||||||
|
|
||||||
if (file_exists($pubkey) and file_exists($key)) {
|
if (file_exists($pubkey) and file_exists($key)) {
|
||||||
$ssh2= @ssh2_connect($queryip,$row['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
$ssh2= @ssh2_connect($queryip,$row['decryptedssh2port'],array('hostkey'=>'ssh-rsa'));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user