Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions plugins-base/XSFeatureRemoteShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

from XSConsoleStandard import *

SSH_MODE_DISABLE = 0
SSH_MODE_ENABLE = 1
SSH_MODE_AUTO = 2

class DisableOptionsDialogue(Dialogue):
SSH_MODE_DISABLE = 0
SSH_MODE_AUTO = 2

def __init__(self):
Dialogue.__init__(self)

Expand All @@ -31,8 +30,8 @@ def __init__(self):
pane.AddBox()

self.disableMenu = Menu(self, None, Lang("Disable Options"), [
ChoiceDef(Lang("Always Disable"), lambda: self.HandleChoice(SSH_MODE_DISABLE)),
ChoiceDef(Lang("Disable and Turn on Auto-mode"), lambda: self.HandleChoice(SSH_MODE_AUTO))
ChoiceDef(Lang("Always Disable"), lambda: self.HandleChoice(self.SSH_MODE_DISABLE)),
ChoiceDef(Lang("Disable and Turn on Auto-mode"), lambda: self.HandleChoice(self.SSH_MODE_AUTO))
])

self.UpdateFields()
Expand Down Expand Up @@ -67,7 +66,7 @@ def HandleChoice(self, inChoice):
message = Lang("New connections via the remote shell are now disabled, but there are "
"ssh connections still ongoing. If necessary, use 'killall sshd-session' from the Local "
"Command Shell to terminate them.")
if inChoice == SSH_MODE_AUTO:
if inChoice == self.SSH_MODE_AUTO:
data.SetSSHAutoMode(True)
message = Lang("SSH auto-mode has been configured. For security,"
"SSH is normally disabled and will only be enabled in case of emergency.")
Expand All @@ -81,6 +80,8 @@ def HandleChoice(self, inChoice):


class RemoteShellDialogue(Dialogue):
SSH_MODE_ENABLE = 1

def __init__(self):
Dialogue.__init__(self)

Expand All @@ -89,7 +90,7 @@ def __init__(self):
pane.AddBox()

self.remoteShellMenu = Menu(self, None, Lang("Configure Remote Shell"), [
ChoiceDef(Lang("Enable"), lambda: self.HandleChoice(SSH_MODE_ENABLE)),
ChoiceDef(Lang("Enable"), lambda: self.HandleChoice(self.SSH_MODE_ENABLE)),
ChoiceDef(Lang("Disable"), lambda: self.HandleDisable())
])

Expand Down Expand Up @@ -118,7 +119,7 @@ def HandleChoice(self, inChoice):

try:
message = Lang("Configuration Successful")
if inChoice == SSH_MODE_ENABLE:
if inChoice == self.SSH_MODE_ENABLE:
data.EnableSSH()
Layout.Inst().PushDialogue(InfoDialogue(message))

Expand Down