No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0257.xml 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Client Certificate Management for SASL EXTERNAL</title>
  10. <abstract>This specification defines a method to manage client certificates that can be used with SASL External to allow clients to log in without a password.</abstract>
  11. &LEGALNOTICE;
  12. <number>0257</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0178</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>NOT YET ASSIGNED</shortname>
  23. &dmeyer;
  24. <author>
  25. <firstname>Thijs</firstname>
  26. <surname>Alkemade</surname>
  27. <email>thijsalkemade@gmail.com</email>
  28. <jid>thijs@xnyhps.nl</jid>
  29. </author>
  30. <revision>
  31. <version>0.3</version>
  32. <date>2012-07-18</date>
  33. <initials>tpa</initials>
  34. <remark>
  35. <ul>
  36. <li>Removed the dependency on &xep0189;.</li>
  37. <li>Placed the certificate data directly in the &lt;append/&gt; element.</li>
  38. <li>Clarified up the usage of the certificate's name.</li>
  39. <li>Increased the version to 'urn:xmpp:saslcert:1'.</li>
  40. <li>Added a section on discovering support.</li>
  41. <li>Added the possibility for the server to send a list of currently used certificates.</li>
  42. <li>Updated the relation with &xep0178; to match the current version.</li>
  43. </ul>
  44. </remark>
  45. </revision>
  46. <revision>
  47. <version>0.2</version>
  48. <date>2009-02-12</date>
  49. <initials>dm</initials>
  50. <remark>
  51. <ul>
  52. <li>Added note about full JID in subjectAltName.</li>
  53. <li>Added information about certificates signed by a CA.</li>
  54. <li>Made it possible to restrict access with no-cert-management.</li>
  55. <li>Updated the examples.</li>
  56. <li>Split revoke command into disable and revoke.</li>
  57. <li>Added more documentation including more detailed use cases.</li>
  58. <li>Additional security considerations.</li>
  59. </ul>
  60. </remark>
  61. </revision>
  62. <revision>
  63. <version>0.1</version>
  64. <date>2009-01-05</date>
  65. <initials>psa</initials>
  66. <remark><p>Initial published version.</p></remark>
  67. </revision>
  68. <revision>
  69. <version>0.0.2</version>
  70. <date>2008-11-28</date>
  71. <initials>dm</initials>
  72. <remark><p>Add Security Considerations, improve reference to XEP-0178.</p></remark>
  73. </revision>
  74. <revision>
  75. <version>0.0.1</version>
  76. <date>2008-11-18</date>
  77. <initials>dm</initials>
  78. <remark><p>First draft.</p></remark>
  79. </revision>
  80. </header>
  81. <section1 topic='Introduction' anchor='intro'>
  82. <p>An XMPP client typically needs a user name and a password to log into an account. Many clients provide a mechanism to store these credentials to automatically log in into an account. While this practice is very user friendly, it is a security risk for some devices and services. Mobile devices like a phone or a laptop may get stolen, providing the thief with the required password. Phones are particularly insecure: providing the password on the keypad for each log in is too complicated and the risk of losing the phone is high. A bot which needs access to a user's account needs to store the password or request the user to enter it every time it is started.</p>
  83. <p>A solution to this problem is to allow a client to log in without knowing the password. XMPP as specified in &rfc3920; and updated in &rfc6120; allows the use of any SASL mechanism (see &rfc4422;) in the authentication of XMPP entities, including the SASL EXTERNAL mechanism. &xep0178; defines the usage of X.509 certificates used in the TLS handshake.</p>
  84. <p>XEP-0178 assumes that the certificates used for SASL EXTERNAL are signed by a trusted CA. This could be a problem for the average user: signing a certificate can be both complicated and expensive (in terms of time and money). If the device gets stolen, the user also needs to provide the required information to the CA to revoke the certificate, and the server needs to keep its list of revoked certificates up-to-date. The end-to-end security mechanism described in &xep0250; relies on self-signed certificates (although CA-issued certificates are allowed). A client capable of secure end-to-end communicate already has a self-signed X.509 certificate for that purpose. The same client certificate should be used for a client to log in. Since the certificates are not signed by a trusted CA, the server must be aware of the list of certificates that are used by the user's clients. This document describes how to manage the list of client certificates.</p>
  85. </section1>
  86. <section1 topic='Certificate Management' anchor='manage'>
  87. <p>To manage their certificates, this protocol describes a way for clients to store, query and remove certificates on their server. These certificates can be generated by the client itself, for example to replace a password-based login, or the certificates can be imported by the user.</p>
  88. <section2 topic='Add a X.509 Certificate' anchor='add'>
  89. <p>When a user wants to add a certficate, the client uploads it to the server. It does this by sending an &lt;iq/&gt; with an &lt;append/&gt; payload qualified by the 'urn:xmpp:saslcert:1' namespace. The &lt;append/&gt; element MUST include an &lt;x509cert/&gt; element containing the Base64 encoded DER data of the certificate. The client also MUST provide a unique name for the certificate as a &lt;name/&gt; element to make it possible for the user to manage their different client certificates.</p>
  90. <example caption='Client Uploads an X.509 Certificate. Whitespace only added for presentation.'><![CDATA[
  91. <iq type='set'
  92. from='hamlet@shakespeare.lit/denmark'
  93. id='append'>
  94. <append xmlns='urn:xmpp:saslcert:1'>
  95. <name>Mobile Client</name>
  96. <x509cert>
  97. MIICCTCCAXKgAwIBAgIJALhU0Id6xxwQMA0GCSqGSIb3DQEBBQUAMA4xDDAKBgNV
  98. BAMTA2ZvbzAeFw0wNzEyMjgyMDA1MTRaFw0wODEyMjcyMDA1MTRaMA4xDDAKBgNV
  99. BAMTA2ZvbzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0DPcfeJzKWLGE22p
  100. RMINLKr+CxqozF14DqkXkLUwGzTqYRi49yK6aebZ9ssFspTTjqa2uNpw1U32748t
  101. qU6bpACWHbcC+eZ/hm5KymXBhL3Vjfb/dW0xrtxjI9JRFgrgWAyxndlNZUpN2s3D
  102. hKDfVgpPSx/Zp8d/ubbARxqZZZkCAwEAAaNvMG0wHQYDVR0OBBYEFJWwFqmSRGcx
  103. YXmQfdF+XBWkeML4MD4GA1UdIwQ3MDWAFJWwFqmSRGcxYXmQfdF+XBWkeML4oRKk
  104. EDAOMQwwCgYDVQQDEwNmb2+CCQC4VNCHesccEDAMBgNVHRMEBTADAQH/MA0GCSqG
  105. SIb3DQEBBQUAA4GBAIhlUeGZ0d0msNVxYWAXg2lRsJt9INHJQTCJMmoUeTtaRjyp
  106. ffJtuopguNNBDn+MjrEp2/+zLNMahDYLXaTVmBf6zvY0hzB9Ih0kNTh23Fb5j+yK
  107. QChPXQUo0EGCaODWhfhKRNdseUozfNWOz9iTgMGw8eYNLllQRL//iAOfOr/8
  108. </x509cert>
  109. </append>
  110. </iq>
  111. ]]></example>
  112. <p>The server either returns an empty result or an error. The server MUST return an error when a client tries to add a certificate using a name that is already used by a certificate. From then on the user can use that certificate to authenticate using SASL EXTERNAL.</p>
  113. <p>The client adding the certificate does not need to be the client using it. A user may use a client to upload a certificate for a bot. The bot creates its certificate and private key, and the user uploads the certificate to the server. After that procedure the bot can log in to the XMPP network without ever knowing the user's password.</p>
  114. <p>An optional element &lt;no-cert-management/&gt; inside the append element indicates that a client logged in with that certificate is not allowed to add or remove certificates from the list. A server MAY allow such a client to query the list of certificates.</p>
  115. <example caption='X.509 Certificate Upload (no-cert-management)'><![CDATA[
  116. <iq type='set'
  117. from='hamlet@shakespeare.lit/denmark'
  118. id='nocert'>
  119. <append xmlns='urn:xmpp:saslcert:1'>
  120. <name>Simple Bot</name>
  121. <no-cert-management/>
  122. <x509cert>
  123. ...
  124. </x509cert>
  125. </append>
  126. </iq>
  127. ]]></example>
  128. </section2>
  129. <section2 topic='Request a List of all Certificates'>
  130. <p>A user may want to get a list of all certificates that can be used for SASL EXTERNAL. The client can query the list of the items by sending an &lt;iq/&gt; stanza with an &lt;items/&gt; payload qualified by the 'urn:xmpp:saslcert:1' namespace.</p>
  131. <example caption='Client Requests List of X.509 Certificates'><![CDATA[
  132. <iq type='get'
  133. from='hamlet@shakespeare.lit/denmark'
  134. id='query'>
  135. <items xmlns='urn:xmpp:saslcert:1'/>
  136. </iq>
  137. ]]></example>
  138. <p>The server then returns the list of all known certificates including the user provided name. For every certificate, the server MAY include a &lt;users/&gt; element with a &lt;resource/&gt; for every resource that is currently logged in and used that certificate with SASL EXTERNAL.</p>
  139. <example caption='Server Sends List of Known X.509 Certificates'><![CDATA[
  140. <iq type='result'
  141. to='hamlet@shakespeare.lit/denmark'
  142. id='query'>
  143. <items xmlns='urn:xmpp:saslcert:1'>
  144. <item>
  145. <name>Mobile Client</name>
  146. <x509cert>
  147. ...
  148. </x509cert>
  149. <users>
  150. <resource>Phone</resource>
  151. </users>
  152. </item>
  153. <item>
  154. <name>Laptop</name>
  155. <x509cert>
  156. ...
  157. </x509cert>
  158. </item>
  159. </items>
  160. </iq>
  161. ]]></example>
  162. </section2>
  163. <section2 topic='Disable a Certificate'>
  164. <p>To make it easier to transition to a new certificate when the current one expires, without requiring the user to enter their password again, a client can upload a new certificate to replace its current certificate. After the new certificate is added to the server, it MAY want to disable the old certificate to keep the list of certificates short. Without that, the list will grow indefinitely, making the certificate handling for the user more difficult. Once a certificate is removed it can no longer be used for SASL EXTERNAL. A server MAY automatically remove expired certificates for this list.</p>
  165. <p>A client can disable a certificate by sending an &lt;iq/&gt; stanza containing a &lt;disable/&gt; element qualified by the 'urn:xmpp:saslcert:1' namespace and containing a &lt;name/&gt; element with the user-provided name for the certificate.</p>
  166. <example caption='Client disables an X.509 Certificate'><![CDATA[
  167. <iq type='set'
  168. from='hamlet@shakespeare.lit/denmark'
  169. id='disable'>
  170. <disable xmlns='urn:xmpp:saslcert:1'>
  171. <name>Mobile Client</name>
  172. </disable>
  173. </iq>
  174. ]]></example>
  175. </section2>
  176. <section2 topic='Revoke a Certificate'>
  177. <p>The user may want to revoke a certificate from a stolen or compromised device. The mechanism is similar to disabling a certificate. The difference is that if a client is logged in with that compromised certificate using SASL EXTERNAL, the server SHOULD close the stream to that client forcing a log out of the client.</p>
  178. <p>A client can revoke a certificate by sending an &lt;iq/&gt; stanza containing a &lt;revoke/&gt; element qualified by the 'urn:xmpp:saslcert:1' namespace and containing a &lt;name/&gt; element with the user provided name for the certificate.</p>
  179. <example caption='Client revokes an X.509 Certificate'><![CDATA[
  180. <iq type='set'
  181. from='hamlet@shakespeare.lit/denmark'
  182. id='revoke'>
  183. <revoke xmlns='urn:xmpp:saslcert:1'>
  184. <name>Mobile Client</name>
  185. </revoke>
  186. </iq>
  187. ]]></example>
  188. </section2>
  189. </section1>
  190. <section1 topic='SASL EXTERNAL' anchor='sasl'>
  191. <p>When using SASL EXTERNAL, the certificate does not need to be signed by a trusted entity if the certificate was uploaded by a user. The server still MUST reject the certificate if it is expired. In a company environment the server MAY only accept signed certificates; the behavior depends on the company's security policy. A free public XMPP server MUST allow self-signed certificates and certificates signed by a CA unknown to the server.</p>
  192. <p>The client certificate SHOULD include a JID as defined in sections 17.2.1.2. and 17.2.1.3. in RFC 6120: a JID MUST be represented as an XmppAddr, i.e., as a UTF8String within an otherName entity inside the subjectAltName.</p>
  193. <example caption='subjectAltName using the "id-on-xmppAddr" format'><![CDATA[
  194. subjectAltName=otherName:id-on-xmppAddr;UTF8:hamlet@shakespeare.lit
  195. ]]></example>
  196. <p>The protocol flow is almost the same as described in XEP-0178, except for the resource binding in step 12. If the client used a certificate with a single XmppAddr field and that field contained a full JID, or if the certificate had multiple XmppAddr fields and the address that was used as authorization identity was a full JID, then the server should only allow the client to use the resource of that JID. If a client with the same resource is currently logged in it SHOULD be logged out by the server.</p>
  197. </section1>
  198. <section1 topic='Determining Support'>
  199. <p>If a server supports storage of client side certificates, it MUST advertise that fact by including the feature "urn:xmpp:saslcert:1" in response to a &xep0030; request:</p>
  200. <example caption='Client queries for server features'><![CDATA[
  201. <iq type='get' id='disco1' to='shakespeare.lit' from='hamlet@shakespeare.lit/denmark'>
  202. <query xmlns='http://jabber.org/protocol/disco#info'/>
  203. </iq>
  204. ]]></example>
  205. <example caption='Server responds with features'><![CDATA[
  206. <iq type='result' id='disco1' from='shakespeare.lit' to='hamlet@shakespeare.lit/denmark'>
  207. <query xmlns='http://jabber.org/protocol/disco#info'>
  208. ...
  209. <feature var='urn:xmpp:saslcert:1'/>
  210. ...
  211. </query>
  212. </iq>
  213. ]]></example>
  214. </section1>
  215. <section1 topic='Security Considerations' anchor='security'>
  216. <section2 topic='Stream Characteristics'>
  217. <p>This specification allows the user to manipulate an alternative way to log into the server. The certificates are not required to be signed and any certificate can be used. Therefore the server MUST reject any communication described in this document if the link between client and server is not secured with both STARTTLS and SASL to prevent a man-in-the-middle from modifying the certificate.</p>
  218. </section2>
  219. <section2 topic='Changing the Password'>
  220. <p>&xep0077; defines a mechanism to change the password without knowing the current one. If the server supports password change it MUST return not-authorized for clients logged in using SASL EXTERNAL and MAY include a password change form requiring the old password.</p>
  221. <example caption='Password Change'><![CDATA[
  222. <iq type='set' to='shakespeare.lit' id='change1'>
  223. <query xmlns='jabber:iq:register'>
  224. <username>hamlet</username>
  225. <password>newpass</password>
  226. </query>
  227. </iq>
  228. ]]></example>
  229. <example caption='Server Returns Password Change Form With Error'><![CDATA[
  230. <iq type='error' from='shakespeare.lit' to='hamlet@shakespeare.lit/denmark' id='change1'>
  231. <query xmlns='jabber:iq:register'>
  232. <x xmlns='jabber:x:data' type='form'>
  233. <title>Password Change</title>
  234. <instructions>Use this form to change your password.</instructions>
  235. <field type='hidden' var='FORM_TYPE'>
  236. <value>jabber:iq:register:changepassword</value>
  237. </field>
  238. <field type='text-single' label='Username' var='username'>
  239. <required/>
  240. </field>
  241. <field type='text-private' label='Old Password' var='old_password'>
  242. <required/>
  243. </field>
  244. <field type='text-private' label='New Password' var='password'>
  245. <required/>
  246. </field>
  247. </x>
  248. </query>
  249. <error code='405' type='cancel'>
  250. <not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  251. </error>
  252. </iq>
  253. ]]></example>
  254. </section2>
  255. </section1>
  256. <section1 topic='IANA Considerations' anchor='iana'>
  257. <p>This document requires no interaction with &IANA;.</p>
  258. </section1>
  259. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  260. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  261. <p>This specification defines the following XML namespace:</p>
  262. <ul>
  263. <li>urn:xmpp:saslcert:1</li>
  264. </ul>
  265. <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  266. </section2>
  267. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  268. &NSVER;
  269. </section2>
  270. </section1>
  271. <section1 topic='XML Schema' anchor='schema'>
  272. <p>The XML schema will be provided in a later version of this document.</p>
  273. </section1>
  274. </xep>