From d048ebadf848cd3bf51943c4b71b1567e17c316d Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 24 Sep 2019 02:44:33 +0200 Subject: [PATCH] Add force argument to secure ssh --- wo/cli/plugins/secure.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/wo/cli/plugins/secure.py b/wo/cli/plugins/secure.py index 069d777..759db6c 100644 --- a/wo/cli/plugins/secure.py +++ b/wo/cli/plugins/secure.py @@ -37,8 +37,8 @@ class WOSecureController(CementBaseController): help='set custom ssh port', action='store_true')), (['--ssh'], dict( help='harden ssh security', action='store_true')), - (['--ufw'], - dict(help='setup and configure ufw firewall', + (['--force'], + dict(help='force execution without being prompt', action='store_true')), (['user_input'], dict(help='user input', nargs='?', default=None)), @@ -155,14 +155,16 @@ class WOSecureController(CementBaseController): @expose(hide=True) def secure_ssh(self): """Harden ssh security""" - start_secure = input('Are you sure you to want to' - ' harden SSH security ?' - '\nSSH login with password will not ' - 'be possible anymore. Please make sure ' - 'you are already using SSH Keys.\n' - 'Harden SSH security [y/N]') - if start_secure != "Y" and start_secure != "y": - Log.error(self, "Not hardening SSH security") + pargs = self.app.pargs + if not pargs.force: + start_secure = input('Are you sure you to want to' + ' harden SSH security ?' + '\nSSH login with password will not ' + 'be possible anymore. Please make sure ' + 'you are already using SSH Keys.\n' + '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") if os.path.isfile('/etc/ssh/sshd_config'): Log.debug(self, "looking for the current ssh port")