Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions XSConsoleData.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ def update_SR_reference(inPool, retPool, key):
self.UpdateFromKeymap()

self.data['chkconfig'] = {}
self.data['service_active'] = {}
self.ScanService('sshd')
self.ScanService('chronyd')

Expand Down Expand Up @@ -768,6 +769,9 @@ def ScanService(self, service):
(status, output) = getstatusoutput("systemctl is-enabled %s" % (service,))
self.data['chkconfig'][service] = status == 0

(status, output) = getstatusoutput("systemctl is-active %s" % (service,))
self.data['service_active'][service] = status == 0

def ScanResolvConf(self, inLines):
self.data['dns'] = {
'nameservers' : [],
Expand Down
18 changes: 10 additions & 8 deletions plugins-base/XSFeatureRemoteShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def HandleChoice(self, inChoice):
"Command Shell to terminate them.")
if inChoice == self.SSH_MODE_AUTO:
data.SetSSHAutoMode(True)
message = Lang("SSH auto-mode has been configured. For security,"
message = Lang("SSH auto-mode has been configured. For security, "
"SSH is normally disabled and will only be enabled in case of emergency.")

Layout.Inst().PushDialogue(InfoDialogue(message))
Expand Down Expand Up @@ -139,16 +139,18 @@ def StatusUpdateHandler(cls, inPane):
data = Data.Inst()
inPane.AddTitleField(Lang("Remote Shell (ssh)"))

if data.chkconfig.sshd() is None:
message = Lang('unknown. To enable or disable')
elif data.chkconfig.sshd():
message = Lang('enabled. To disable')
is_running = data.service_active.sshd()

if is_running is None:
message = Lang('unknown. To configure')
elif is_running:
message = Lang('running. To stop and disable')
else:
message = Lang('disabled. To enable')
message = Lang('stopped. To start and enable')

inPane.AddWrappedTextField(Lang(
"This server can accept a remote login via ssh. Currently remote login is ") +
message + Lang(" this feature, press <Enter>."))
"This server can accept a remote login via ssh. Currently SSH service is ") +
message + Lang(" SSH service, press <Enter>."))

inPane.AddKeyHelpField( {
Lang("<Enter>") : Lang("Configure Remote Shell")
Expand Down