Open palohan opened 11 years ago
How bizarre! I'll figure it out...
I just pushed a commit that should fix this. I think when I moved that setting to ssh.js (from gateone.js) I copied a portion of the code I shouldn't have.
Please pull the latest code and let me know how it goes. Thanks.
It works now, all good! ...can't believe I couldn't spot it myself! :)
One more thing...when I try to pass password in url, I always get that exception with os.setsid in ssh_connect.py
I tried a simple solution that somehow works:
First, I changed this if-else block a little bit:
if password:
# temp = tempfile.NamedTemporaryFile(delete=False)
# os.chmod(temp.name, 0o700)
# temp.write('#!/bin/sh\necho "%s"\n' % password)
# temp.close()
# env['SSH_ASKPASS'] = temp.name
# env['DISPLAY'] = ':9999'
# This removes the temporary file in a timely manner
# Popen("sleep 15 && /bin/rm -f %s" % temp.name, shell=True)
# 15 seconds should be enough even for slow connections/servers
# It's a tradeoff: Lower number, more secure. Higher number, less likely to fail
<strong>sshpass="sshpass -p %s " % password
else:
sshpass=""</strong></code><br>sshpass -p passes a password to ssh uninteractively (damn why my intendation doesn't work..)<br>
Then I just changed a few lines more:
script = wrapper_script.format(
socket=socket,
cmd=sshpass+" ".join(args),
temp=script_path)
Finally, I commented lines with os.setsid
# if password:
# os.setsid() # This is the key</code><br>
And BAM, somehow I can pass password in URL without getting a stroke. I know it's a primitive solution, but there's no need to store the password anywhere, change env variables or anything. And that definetly works for me
I initialize GateOne in my application like this:
window.onload = function() { GateOne.init({url:'https://10.0.0.1/',autoConnectURL:'ssh://palo@localhost:22', theme="solarized"}); }
I put this statement in gateone.js, line 256, to print GateOne.prefs object to Firebug console
// Update GateOne.prefs with the settings provided in the calling page for (var setting in prefs) { go.prefs[setting] = prefs[setting]; } console.log(prefs);
and autoConnectURL is there
Object { url="https://10.0.0.1/", autoConnectURL="ssh://palo@localhost:22", theme="solarized"}
But then when I try to print go.prefs.autoConnectURL in autoConnect function in ssh.js, it is set to null. Then if I comment the line checking if it isn't null and just pass an ssh URL manually with sendstring, it works OK.
autoConnect: function(term, termUndefined) { /**:GateOne.SSH.autoConnect()
So my conclusion is the autoConnectURL gets set to null somewhere along the way, while the rest of the passed prefs don't. So please Dan, have a look at this.