Subject: Bug#377: init scripts

From: Jan Engelhardt <[email-masked]>
Date: Tue, 17 Dec 2013 19:10:20 +0100 (CET)

I seem to remember that start-stop-daemon might have been part of LSB, 
but then again, maybe not? (In the current openSUSE release with 
systemd, start-stop-daemon is part of the dpkg package.)

So the following are the init scripts currently running here. They lack 
in quality, are dirt hacks, and only do the one thing they were tested 
for. There is a lack of quoting all over the place.

---

From: Mike Gabriel <[email-masked]>
Date: Sat, 21 Dec 2013 21:09:32 +0000

Control: close -1

Hi Jan,

> for. There is a lack of quoting all over the place.

I have included two init scripts [1, 2] in X2Go Session Broker now  
that work on RHEL derived distros.

The script use the daemon function from /etc/init.d/functions.

Because of the limitation of the daemon function not being able to  
fork a process to background, I had to implement the "--daemonize"  
command line option in x2gobroker [3] and x2gobroker-authservice [4].  
Now, both Python executables can fork themselves to background.

Also, I split up x2gobroker-agent from x2gobroker (and also sub  
packaged x2gobroker-daemon, x2gobroker-wsgi and python-x2gobroker). I  
recommend doing the same on OpenSuSE. Find my x2gobroker.spec shipped  
in upstream x2gobroker.git [5].

Thanks,
Mike

[1] http://code.x2go.org/gitweb?p=x2gobroker.git;a=blob;f=rpm/x2gobroker.init
[2]  
http://code.x2go.org/gitweb?p=x2gobroker.git;a=blob;f=rpm/x2gobroker-authservice.init
[3]  
http://code.x2go.org/gitweb?p=x2gobroker.git;a=blob;f=man/man1/x2gobroker.1#l75
[4]  
http://code.x2go.org/gitweb?p=x2gobroker.git;a=blob;f=man/man8/x2gobroker-authservice.8#l41
[5] http://code.x2go.org/gitweb?p=x2gobroker.git;a=blob;f=x2gobroker.spec
-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
fon: +49 (1520) 1976 148

GnuPG Key ID 0x25771B31
mail: [email-masked], http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb

---

From: [email-masked] (X2Go Bug Tracking System)
Date: Sat, 21 Dec 2013 21:10:02 +0000

This is an automatic notification regarding your Bug report
which was filed against the x2gobroker package:

#377: paramiko fails to recognize known_hosts

It has been closed by Mike Gabriel <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Mike Gabriel <[email-masked]> by
replying to this email.

-- 
377: http://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=377
X2Go Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [X2Go-Dev] Bug#377: init scripts
From: Mike Gabriel <[email-masked]>
To: Jan Engelhardt <[email-masked]>, [email-masked]
Date: Sat, 21 Dec 2013 21:09:32 +0000

Control: close -1

Hi Jan,

Thanks,
Mike

DAS-NETZWERKTEAM

GnuPG Key ID 0x25771B31

freeBusy:

Subject: paramiko fails to recognize known_hosts
From: Jan Engelhardt <[email-masked]>
To: [email-masked]
Cc: Michael Kromer <[email-masked]>
Date: Tue, 17 Dec 2013 14:47:20 +0100 (CET)

Package: x2gobroker
Version: 0.0.2.3

When logging into a x2gobroker-0.0.2.3 with paramiko-1.11.0,
it so happens that, for whatever reason, it rejects the
remote side's key despite that being in
/var/lib/x2gobroker/.ssh/known_hosts.

{u'defsndport': False, u'useiconv': False, u'iconvfrom': 'UTF-8', u'height': 768, u'pack': '16m-jpeg', u'export': '', u'quality': 9, u'fullscreen': False, u'layout': '', 'host=terminalsrv2': '172.18.7.216', 'host=terminalsrv1': '172.18.7.205', u'width': 1024, u'speed': 4, u'soundtunnel': False, u'soundsystem': 'pulse', u'print': True, u'type': 'auto', u'sndport': 4713, u'xinerama': True, u'usekbd': True, u'variant': '', u'applications': ['TERMINAL', 'WWWBROWSER', 'MAILCLIENT', 'OFFICE'], u'host': ['terminalsrv1', 'terminalsrv2', 'terminalsrv3'], u'link': 'lan', u'multidisp': False, 'host=terminalsrv3': '172.18.7.214', u'fstunnel': False, u'sound': False, u'rootless': False, u'name': 'Terminalsitzung starten LAN Einstellungen', u'sshproxyport': 22, u'iconvto': 'UTF-8', u'directrdp': False, u'useexports': True, u'command': 'GNOME', u'dpi': 96, u'sshport': 22, u'setdpi': 0, u'startsoundsystem': 'false', u'user': ''}
['terminalsrv1', 'terminalsrv2', 'terminalsrv3']
['terminalsrv3', 'terminalsrv1', 'terminalsrv2']
{u'hostname': 'terminalsrv2', u'port': 22}
starting thread (client mode): 0xe8ded0L
Connected (version 2.0, client OpenSSH_5.1)
kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] client mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', [email-masked]'] server compress:['none', [email-masked]'] client lang:[''] ser
 ver lang:[''] kex follows?False
Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
Switch to new keys ...
/usr/lib64/python2.6/site-packages/paramiko/client.py:95:
UserWarning: Unknown ssh-rsa host key for terminalsrv2: 4d1d9d46a16da7d8c5a3829c920ff5da
  (key.get_name(), hostname, hexlify(key.get_fingerprint())))
