"""This implements a dispatcher which listens to localhost:8550, and proxiesrequests via qrexec to the service qubes.EthSign on a target domain"""importhttp.serverimportsocketserver,subprocessPORT=8550TARGET_DOMAIN='debian-work'classDispatcher(http.server.BaseHTTPRequestHandler):defdo_POST(self):post_data=self.rfile.read(int(self.headers['Content-Length']))p=subprocess.Popen(['/usr/bin/qrexec-client-vm',TARGET_DOMAIN,'qubes.Clefsign'],stdin=subprocess.PIPE,stdout=subprocess.PIPE)output=p.communicate(post_data)[0]self.wfile.write(output)withsocketserver.TCPServer(("",PORT),Dispatcher)ashttpd:print("Serving at port",PORT)httpd.serve_forever()