Another fix for secure
This commit is contained in:
@@ -148,20 +148,16 @@ class WOSecureController(CementBaseController):
|
|||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def secure_ssh(self):
|
def secure_ssh(self):
|
||||||
"""Harden ssh security"""
|
"""Harden ssh security"""
|
||||||
pargs = self.app.pargs
|
if os.path.isfile('/etc/ssh/sshd_config'):
|
||||||
if pargs.user_input:
|
for line in open('/etc/ssh/sshd_config', encoding='utf-8'):
|
||||||
current_ssh_port = pargs.user_input
|
if 'Port' in line:
|
||||||
else:
|
ssh_line = line.strip()
|
||||||
if os.path.isfile('/etc/ssh/sshd_config'):
|
|
||||||
for line in open('/etc/ssh/sshd_config', encoding='utf-8'):
|
|
||||||
if 'Port' in line:
|
|
||||||
ssh_line = line.strip()
|
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
port = (ssh_line).split(' ')
|
|
||||||
current_ssh_port = port[1]
|
|
||||||
else:
|
else:
|
||||||
Log.error(self, "SSH config file not found")
|
port = (ssh_line).split(' ')
|
||||||
|
current_ssh_port = port[1]
|
||||||
|
else:
|
||||||
|
Log.error(self, "SSH config file not found")
|
||||||
if not current_ssh_port:
|
if not current_ssh_port:
|
||||||
current_ssh_port = '22'
|
current_ssh_port = '22'
|
||||||
data = dict(sshport=current_ssh_port, allowpass='no')
|
data = dict(sshport=current_ssh_port, allowpass='no')
|
||||||
|
|||||||
Reference in New Issue
Block a user