20210620-Re_GSoC Port Forwarding-1051.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <html>
  2. <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  3. <title>Re: GSoC Port Forwarding</title>
  4. <link rel="important stylesheet" href="">
  5. <style>div.headerdisplayname {font-weight:bold;}
  6. </style></head>
  7. <body>
  8. <table border=0 cellspacing=0 cellpadding=0 width="100%" class="header-part1"><tr><td><div class="headerdisplayname" style="display:inline;">Oggetto: </div>Re: GSoC Port Forwarding</td></tr><tr><td><div class="headerdisplayname" style="display:inline;">Mittente: </div>Giulio <giulio@gmx.com></td></tr><tr><td><div class="headerdisplayname" style="display:inline;">Data: </div>20/06/2021, 22:50</td></tr></table><table border=0 cellspacing=0 cellpadding=0 width="100%" class="header-part2"><tr><td><div class="headerdisplayname" style="display:inline;">A: </div>Frédéric Pierret &lt;frederic.pierret@qubes-os.org&gt;, Marek Marczykowski-Górecki &lt;marmarek@invisiblethingslab.com&gt;</td></tr></table><br>
  9. <div class="moz-text-flowed" style="font-family: -moz-fixed; font-size: 14px;" lang="x-western">Hello,
  10. <br>sorry for the late reply.
  11. <br>
  12. <br>I read a lot of code and I have to admit that I did not grasp the
  13. complexity of the Admin API and networking stack before looking so much
  14. into it. I think I've got the overall picture, but it will take a little
  15. more to fully be confident moving there.
  16. <br>
  17. <br>Here is the summary of the notes I've taken from my understanding in
  18. this week of digging.
  19. <br>
  20. <br>Main references:
  21. <br><a class="moz-txt-link-freetext" href="https://www.qubes-os.org/doc/admin-api/">https://www.qubes-os.org/doc/admin-api/</a>
  22. <br><a class="moz-txt-link-freetext" href="https://www.qubes-os.org/doc/vm-interface/#firewall-rules-in-4x">https://www.qubes-os.org/doc/vm-interface/#firewall-rules-in-4x</a>
  23. <br><a class="moz-txt-link-freetext" href="https://www.qubes-os.org/doc/firewall/">https://www.qubes-os.org/doc/firewall/</a>
  24. <br>
  25. <br><span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>core-admin/qubes/firewall.py<span class="moz-txt-tag">_</span></span>
  26. <br>Contains the classes with the parsing and formatting rules for firewall
  27. information in the firewall XML file. It already checks proper format
  28. for ports and ip addresses/netmask. It already support an expiry date
  29. for a rule.
  30. <br>
  31. <br><span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>core-admin-client/qubesadmin/tools/qvm_firewall.py<span class="moz-txt-tag">_</span></span>
  32. <br>Class for the qvm-firewall cli tool. It is able to view, add, delete and
  33. reload firewall rules.
  34. <br>
  35. <br>
  36. <br><span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>core-admin-client/qubesadmin/firewall.py<span class="moz-txt-tag">_</span></span>
  37. <br>The file responsible for calling Admin API (qubesd). Currently has its
  38. own rule syntax for setting rules.
  39. <br>
  40. <br><span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>core-agent-linux/qubesagent/firewall.py<span class="moz-txt-tag">_</span></span>
  41. <br>Is the actual file responsible for running nftables and thus
  42. adding/deleting/reloading firewall ruless in the target firewall vm. It
  43. also resolves DNS names for domain rules. It is run by Admin API (qubesd).
  44. <br>
  45. <br><span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>manager/qubesmanager/firewall.py<span class="moz-txt-tag">_</span></span>
  46. <br>Contains the code for the "Firewall" tab of the "Qube Manager" window.
  47. <br>
  48. <br><span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>manager/ui/qubemanager.ui<span class="moz-txt-tag">_</span></span>
  49. <br>String and properties for the "Qube Manager" UI.
  50. <br>
  51. <br>
  52. <br>Questions:
  53. <br>
  54. <br>1) Should we both support internal port forwarding and external port
  55. forwarding? Such as exposing a port for another domain or exposing a
  56. port through the public network interface? I would say yes.
  57. <br>2) Should it be possible to add rules with an 'any' clause (both tcp and
  58. udp). I would say no because since port forwarding brings a higher
  59. attack surface all rules should be as precise as possible.
  60. <br>3) Since the expire= feature seems to be already implemented (and
  61. limited for the expiring full outgoing access) would it be useful to be
  62. implemented in gui and cli for every rule? I would say yes since the
  63. admin and agent code seems to be already there. The same goes for the
  64. "comment=" field.
  65. <br>4) How would you implement the management of forwarding rules in the
  66. network providing domain (sys-net)? Shall the user add a rule both in
  67. the target domain (ie the one with webserver and another one in sys-net)
  68. or should it be fully automatic from the first?
  69. <br>5) Users should be able to set forward rules using domain names and not
  70. static ip addresses. In this case, the actual ip addresses of the dst
  71. domains should be collected in a similr way as currently DNS are
  72. resolved in `/core-agent-linux/qubesagent/firewall.py`, would this be good?
  73. <br>
  74. <br>
  75. <br>Proposed XML Syntax:
  76. <br>&lt;rule&gt;
  77. <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;properties&gt;
  78. <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="action"&gt;forward&lt;/property&gt;
  79. <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="proto"&gt;udp&lt;/property&gt;
  80. <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="dstports"&gt;443-8080-5555&lt;/property&gt;
  81. <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/properties&gt;
  82. <br>&lt;rule&gt;
  83. <br>
  84. <br>Proposed Admin API Syntax:
  85. <br>action=forward proto=udp dstports=443-8080-5555 [expire=&lt;unix
  86. timestamp&gt;] [comment=random text]
  87. <br>
  88. <br>I also plan to document, at least partially, the journey into this.
  89. <br>As a last question, I'm curious what is your setup in order to test
  90. modifications in the aforementioned repos while developing.
  91. <br>
  92. <br>Thank you for your time.
  93. <br>Cheers
  94. <br>Giulio
  95. <br>
  96. <br>
  97. <br>
  98. <br>Il 11/06/2021 09:16, Frédéric Pierret ha scritto:
  99. <br><blockquote type=cite style="color: #007cff;">Hello,
  100. <br>
  101. <br>Le 6/11/21 à 8:24 AM, Giulio a écrit :
  102. <br><blockquote type=cite style="color: #007cff;">Hello,
  103. <br>Thank you for accepting my proposal and volunteering for mentoring me. I
  104. <br>spent the last weeks reading Qubes sources, documentation and mailing
  105. <br>lists, as well as setting up a virtual machine and attempting to prepare
  106. <br>a comfy development environment. I Hope by the end of the next week to
  107. <br>be ready to propose you a draft of the plan for the development of the
  108. <br>static port forwardign feature. Does that sound ok?
  109. <br></blockquote>
  110. <br>Sure.
  111. <br>
  112. <br><blockquote type=cite style="color: #007cff;">Cheers,
  113. <br>Giulio
  114. <br></blockquote>
  115. <br>Best,
  116. <br>Frédéric
  117. <br>
  118. <br></blockquote></div></body>
  119. </html>
  120. </table></div>