liftoff / GateOne

Gate One is an HTML5-powered terminal emulator and SSH client
http://liftoffsoftware.com/Products/GateOne
Other
6.28k stars 925 forks source link

Gateone with PAM Auth not working anymore #479

Open BenSchweikert opened 9 years ago

BenSchweikert commented 9 years ago

Hi, I am using Gateone in the official docker image with pam auth. This was working until some days ago. What I did since than:

Error message in browser: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1288, in _stack_context_handle_exception raise_exc_info((type, value, traceback)) File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1475, in wrapper result = method(self, _args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/authentication.py", line 559, in get self.get_authenticated_user(self._on_auth) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/pam.py", line 63, in get_authenticated_user self.auth_basic(auth_header, callback) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/pam.py", line 87, in auth_basic callback(user) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/authentication.py", line 568, in _on_auth self.user_login(user) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/authentication.py", line 159, in user_login user_dir = os.path.join(self.settings['user_dir'], upn) UnboundLocalError: local variable 'upn' referenced before assignment

Any ideas? Ben

daedric7 commented 9 years ago

Confirmed here, same error, same distro.

Seems to bypass if commenting 157 of .../gateone/auth/authentication.py

       # NOTE: These bytes checks are for Python 2 (not needed in Python 3)
        #if isinstance(user['upn'], bytes):
        upn = user['upn'].decode('utf-8')
phr0gz commented 9 years ago

Hello,

same error, doesn't change if I comment line 157 in /usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/authentication.py

same problem on Ubuntu 12.04 LTS and Ubuntu 14.04 LTS

[D 150106 19:32:47 authentication:152] user_login(phrogz@gate)
[E 150106 19:32:47 web:1407] Uncaught exception GET /gateone/auth?next=%2Fgateone%2F (192.168.0.156)
    HTTPServerRequest(protocol='http', host='xxxx.xxxx.xx', method='GET', uri='/gateone/auth?next=%2Fgateone%2F', version='HTTP/1.1', remote_ip='192.168.0.156', headers={'Accept-Language': 'fr-FR,fr;q=0.8,en-GB;q=0.5,en;q=0.3', 'Accept-Encoding': 'gzip, deflate', 'X-Scheme': 'https', 'Host': 'xxxx.xxxx.xx', 'Accept': 'text/html, application/xhtml+xml, */*', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko', 'Dnt': '1', 'Connection': 'upgrade', 'X-Real-Ip': '192.168.0.1', 'Authorization': 'Basic cGhyb2d6Omx1ZG9fMzAwMGlzcGhyb2d6'})
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1288, in _stack_context_handle_exception
        raise_exc_info((type, value, traceback))
      File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1475, in wrapper
        result = method(self, *args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/authentication.py", line 559, in get
        self.get_authenticated_user(self._on_auth)
      File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/pam.py", line 63, in get_authenticated_user
        self.auth_basic(auth_header, callback)
      File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/pam.py", line 87, in auth_basic
        callback(user)
      File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/authentication.py", line 568, in _on_auth
        self.user_login(user)
      File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/auth/authentication.py", line 159, in user_login
        user_dir = os.path.join(self.settings['user_dir'], upn)
    UnboundLocalError: local variable 'upn' referenced before assignment
phr0gz commented 9 years ago

Ok working fine now: Added:

upn = "initvar"

before:

if isinstance(user['upn'], bytes):
      upn = user['upn'].decode('utf-8')

I don't know anything about python...but it works now.

iqt4 commented 9 years ago

Understanding the comment, I would suggest a coding like this:

# NOTE: These bytes checks are for Python 2 (not needed in Python 3)
upn = user['upn']
if isinstance(upn, bytes):
    upn = upn.decode('utf-8')
phr0gz commented 9 years ago

I will test it the next weekend, and I will drop a feedback here.

liftoff commented 9 years ago

I will have a fix for this pushed later tonight.

liftoff commented 9 years ago

Anyone try the latest code? Does it resolve the problem? It should.

phealy commented 9 years ago

It fixed it for me, thanks.