|
|
f147723 |
From 8bbdcc6e084b59027cac6f2463968af1f33b1793 Mon Sep 17 00:00:00 2001
|
|
|
f147723 |
From: Ruben <ruben@rubenkerkhof.com>
|
|
|
f147723 |
Date: Sun, 17 Oct 2010 17:16:14 +0200
|
|
|
f147723 |
Subject: [PATCH 05/14] 05_ssh-port.diff from Debian
|
|
|
f147723 |
|
|
|
f147723 |
---
|
|
|
f147723 |
ajaxterm.py | 15 ++++++++++-----
|
|
|
f147723 |
1 files changed, 10 insertions(+), 5 deletions(-)
|
|
|
f147723 |
|
|
|
f147723 |
diff --git a/ajaxterm.py b/ajaxterm.py
|
|
|
f147723 |
index 8b3af37..63b0444 100755
|
|
|
f147723 |
--- a/ajaxterm.py
|
|
|
f147723 |
+++ b/ajaxterm.py
|
|
|
f147723 |
@@ -367,9 +367,10 @@ class SynchronizedMethod:
|
|
|
f147723 |
return r
|
|
|
f147723 |
|
|
|
f147723 |
class Multiplex:
|
|
|
f147723 |
- def __init__(self,cmd=None):
|
|
|
f147723 |
+ def __init__(self,cmd=None,serverport=None):
|
|
|
f147723 |
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
|
|
|
f147723 |
self.cmd=cmd
|
|
|
f147723 |
+ self.serverport=serverport
|
|
|
f147723 |
self.proc={}
|
|
|
f147723 |
self.lock=threading.RLock()
|
|
|
f147723 |
self.thread=threading.Thread(target=self.loop)
|
|
|
f147723 |
@@ -403,7 +404,10 @@ class Multiplex:
|
|
|
f147723 |
cmd+=['-oPreferredAuthentications=keyboard-interactive,password']
|
|
|
f147723 |
cmd+=['-oNoHostAuthenticationForLocalhost=yes']
|
|
|
f147723 |
cmd+=['-oLogLevel=FATAL']
|
|
|
f147723 |
- cmd+=['-F/dev/null','-l',login,'localhost']
|
|
|
f147723 |
+ cmd+=['-F/dev/null']
|
|
|
f147723 |
+ if self.serverport:
|
|
|
f147723 |
+ cmd+=['-p %s'%self.serverport]
|
|
|
f147723 |
+ cmd+=['-l', login, 'localhost']
|
|
|
f147723 |
else:
|
|
|
f147723 |
os._exit(0)
|
|
|
f147723 |
env={}
|
|
|
f147723 |
@@ -473,7 +477,7 @@ class Multiplex:
|
|
|
f147723 |
pass
|
|
|
f147723 |
|
|
|
f147723 |
class AjaxTerm:
|
|
|
f147723 |
- def __init__(self,cmd=None,index_file='ajaxterm.html'):
|
|
|
f147723 |
+ def __init__(self,cmd=None,index_file='ajaxterm.html',serverport=None):
|
|
|
f147723 |
self.files={}
|
|
|
f147723 |
for i in ['css','html','js']:
|
|
|
f147723 |
for j in glob.glob('*.%s'%i):
|
|
|
f147723 |
@@ -481,7 +485,7 @@ class AjaxTerm:
|
|
|
f147723 |
self.files['index']=file(index_file).read()
|
|
|
f147723 |
self.mime = mimetypes.types_map.copy()
|
|
|
f147723 |
self.mime['.html']= 'text/html; charset=UTF-8'
|
|
|
f147723 |
- self.multi = Multiplex(cmd)
|
|
|
f147723 |
+ self.multi = Multiplex(cmd,serverport)
|
|
|
f147723 |
self.session = {}
|
|
|
f147723 |
def __call__(self, environ, start_response):
|
|
|
f147723 |
req = qweb.QWebRequest(environ, start_response,session=None)
|
|
|
f147723 |
@@ -528,6 +532,7 @@ def main():
|
|
|
f147723 |
parser.add_option("-P", "--pidfile",dest="pidfile",default="/var/run/ajaxterm.pid",help="set the pidfile (default: /var/run/ajaxterm.pid)")
|
|
|
f147723 |
parser.add_option("-i", "--index", dest="index_file", default="ajaxterm.html",help="default index file (default: ajaxterm.html)")
|
|
|
f147723 |
parser.add_option("-u", "--uid", dest="uid", help="Set the daemon's user id")
|
|
|
f147723 |
+ parser.add_option("-s", "--serverport", dest="serverport", help="Use a different port than 22 to connect to the ssh server")
|
|
|
f147723 |
(o, a) = parser.parse_args()
|
|
|
f147723 |
if o.daemon:
|
|
|
f147723 |
pid=os.fork()
|
|
|
f147723 |
@@ -553,7 +558,7 @@ def main():
|
|
|
f147723 |
sys.exit(0)
|
|
|
f147723 |
else:
|
|
|
f147723 |
print 'AjaxTerm at http://localhost:%s/' % o.port
|
|
|
f147723 |
- at=AjaxTerm(o.cmd,o.index_file)
|
|
|
f147723 |
+ at=AjaxTerm(o.cmd,o.index_file,o.serverport)
|
|
|
f147723 |
# f=lambda:os.system('firefox http://localhost:%s/&'%o.port)
|
|
|
f147723 |
# qweb.qweb_wsgi_autorun(at,ip='localhost',port=int(o.port),threaded=0,log=o.log,callback_ready=None)
|
|
|
f147723 |
try:
|
|
|
f147723 |
--
|
|
|
f147723 |
1.7.3.1
|
|
|
f147723 |
|