tcp.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. =============
  2. TCP Transport
  3. =============
  4. The tcp transport is an implementation of Salt's channels using raw tcp sockets.
  5. Since this isn't using a pre-defined messaging library we will describe the wire
  6. protocol, message semantics, etc. in this document.
  7. The tcp transport is enabled by changing the :conf_minion:`transport` setting
  8. to ``tcp`` on each Salt minion and Salt master.
  9. .. code-block:: yaml
  10. transport: tcp
  11. .. warning::
  12. We currently recommend that when using Syndics that all Masters and Minions
  13. use the same transport. We're investigating a report of an error when using
  14. mixed transport types at very heavy loads.
  15. Wire Protocol
  16. =============
  17. This implementation over TCP focuses on flexibility over absolute efficiency.
  18. This means we are okay to spend a couple of bytes of wire space for flexibility
  19. in the future. That being said, the wire framing is quite efficient and looks
  20. like:
  21. .. code-block:: text
  22. msgpack({'head': SOMEHEADER, 'body': SOMEBODY})
  23. Since msgpack is an iterably parsed serialization, we can simply write the serialized
  24. payload to the wire. Within that payload we have two items "head" and "body".
  25. Head contains header information (such as "message id"). The Body contains the
  26. actual message that we are sending. With this flexible wire protocol we can
  27. implement any message semantics that we'd like-- including multiplexed message
  28. passing on a single socket.
  29. TLS Support
  30. ===========
  31. .. versionadded:: 2016.11.1
  32. The TCP transport allows for the master/minion communication to be optionally
  33. wrapped in a TLS connection. Enabling this is simple, the master and minion need
  34. to be using the tcp connection, then the `ssl` option is enabled. The `ssl`
  35. option is passed as a dict and corresponds to the options passed to the
  36. Python `ssl.wrap_socket <https://docs.python.org/2/library/ssl.html#ssl.wrap_socket>`
  37. function.
  38. A simple setup looks like this, on the Salt Master add the `ssl` option to the
  39. master configuration file:
  40. .. code-block:: yaml
  41. ssl:
  42. keyfile: <path_to_keyfile>
  43. certfile: <path_to_certfile>
  44. ssl_version: PROTOCOL_TLSv1_2
  45. The minimal `ssl` option in the minion configuration file looks like this:
  46. .. code-block:: yaml
  47. ssl: True
  48. # Versions below 2016.11.4:
  49. ssl: {}
  50. Specific options can be sent to the minion also, as defined in the Python
  51. `ssl.wrap_socket` function.
  52. .. note::
  53. While setting the ssl_version is not required, we recommend it. Some older
  54. versions of python do not support the latest TLS protocol and if this is
  55. the case for your version of python we strongly recommend upgrading your
  56. version of Python.
  57. Crypto
  58. ======
  59. The current implementation uses the same crypto as the ``zeromq`` transport.
  60. Pub Channel
  61. ===========
  62. For the pub channel we send messages without "message ids" which the remote end
  63. interprets as a one-way send.
  64. .. note::
  65. As of today we send all publishes to all minions and rely on minion-side filtering.
  66. Req Channel
  67. ===========
  68. For the req channel we send messages with a "message id". This "message id" allows
  69. us to multiplex messages across the socket.