1
0

tang.8.adoc 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. tang(8)
  2. =======
  3. :doctype: manpage
  4. == NAME
  5. tang - Network-Based Cryptographic Binding Server
  6. == OVERVIEW
  7. Tang is a service for binding cryptographic keys to network presence. It
  8. offers a secure, stateless, anonymous alternative to key escrow services.
  9. The Tang project arose as a tool to help the automation of decryption.
  10. Existing mechanisms predominantly use key escrow systems where a client
  11. encrypts some data with a symmetric key and stores the symmetric key in a
  12. remote server for later retrieval. The desired goal of this setup is that the
  13. client can automatically decrypt the data when it is able to contact the
  14. escrow server and fetch the key.
  15. However, escrow servers have many additional requirements, including
  16. authentication (so that clients can't get keys they aren't supposed to have)
  17. and transport encryption (so that attackers listening on the network can't
  18. eavesdrop on the keys in transit).
  19. Tang avoids this complexity. Instead of storing a symmetric key remotely,
  20. the client performs an asymmetric key exchange with the Tang server. Since
  21. the Tang server doesn't store or transport symmetric keys, neither
  22. authentication nor encryption are required. Thus, Tang is completely stateless
  23. and zero-configuration. Further, clients can be completely anonymous.
  24. Tang does not provide a client. But it does export a simple REST API and
  25. it transfers only standards compliant JSON Object Signing and Encryption
  26. (JOSE) objects, allowing you to create your own clients using off the shelf
  27. components. For an off-the-shelf automated encryption framework with support
  28. for Tang, see the Clevis project. For the full technical details of the Tang
  29. protocol, see the Tang project's homepage.
  30. == GETTING STARTED
  31. Getting a Tang server up and running is simple:
  32. ifdef::freebsd[]
  33. $ sudo service tangd enable
  34. $ sudo service tangd start
  35. endif::[]
  36. ifndef::freebsd[]
  37. $ sudo systemctl enable tangd.socket --now
  38. endif::[]
  39. That's it. The server is now running with a fresh set of cryptographic keys
  40. and will automatically start on the next reboot.
  41. == CONFIGURATION
  42. Tang intends to be a minimal network service and therefore does not have any
  43. configuration. To adjust the network settings, you can override the
  44. ifdef::freebsd[]
  45. variables in the */usr/local/etc/rc.d/tangd* file.
  46. endif::[]
  47. ifndef::freebsd[]
  48. *tangd.socket* unit file using the standard systemd mechanisms. See
  49. link:systemd.unit.5.adoc[*systemd.unit*(5)] and link:systemd.socket.5.adoc[*systemd.socket*(5)] for more information.
  50. endif::[]
  51. == STANDALONE OR VIA SYSTEMD
  52. The Tang server can be run via systemd socket activation or standalone
  53. when the parameter *-l* is passed. The default port used is 9090 and can
  54. be changed with the *-p* option.
  55. tang -l -p 9090
  56. == ENDPOINT
  57. The Tang server can be provided an endpoint. This endpoint will act as a prefix
  58. for the URL to be accessed by the client. This endpoint can be specified with
  59. the *-e* option.
  60. tang -l -p 9090 -e this/is/an/endpoint
  61. When endpoint is specified, the endpoint will be prepended to the normal adv/rec
  62. URL. If no endpoint is provided, and assuming port 9090 is used, Tang server
  63. will listen on next URLs:
  64. http://localhost:9090/adv (GET)
  65. http://localhost:9090/rec (POST)
  66. If endpoint is provided, and assuming endpoint is /this/is/an/endpoint/, and
  67. assuming also port 9090 is used, Tang server will listen on next URLs:
  68. http://localhost:9090/this/is/an/endpoint/adv (GET)
  69. http://localhost:9090/this/is/an/endpoint/rec (POST)
  70. == KEY ROTATION
  71. In order to preserve the security of the system over the long run, you need to
  72. periodically rotate your keys. The precise interval at which you should rotate
  73. depends upon your application, key sizes and institutional policy. For some
  74. common recommendations, see: https://www.keylength.com.
  75. There is a convenience script to deal with this. See
  76. link:tangd-rotate-keys.1.adoc[*tangd-rotate-keys*(1)] for more information.
  77. This can also be performed manually as described below.
  78. To rotate keys, first we need to generate new keys in the key database
  79. directory. This is typically */var/db/tang*. For example, you can create
  80. new signature and exchange keys with the following commands:
  81. # DB=/var/db/tang
  82. # jose jwk gen -i '{"alg":"ES512"}' -o $DB/new_sig.jwk
  83. # jose jwk gen -i '{"alg":"ECMR"}' -o $DB/new_exc.jwk
  84. Next, rename the old keys to have a leading *.* in order to hide them from
  85. advertisement:
  86. # mv $DB/old_sig.jwk $DB/.old_sig.jwk
  87. # mv $DB/old_exc.jwk $DB/.old_exc.jwk
  88. Tang will immediately pick up all changes. No restart is required.
  89. At this point, new client bindings will pick up the new keys and old clients
  90. can continue to utilize the old keys. Once you are sure that all the old
  91. clients have been migrated to use the new keys, you can remove the old keys.
  92. Be aware that removing the old keys while clients are still using them can
  93. result in data loss. You have been warned.
  94. == HIGH PERFORMANCE
  95. The Tang protocol is extremely fast. However, in the default setup we
  96. use systemd socket activation to start one process per connection. This
  97. imposes a performance overhead. For most deployments, this is still probably
  98. quick enough, given that Tang is extremely lightweight. But for larger
  99. deployments, greater performance can be achieved.
  100. Our recommendation for achieving higher throughput is to proxy traffic to Tang
  101. through your existing web services using a connection pool. Since there is one
  102. process per connection, keeping a number of connections open in this setup
  103. will enable effective parallelism since there are no internal locks in Tang.
  104. For Apache, this is possible using the *ProxyPass* directive of the *mod_proxy*
  105. module.
  106. == HIGH AVAILABILITY
  107. Tang provides two methods for building a high availability deployment.
  108. 1. Client redundancy (recommended)
  109. 2. Key sharing with DNS round-robin
  110. While it may be tempting to share keys between Tang servers, this method
  111. should be avoided. Sharing keys increases the risk of key compromise and
  112. requires additional automation infrastructure.
  113. Instead, clients should be coded with the ability to bind to multiple Tang
  114. servers. In this setup, each Tang server will have its own keys and clients
  115. will be able to decrypt by contacting a subset of these servers.
  116. Clevis already supports this workflow through its *sss* plugin.
  117. However, if you still feel that key sharing is the right deployment strategy,
  118. Tang will do nothing to stop you. Just (securely!) transfer all the contents
  119. of the database directory to all your servers. Make sure you don't forget the
  120. unadvertised keys! Then set up DNS round-robin so that clients will be load
  121. balanced across your servers.
  122. == COMMANDS
  123. The Tang server provides no public commands.
  124. == AUTHOR
  125. Nathaniel McCallum <npmccallum@redhat.com>
  126. == SEE ALSO
  127. ifndef::freebsd[]
  128. link:systemd.unit.5.adoc[*systemd.unit*(5)],
  129. link:systemd.socket.5.adoc[*systemd.socket*(5)],
  130. endif::[]
  131. link:jose-jwk-gen.1.adoc[*jose-jwk-gen*(1)],
  132. link:tang-show-keys.1.adoc[*tang-show-keys*(1)],
  133. link:tangd-rotate-keys.1.adoc[*tangd-rotate-keys*(1)]
  134. == FURTHER READING
  135. * Clevis : https://github.com/latchset/clevis
  136. * Tang : https://github.com/latchset/tang
  137. * JOSE : https://datatracker.ietf.org/wg/jose/charter/
  138. * mod_proxy : https://httpd.apache.org/docs/2.4/mod/mod_proxy.html