['terminalsrv3', 'terminalsrv1']
{u'hostname': 'terminalsrv1', u'port': 22}
starting thread (client mode): 0xe95cd0L
Connected (version 2.0, client OpenSSH_5.1)
kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] client mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', [email-masked]'] server compress:['none', [email-masked]'] client lang:[''] ser
 ver lang:[''] kex follows?False
Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
Switch to new keys ...
/usr/lib64/python2.6/site-packages/paramiko/client.py:95:
UserWarning: Unknown ssh-rsa host key for terminalsrv1: 4d1d9d46a16da7d8c5a3829c920ff5da
  (key.get_name(), hostname, hexlify(key.get_fingerprint())))
thservice.logEOF in transport thread
['terminalsrv3']
{u'hostname': 'terminalsrv3', u'port': 22}
starting thread (client mode): 0xe95290L
Connected (version 2.0, client OpenSSH_5.1)
kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] client mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', [email-masked]'] server compress:['none', [email-masked]'] client lang:[''] ser
 ver lang:[''] kex follows?False
Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
Switch to new keys ...
/usr/lib64/python2.6/site-packages/paramiko/client.py:95:
UserWarning: Unknown ssh-rsa host key for terminalsrv3: 4d1d9d46a16da7d8c5a3829c920ff5da
  (key.get_name(), hostname, hexlify(key.get_fingerprint())))
EOF in transport thread
EOF in transport thread
starting thread (client mode): 0xe8df50L
Connected (version 2.0, client OpenSSH_5.1)
kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 'aes192-cbc', 'aes256-cbc', [email-masked]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] client mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', [email-masked]', 'hmac-ripemd160', [email-masked]', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', [email-masked]'] server compress:['none', [email-masked]'] client lang:[''] ser
 ver lang:[''] kex follows?False
Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
Switch to new keys ...
Traceback (most recent call last):
  File "/usr/sbin/x2gobroker", line 145, in <module>
    tornado.ioloop.IOLoop.instance().start()
  File "/usr/lib64/python2.6/site-packages/tornado/ioloop.py", line 606, in start
    self._run_callback(callback)
  File "/usr/lib64/python2.6/site-packages/tornado/ioloop.py", line 457, in _run_callback
    callback()
  File "/usr/lib64/python2.6/site-packages/tornado/stack_context.py", line 330, in wrapped
    raise_exc_info(exc)
  File "/usr/lib64/python2.6/site-packages/tornado/stack_context.py", line 301, in wrapped
    ret = fn(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/tornado/iostream.py", line 340, in wrapper
    callback(*args)
  File "/usr/lib64/python2.6/site-packages/tornado/stack_context.py", line 330, in wrapped
    raise_exc_info(exc)
  File "/usr/lib64/python2.6/site-packages/tornado/stack_context.py", line 301, in wrapped
    ret = fn(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/tornado/httpserver.py", line 339, in _on_request_body
    self.request_callback(self._request)
  File "/usr/lib64/python2.6/site-packages/tornado/web.py", line 1599, in __call__
    handler._execute(transforms, *args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/tornado/web.py", line 1133, in _execute
    self._when_complete(self.prepare(), self._execute_method)
  File "/usr/lib64/python2.6/site-packages/tornado/web.py", line 1140, in _when_complete
    callback()
  File "/usr/lib64/python2.6/site-packages/tornado/web.py", line 1161, in _execute_method
    self._when_complete(method(*self.path_args, **self.path_kwargs),
  File "/usr/lib64/python2.6/site-packages/x2gobroker/web/plain.py", line 136, in post
    profiles = broker_backend.list_profiles(username)
  File "/usr/lib64/python2.6/site-packages/x2gobroker/brokers/base_broker.py", line 870, in list_profiles
    running_sessions, suspended_sessions = x2gobroker.agent.has_sessions(username, query_mode=agent_query_mode, remote_agent=remote_agent)
  File "/usr/lib64/python2.6/site-packages/x2gobroker/agent.py", line 229, in has_sessions
    _session_list = list_sessions(username, query_mode=query_mode, remote_agent=remote_agent)
  File "/usr/lib64/python2.6/site-packages/x2gobroker/agent.py", line 174, in list_sessions
    return call_remote_broker_agent(username, mode='listsessions', remote_agent=remote_agent)
  File "/usr/lib64/python2.6/site-packages/x2gobroker/agent.py", line 139, in call_remote_broker_agent
    raise x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException('Query to remote X2Go Broker Agent (user: {user}, hostname: {hostname}, port: {port}) failed'.format(user=remote_username, hostname=remote_hostname, port=remote_port))
x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException: Query to remote X2Go Broker Agent (user: x2gobroker, hostname: terminalsrv3, port: 22) failed