Browse Source

Merge branch 'python' of github.com:rtCamp/easyengine into python

bugfixes
harshadyeola 10 years ago
parent
commit
7f90eafd32
  1. 19
      ee/cli/plugins/secure.py

19
ee/cli/plugins/secure.py

@ -3,6 +3,7 @@ from cement.core import handler, hook
from ee.core.shellexec import EEShellExec from ee.core.shellexec import EEShellExec
from ee.core.variables import EEVariables from ee.core.variables import EEVariables
from ee.core.logging import Log from ee.core.logging import Log
from ee.core.git import EEGit
import string import string
import random import random
import sys import sys
@ -55,8 +56,8 @@ class EESecureController(CementBaseController):
if username == "": if username == "":
self.app.pargs.user_input = EEVariables.ee_user self.app.pargs.user_input = EEVariables.ee_user
if not self.app.pargs.user_pass: if not self.app.pargs.user_pass:
password = input("Provide HTTP authentication " password = getpass.getpass("Provide HTTP authentication "
"password [{0}] :".format(passwd)) "password [{0}] :".format(passwd))
self.app.pargs.user_pass = password self.app.pargs.user_pass = password
if password == "": if password == "":
self.app.pargs.user_pass = passwd self.app.pargs.user_pass = passwd
@ -71,12 +72,8 @@ class EESecureController(CementBaseController):
.format(username=self.app.pargs.user_input, .format(username=self.app.pargs.user_input,
password=self.app.pargs.user_pass), password=self.app.pargs.user_pass),
log=False) log=False)
Log.info(self, "Successfully changed HTTP authentication" EEGit.add(self, ["/etc/nginx"],
" username to : {username}" msg="Adding changed secure auth into Git")
.format(username=self.app.pargs.user_input), log=False)
Log.info(self, "Successfully changed HTTP authentication"
" password to : {password}"
.format(password=self.app.pargs.user_pass), log=False)
@expose(hide=True) @expose(hide=True)
def secure_port(self): def secure_port(self):
@ -104,6 +101,9 @@ class EESecureController(CementBaseController):
"{port} default_server ssl;/\" " "{port} default_server ssl;/\" "
"/etc/nginx/sites-available/22222" "/etc/nginx/sites-available/22222"
.format(port=self.app.pargs.user_input)) .format(port=self.app.pargs.user_input))
EEGit.add(self, ["/etc/nginx"],
msg="Adding changed secure port into Git")
Log.info(self, "Successfully port changed {port}" Log.info(self, "Successfully port changed {port}"
.format(port=self.app.pargs.user_input)) .format(port=self.app.pargs.user_input))
@ -127,6 +127,9 @@ class EESecureController(CementBaseController):
"\"/deny/i allow {whitelist_adre}\;\"" "\"/deny/i allow {whitelist_adre}\;\""
" /etc/nginx/common/acl.conf" " /etc/nginx/common/acl.conf"
.format(whitelist_adre=ip_addr)) .format(whitelist_adre=ip_addr))
EEGit.add(self, ["/etc/nginx"],
msg="Adding changed secure ip into Git")
Log.info(self, "Successfully added IP address in acl.conf file") Log.info(self, "Successfully added IP address in acl.conf file")

Loading…
Cancel
Save