Merge remote-tracking branch 'creckx/master'

Conflicts:
	butterfly/routes.py
This commit is contained in:
Florian Mounier
2014-05-05 12:16:16 +02:00
2 changed files with 13 additions and 2 deletions

View File

@@ -37,6 +37,8 @@ tornado.options.define("port", default=57575, type=int, help="Server port")
tornado.options.define("shell", help="Shell to execute at login")
tornado.options.define("unsecure", default=False,
help="Don't use ssl not recommended")
tornado.options.define("login", default=True,
help="Use login screen at start")
tornado.options.define("generate_certs", default=False,
help="Generate butterfly certificates")

View File

@@ -128,12 +128,19 @@ class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
self.communicate()
def shell(self):
if self.callee is None and tornado.options.options.unsecure:
if self.callee is None and (
tornado.options.options.unsecure and
tornado.options.options.login):
# If callee is now known and we have unsecure connection
user = input('login: ')
try:
self.callee = utils.User(name=user)
except:
self.callee = utils.User(name='nobody')
else:
# if login is not required, we will use the same user as
# butterfly is executed
self.callee = utils.User()
assert self.callee is not None
@@ -160,8 +167,10 @@ class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
if not tornado.options.options.unsecure or (
self.socket.local and
self.caller == self.callee and
server == self.callee):
server == self.callee
) or not tornado.options.options.login:
# User has been auth with ssl or is the same user as server
# or login is explicitly turned off
if not tornado.options.options.unsecure:
# User is authed by ssl, setting groups
try: