mirror of https://github.com/huashengdun/webssh
Added a new field passphrase
parent
bec5b605fb
commit
c0eba0ebb3
|
@ -310,10 +310,10 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
|
||||||
self.lookup_hostname(hostname, port)
|
self.lookup_hostname(hostname, port)
|
||||||
username = self.get_value('username')
|
username = self.get_value('username')
|
||||||
password = self.get_argument('password', u'')
|
password = self.get_argument('password', u'')
|
||||||
|
passphrase = self.get_argument('passphrase', u'')
|
||||||
privatekey, filename = self.get_privatekey()
|
privatekey, filename = self.get_privatekey()
|
||||||
if privatekey:
|
if privatekey:
|
||||||
pkey = PrivateKey(privatekey, password, filename).get_pkey_obj()
|
pkey = PrivateKey(privatekey, passphrase, filename).get_pkey_obj()
|
||||||
password = None
|
|
||||||
else:
|
else:
|
||||||
pkey = None
|
pkey = None
|
||||||
args = (hostname, port, username, password, pkey)
|
args = (hostname, port, username, password, pkey)
|
||||||
|
@ -336,7 +336,9 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
|
||||||
logging.info('Connecting to {}:{}'.format(*dst_addr))
|
logging.info('Connecting to {}:{}'.format(*dst_addr))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ssh.connect(*args, timeout=6)
|
ssh.connect(
|
||||||
|
*args, timeout=6, allow_agent=False, look_for_keys=False
|
||||||
|
)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
raise ValueError('Unable to connect to {}:{}'.format(*dst_addr))
|
raise ValueError('Unable to connect to {}:{}'.format(*dst_addr))
|
||||||
except paramiko.BadAuthenticationType:
|
except paramiko.BadAuthenticationType:
|
||||||
|
|
|
@ -515,9 +515,9 @@ jQuery(function($){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function normalize_data(data) {
|
function clean_data(data) {
|
||||||
var i, attr, val;
|
var i, attr, val;
|
||||||
var attrs = fields.concat('privatekey');
|
var attrs = fields.concat(['password', 'privatekey', 'passphrase']);
|
||||||
|
|
||||||
for (i = 0; i < attrs.length; i++) {
|
for (i = 0; i < attrs.length; i++) {
|
||||||
attr = attrs[i];
|
attr = attrs[i];
|
||||||
|
@ -530,7 +530,7 @@ jQuery(function($){
|
||||||
|
|
||||||
|
|
||||||
function validate_form_data(data) {
|
function validate_form_data(data) {
|
||||||
normalize_data(data);
|
clean_data(data);
|
||||||
|
|
||||||
var hostname = data.get('hostname'),
|
var hostname = data.get('hostname'),
|
||||||
port = data.get('port'),
|
port = data.get('port'),
|
||||||
|
@ -668,7 +668,7 @@ jQuery(function($){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function connect(hostname, port, username, password, privatekey) {
|
function connect(hostname, port, username, password, privatekey, passphrase) {
|
||||||
// for console use
|
// for console use
|
||||||
var result, opts;
|
var result, opts;
|
||||||
|
|
||||||
|
@ -686,7 +686,8 @@ jQuery(function($){
|
||||||
port: port,
|
port: port,
|
||||||
username: username,
|
username: username,
|
||||||
password: password,
|
password: password,
|
||||||
privatekey: privatekey
|
privatekey: privatekey,
|
||||||
|
passphrase: passphrase
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
opts = hostname;
|
opts = hostname;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<link href="static/css/fullscreen.min.css" rel="stylesheet" type="text/css"/>
|
<link href="static/css/fullscreen.min.css" rel="stylesheet" type="text/css"/>
|
||||||
<style>
|
<style>
|
||||||
.row {
|
.row {
|
||||||
margin-top: 20px;
|
margin-top: 15px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
margin-top: 10px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-danger {
|
.btn-danger {
|
||||||
|
@ -45,17 +45,18 @@
|
||||||
<input class="form-control" type="text" id="username" name="username" value="" required>
|
<input class="form-control" type="text" id="username" name="username" value="" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<label for="Username">Private Key</label>
|
<label for="Password">Password</label>
|
||||||
<input class="form-control" type="file" id="privatekey" name="privatekey" value="">
|
<input class="form-control" type="password" name="password" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<label for="Password">Password</label>
|
<label for="Username">Private Key</label>
|
||||||
<input class="form-control" type="password" name="password" value="">
|
<input class="form-control" type="file" id="privatekey" name="privatekey" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
If Private Key is chosen, password will be used to decrypt the Private Key if it is encrypted, otherwise used as the password of username.
|
<label for="Passphrase">Passphrase</label>
|
||||||
|
<input class="form-control" type="password" name="passphrase" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% module xsrf_form_html() %}
|
{% module xsrf_form_html() %}
|
||||||
|
|
Loading…
Reference in New Issue