<div>Hi,<br></div><div><br></div><div>In my opinion it is not necessary for the Relay to sign anything not originating directly from that relay. It could of course double-sign it so the node could also verify that there is no any kind of MITM, but if we trust cf-serverd to ensure a secure end-to-end transport of policies, putting on the signature of the relay is just a small benefit, probably not directly worth it. If a Relay would become compromised, it would also mean the private key used to sign anything <b>by</b> the Relay would also be compromised.<br></div><div><br></div><div>The original idea I had in mind is for each Node to validate that the Policy-updates are originating from the Root server, and to ensure no bogus policy could be sneaked in if a Relay is compromised.<br></div><div><br></div><div>If the Relay has the task to distribute Files to Nodes on behalf of the Root server, the Files should be signed by the Root, and the Nodes should trust the Root and verify the authenticity if the Signature belongs to the Root. <br></div><div><br></div><div>I see multiple possible directions you could go:<br></div><ul><li><u>X509-Certificates:<br></u>The Root-Server would be a Certificate Authority (CA) to sign SSL Certificates for it's Policy Servers<br></li><ul><li>The Policy Servers' Apache installation (Root and Relays) would get a signed Certificate by this CA:<br></li><ul><li>The WebDAV endpoints would be secured with this certficate on the Root/Relays<br></li><li>A newly set up Nodes (not having set up any out-of-band trust before) could fetch the Certificate-Chain from the WebDAV endpoint directly at the time they are preparing the first inventory upload and could establish initial trust to that (since the Webserver is actually sending it's SSL Chain to the Client)<br></li></ul><li>The Root Server could use the Private Key for the CA to sign any Policy intended for an accepted Node.</li><ul><li>The Node could verify the authenticity of Policy updates belonging to the same "instance" it established trust initially (via the SSL Certificate Chain) and would only accept inventory updates if a checksum file of all updated files is signed by the RootCA.<br></li></ul><li>Pros:<br></li><ul><li>You make sure all communication over TLS (WebDAV) is secured properly and trust is established the first time a Node connects to a WebDAV endpoint of the Server in it's policy_server.dat.<br></li><li>It would solve trust of Web-Transport and also File-Signature by only trusting one "public key", retrievable only with the knowledge of the policy server by standard HTTPS-Protocol.<br></li></ul><li>Cons:<br></li><ul><li>File-Signing and -Verification with X509 is not easy and also not designed for, but within the scope of possible<br></li><li>Rudder-Managing the SSL-Certificates requires all hostnames / frontends to precisely match of what Rudder thinks it's called<br></li><li>If a Node connects to a compromised Relay, it will trust that (there is actually no good way to trust something you know initially nothing of)<br></li></ul></ul><li><u>GPG Trust:<br></u>The Root-Server would have a private GPG Key to a publicly propagated Signature</li><ul><li>The Policy Server propagates the signature of the Root Server's GPG Key via HTTP(s) to anybody asking for it (just like /uuid).<br></li><ul><li>The Nodes would query the GPG Key's Signature in addition to the uuid of it's policy server and trust it the first time they retrieve it.<br></li><li>The Nodes would verify any Policy-Update with this GPG Key for authenticity<br></li></ul><li>Pros<br></li><ul><li>GPG is very mature and has good tooling if it comes to File encryption / verification<br></li><li>If would also enable you later to use a GPG-Based solution to encrypt Files for dedicated nodes, so only they can open it <br>(if the Nodes were to generate a private GPG key and send the public key in the initial inventory)</li></ul><li>Cons:<br></li><ul><li>The Trust of the Web-Endpoints are still subject for the User to provide valid certificates (btw, currently the curl has "-k", so that's not really a "trusted" channel anyway)<br></li><li>The public part has to be propagated in a way.<br></li></ul></ul></ul><div><br></div><div>The question becomes of course a lot trickier if you want to share files without involving the Root between Nodes <b>and</b> want the Receiver Node to have the ability to verify the authenticity of the received files without the direct knowledge of any cryptographic identifies of the Sender Node :-/ ... Not sure about that use case, but I think that if you want to make things secure, you have to first establish some kind of trust relationship with the Root-Instance, and then let the Root-Instance distribute any further knowledge about possible inter-Node trust relationship ...<br></div><div><br></div><div>Thanks for reading,</div><div class="protonmail_signature_block "><div class="protonmail_signature_block-user "><div>-- <br></div><div>Janos Mattyasovszky<br></div></div><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><br></div></div><div><br></div><blockquote type="cite" class="protonmail_quote"><div>-------- Original Message --------<br></div><div>Subject: Re: [rudder-dev] Strenghten the integrity of the node policy if using Relays<br></div><div>Local Time: 15. März 2017 12:20 PM<br></div><div>UTC Time: 15. März 2017 11:20<br></div><div>From: benoit.peccatte@normation.com<br></div><div>To: Janos Mattyasovszky <mail@matya.eu>, rudder-dev@lists.rudder-project.org <rudder-dev@lists.rudder-project.org>, rudder-users@lists.rudder-project.org <rudder-users@lists.rudder-project.org><br></div><div><br></div><div> <br></div><div class="moz-cite-prefix">Le 14/03/2017 à 10:16, Janos
Mattyasovszky a écrit :<br></div><blockquote type="cite"><div>Hi dear Rudder Community, <br></div><div><br></div><div><u>The issue:</u><br></div><div>The policy generated by the Root server is transmitted
encrypted via the Relay servers, but this provides only
transport encryption between the endpoints, and the Relays
basically are by-design MITM hosts, which have the ability to
modify policy files and reports going back through them (the
inventories are signed - so they would break). This requires
that every relay has a high need for <i>integrity</i>, since
there is no real way to determine from a Rudder-Root-Server
point of view if any of the relay behaves rogue and injects
bogus policy and modifies the reports stream back to represent
that all nodes are good, even if they are not and are executing
an attacker-provided modified policy.<br></div><div><br></div><div><u>Proposed solution:</u><br></div><div>Use cryptographic signature on the generated policy with the
Root Server's RSA key.<br></div><div><br></div><div>With the usage of PKI a client can validate the policy
received from the Master before executing it by trusting the
public key of it. This would require the pubkey of the Root
Server to be known to the Nodes. Currently if you have any
Relays in between, they become the effective policy server for
the nodes, and the nodes will not know anything about the Relay
not being the root server (they just behave identical as if they
would be connected to a root server in the POW of an
end-of-the-leaf node).<br></div></blockquote><div><br></div><div>Does that mean you think the signature should be done by the relay ?<br></div><div> <br></div><div> <br></div><blockquote type="cite"><div><br></div><div>By using a logic like "trust on first use", where the root
server includes it's pubkey in any policy being generated, and
then the node would trust the first key that it would receive if
it has no policy yet, it could establish a trust until a "rudder
agent reset/reinit" would be issued. After that the node could
verify any further policy by checking the signature of a file
containing the hashes of all the policy files.<br></div><div><br></div><div>This would work as long the nodes are not connecting
initially to a compromised relay, or if the Pubkey of the Root
Server is also deployed out-of-band at the time the rudder-agent
package is installed and policy_server.dat is configured, so
basically the node has already an initial knowledge of the root
server's pubkey, and would as of that only trust policy signed
by that root server, regardless of the path the policy would
travel.<br></div></blockquote><div><br></div><div>Distributing the public key out of band is a possibility,
distributing a CA and checking signature may be better for long term
key management.<br></div><div> This CA could be managed locally by rudder or be managed by
Normation for its clients.<br></div><div> <br></div><div> <br></div><blockquote type="cite"><div><br></div><div>This would raise the overall security level and reducing the
criticality of a relay to "only" require <i>confidentiality</i>,
since any compromise would result in worst case the nodes behind
a relay not executing the compromised policy and if the relay
was faking the expected reports the nodes would have to send
through the relays, so we'd go from "<i>compromising all nodes
below the relay to execute our code</i>" down to "<i>cutting
off the nodes from any new policy update without being
detected by the Root server</i>", which is still a great
improvement, and if you have out-of-Rudder monitoring for policy
updates (#7282), you could detect this by having nodes not
receiving policy updates as scheduled.<br></div><div><br></div><div>A second step could be not to send the reports via
unencrpyted UDP Syslog, but use the same method as sending the
inventories: one file with the current run's reports, signed by
the node's key, this would also solve the issue of not being
able to detect any compromised relay.<br></div></blockquote><div><br></div><div>We took a step forward having signature everywhere, since the 4.1 we
have a relay api to share files between hosts. This API uses the
same signature mechanism as inventories that is checked everywhere.<br></div><div> This API could also be used in place of syslog to transmit signed
reporting to the server.<br></div><div> <br></div><div> <br></div><blockquote type="cite"><div><br></div><div>Thanks for reading,<br></div><div><br></div><div>Best Regards,<br></div><div class="protonmail_signature_block "><div class="protonmail_signature_block-user "><div>Janos Mattyasovszky<br></div></div><div class="protonmail_signature_block-proton
protonmail_signature_block-empty"><br></div></div><div><br></div><div><br></div><div><br></div><pre wrap="">_______________________________________________
rudder-users mailing list
<a rel="noreferrer nofollow noopener" class="moz-txt-link-abbreviated" href="mailto:rudder-users@lists.rudder-project.org">rudder-users@lists.rudder-project.org</a>
<a rel="noreferrer nofollow noopener" class="moz-txt-link-freetext" href="http://www.rudder-project.org/mailman/listinfo/rudder-users">http://www.rudder-project.org/mailman/listinfo/rudder-users</a>
<br></pre></blockquote><div><br></div><p><br></p><div class="moz-signature"><div>-- <br></div><div> <br></div><table border="0" cellpadding="0" cellspacing="2" width="380"><tbody><tr><td colspan="2"><hr><br></td></tr><tr><td colspan="2"><div><b><img alt="Logo Normation" src="cid:part1.BB210E2C.A6B16308@normation.com" align="left" height="50" width="50"> <span class="sig">Benoît Peccatte</span></b><br></div><div> <span class="sig"><i>Architecte</i></span><br></div><div> <span class="sig"><a rel="noreferrer nofollow noopener" class="redlink" href="http://www.normation.com">Normation</a></span><br></div></td></tr><tr><td colspan="2"><hr><br></td></tr><tr><td colspan="2"><span class="sigsmall"><b>87, Rue de
Turbigo, 75003 Paris, France</b></span><br></td></tr><tr><td><span class="sigsmall">Phone:</span><br></td><td><span class="sigsmall">+33 (0)1 85 08 48 96</span><br></td></tr><tr><td colspan="2"><hr><br></td></tr></tbody></table></div></blockquote><div><br></div>