Fix wo secure --sshport

This commit is contained in:
VirtuBox
2019-10-08 11:17:07 +02:00
parent 07755b13ff
commit 4181b49e5d
3 changed files with 22 additions and 5 deletions

View File

@@ -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/) - 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 - 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 ### v3.9.9.2 - 2019-10-04
#### Added #### Added

View File

@@ -69,7 +69,7 @@ class WOSecureController(CementBaseController):
WOGit.add(self, ["/etc/nginx"], WOGit.add(self, ["/etc/nginx"],
msg="Add Nginx to into Git") msg="Add Nginx to into Git")
pargs = self.app.pargs pargs = self.app.pargs
passwd = RANDOM.gen(self) passwd = RANDOM.long(self)
if not pargs.user_input: if not pargs.user_input:
username = input("Provide HTTP authentication user " username = input("Provide HTTP authentication user "
"name [{0}] :".format(WOVar.wo_user)) "name [{0}] :".format(WOVar.wo_user))
@@ -220,9 +220,14 @@ class WOSecureController(CementBaseController):
Log.info(self, "Please Enter valid port number :") Log.info(self, "Please Enter valid port number :")
port = input("Server SSH port [22]:") port = input("Server SSH port [22]:")
pargs.user_input = port pargs.user_input = port
WOShellExec.cmd_exec(self, "sed -i \"s/Port.*/Port " if WOFileUtils.grepcheck(self, '/etc/ssh/sshd_config', '#Port'):
"{port}/\" /etc/ssh/sshd_config" WOShellExec.cmd_exec(self, "sed -i \"s/#Port.*/Port "
.format(port=pargs.user_input)) "{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 # allow new ssh port if ufw is enabled
if os.path.isfile('/etc/ufw/ufw.conf'): if os.path.isfile('/etc/ufw/ufw.conf'):
# add rule for proftpd with UFW # add rule for proftpd with UFW

View File

@@ -5,7 +5,13 @@ import string
class RANDOM: class RANDOM:
"""Random strings generator""" """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 short_random = ''.join([random.choice
(string.ascii_letters + string.digits) (string.ascii_letters + string.digits)
for n in range(24)]) for n in range(24)])