mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-07 15:47:00 +02:00
bug fix: adding remote destinations
This commit is contained in:
@@ -924,6 +924,11 @@ class backupUtilities:
|
|||||||
expectation.append("Permission denied")
|
expectation.append("Permission denied")
|
||||||
expectation.append("100%")
|
expectation.append("100%")
|
||||||
|
|
||||||
|
## Temp changes
|
||||||
|
|
||||||
|
command = 'chmod 600 %s' % ('/root/.ssh/cyberpanel.pub')
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
command = "scp -o StrictHostKeyChecking=no -P " + port + " /root/.ssh/cyberpanel.pub " + user + "@" + IPAddress + ":~/.ssh/authorized_keys"
|
command = "scp -o StrictHostKeyChecking=no -P " + port + " /root/.ssh/cyberpanel.pub " + user + "@" + IPAddress + ":~/.ssh/authorized_keys"
|
||||||
setupKeys = pexpect.spawn(command, timeout=3)
|
setupKeys = pexpect.spawn(command, timeout=3)
|
||||||
|
|
||||||
@@ -949,15 +954,32 @@ class backupUtilities:
|
|||||||
else:
|
else:
|
||||||
raise BaseException
|
raise BaseException
|
||||||
|
|
||||||
|
## Temp changes
|
||||||
|
|
||||||
|
command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel.pub')
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
return [1, "None"]
|
return [1, "None"]
|
||||||
|
|
||||||
except pexpect.TIMEOUT as msg:
|
except pexpect.TIMEOUT as msg:
|
||||||
|
|
||||||
|
command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel')
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]")
|
||||||
return [0, "TIMEOUT [sendKey]"]
|
return [0, "TIMEOUT [sendKey]"]
|
||||||
except pexpect.EOF as msg:
|
except pexpect.EOF as msg:
|
||||||
|
|
||||||
|
command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel')
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]")
|
||||||
return [0, "EOF [sendKey]"]
|
return [0, "EOF [sendKey]"]
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
|
|
||||||
|
command = 'chmod 644 %s' % ('/root/.ssh/cyberpanel')
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [sendKey]")
|
||||||
return [0, str(msg) + " [sendKey]"]
|
return [0, str(msg) + " [sendKey]"]
|
||||||
|
|
||||||
@@ -980,7 +1002,7 @@ class backupUtilities:
|
|||||||
expectation.append("Permission denied")
|
expectation.append("Permission denied")
|
||||||
expectation.append("File exists")
|
expectation.append("File exists")
|
||||||
|
|
||||||
command = "ssh -o StrictHostKeyChecking=no -p " + port + ' ' + user + "@" + IPAddress + ' "mkdir ~/.ssh || rm -f ~/.ssh/temp && rm -f ~/.ssh/authorized_temp && cp ~/.ssh/authorized_keys ~/.ssh/temp"'
|
command = "ssh -o StrictHostKeyChecking=no -p " + port + ' ' + user + "@" + IPAddress + ' "mkdir ~/.ssh || rm -f ~/.ssh/temp && rm -f ~/.ssh/authorized_temp && cp ~/.ssh/authorized_keys ~/.ssh/temp || chmod 700 ~/.ssh || chmod g-w ~"'
|
||||||
setupKeys = pexpect.spawn(command, timeout=3)
|
setupKeys = pexpect.spawn(command, timeout=3)
|
||||||
|
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
@@ -1182,6 +1204,7 @@ class backupUtilities:
|
|||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel " + user + "@" + IPAddress + ' "cat ~/.ssh/authorized_temp > ~/.ssh/authorized_keys"'
|
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel " + user + "@" + IPAddress + ' "cat ~/.ssh/authorized_temp > ~/.ssh/authorized_keys"'
|
||||||
|
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
|
|||||||
Reference in New Issue
Block a user