Add force argument to secure ssh
This commit is contained in:
@@ -37,8 +37,8 @@ class WOSecureController(CementBaseController):
|
|||||||
help='set custom ssh port', action='store_true')),
|
help='set custom ssh port', action='store_true')),
|
||||||
(['--ssh'], dict(
|
(['--ssh'], dict(
|
||||||
help='harden ssh security', action='store_true')),
|
help='harden ssh security', action='store_true')),
|
||||||
(['--ufw'],
|
(['--force'],
|
||||||
dict(help='setup and configure ufw firewall',
|
dict(help='force execution without being prompt',
|
||||||
action='store_true')),
|
action='store_true')),
|
||||||
(['user_input'],
|
(['user_input'],
|
||||||
dict(help='user input', nargs='?', default=None)),
|
dict(help='user input', nargs='?', default=None)),
|
||||||
@@ -155,14 +155,16 @@ class WOSecureController(CementBaseController):
|
|||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def secure_ssh(self):
|
def secure_ssh(self):
|
||||||
"""Harden ssh security"""
|
"""Harden ssh security"""
|
||||||
start_secure = input('Are you sure you to want to'
|
pargs = self.app.pargs
|
||||||
' harden SSH security ?'
|
if not pargs.force:
|
||||||
'\nSSH login with password will not '
|
start_secure = input('Are you sure you to want to'
|
||||||
'be possible anymore. Please make sure '
|
' harden SSH security ?'
|
||||||
'you are already using SSH Keys.\n'
|
'\nSSH login with password will not '
|
||||||
'Harden SSH security [y/N]')
|
'be possible anymore. Please make sure '
|
||||||
if start_secure != "Y" and start_secure != "y":
|
'you are already using SSH Keys.\n'
|
||||||
Log.error(self, "Not hardening SSH security")
|
'Harden SSH security [y/N]')
|
||||||
|
if start_secure != "Y" and start_secure != "y":
|
||||||
|
Log.error(self, "Not hardening SSH security")
|
||||||
Log.debug(self, "check if /etc/ssh/sshd_config exist")
|
Log.debug(self, "check if /etc/ssh/sshd_config exist")
|
||||||
if os.path.isfile('/etc/ssh/sshd_config'):
|
if os.path.isfile('/etc/ssh/sshd_config'):
|
||||||
Log.debug(self, "looking for the current ssh port")
|
Log.debug(self, "looking for the current ssh port")
|
||||||
|
|||||||
Reference in New Issue
Block a user