diff --git a/CHANGELOG.md b/CHANGELOG.md index be081d7..a42df5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - WordOps is now installed from PyPI using pip [WordOps](https://pypi.org/project/wordops/) - New Nginx package built with OpenSSL 1.1.1d and updated brotli module +#### Fixed + +- `wo stack upgrade` when using nginx-ee +- `wo secure --auth` +- `wo secure --sshport` not working with default ssh config + ### v3.9.9.2 - 2019-10-04 #### Added diff --git a/wo/cli/plugins/secure.py b/wo/cli/plugins/secure.py index ceead3f..719e0b5 100644 --- a/wo/cli/plugins/secure.py +++ b/wo/cli/plugins/secure.py @@ -69,7 +69,7 @@ class WOSecureController(CementBaseController): WOGit.add(self, ["/etc/nginx"], msg="Add Nginx to into Git") pargs = self.app.pargs - passwd = RANDOM.gen(self) + passwd = RANDOM.long(self) if not pargs.user_input: username = input("Provide HTTP authentication user " "name [{0}] :".format(WOVar.wo_user)) @@ -220,9 +220,14 @@ class WOSecureController(CementBaseController): Log.info(self, "Please Enter valid port number :") port = input("Server SSH port [22]:") pargs.user_input = port - WOShellExec.cmd_exec(self, "sed -i \"s/Port.*/Port " - "{port}/\" /etc/ssh/sshd_config" - .format(port=pargs.user_input)) + if WOFileUtils.grepcheck(self, '/etc/ssh/sshd_config', '#Port'): + WOShellExec.cmd_exec(self, "sed -i \"s/#Port.*/Port " + "{port}/\" /etc/ssh/sshd_config" + .format(port=pargs.user_input)) + else: + WOShellExec.cmd_exec(self, "sed -i \"s/Port.*/Port " + "{port}/\" /etc/ssh/sshd_config" + .format(port=pargs.user_input)) # allow new ssh port if ufw is enabled if os.path.isfile('/etc/ufw/ufw.conf'): # add rule for proftpd with UFW diff --git a/wo/core/random.py b/wo/core/random.py index d8dc66e..a0bc7f6 100644 --- a/wo/core/random.py +++ b/wo/core/random.py @@ -5,7 +5,13 @@ import string class RANDOM: """Random strings generator""" - def gen(self): + def long(self): + long_random = ''.join([random.choice + (string.ascii_letters + string.digits) + for n in range(24)]) + return long_random + + def short(self): short_random = ''.join([random.choice (string.ascii_letters + string.digits) for n in range(24)])