qubes-client.py 732 B

1234567891011121314151617181920212223
  1. """
  2. This implements a dispatcher which listens to localhost:8550, and proxies
  3. requests via qrexec to the service qubes.EthSign on a target domain
  4. """
  5. import http.server
  6. import socketserver,subprocess
  7. PORT=8550
  8. TARGET_DOMAIN= 'debian-work'
  9. class Dispatcher(http.server.BaseHTTPRequestHandler):
  10. def do_POST(self):
  11. post_data = self.rfile.read(int(self.headers['Content-Length']))
  12. p = subprocess.Popen(['/usr/bin/qrexec-client-vm',TARGET_DOMAIN,'qubes.Clefsign'],stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  13. output = p.communicate(post_data)[0]
  14. self.wfile.write(output)
  15. with socketserver.TCPServer(("",PORT), Dispatcher) as httpd:
  16. print("Serving at port", PORT)
  17. httpd.serve_forever()