0.8.0.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. ==============
  2. salt-api 0.8.0
  3. ==============
  4. We are happy to announce the release of :program:`salt-api` 0.8.0.
  5. This release encompasses bugfixes and new features for the
  6. :py:mod:`rest_cherrypy <salt.netapi.rest_cherrypy.app>` netapi module that
  7. provides a RESTful interface for a running Salt system.
  8. .. note::
  9. Requires Salt 0.13
  10. Changes
  11. =======
  12. In addition to the usual documentation improvements and bug fixes this release
  13. introduces the following changes and additions.
  14. Please note the backward incompatible change detailed below.
  15. RPM packaging
  16. -------------
  17. Thanks to Andrew Niemantsvedriet (`@kaptk2`_) :program:`salt-api` is now
  18. available in Fedora package repositories as well as RHEL compatible systems via
  19. EPEL.
  20. * http://dl.fedoraproject.org/pub/epel/5/i386/repoview/salt-api.html
  21. * http://dl.fedoraproject.org/pub/epel/5/x86_64/repoview/salt-api.html
  22. * http://dl.fedoraproject.org/pub/epel/6/i386/repoview/salt-api.html
  23. * http://dl.fedoraproject.org/pub/epel/6/x86_64/repoview/salt-api.html
  24. Thanks also to Clint Savage (`@herlo`_) and Thomas Spura (`@tomspur`_) for
  25. helping with that process.
  26. .. _`@kaptk2`: https://github.com/kaptk2
  27. .. _`@herlo`: https://github.com/herlo
  28. .. _`@tomspur`: https://github.com/tomspur
  29. Ubuntu PPA packaging
  30. --------------------
  31. Thanks to Sean Channel (`@seanchannel`_, pentabular) :program:`salt-api` is
  32. available as a PPA on the SaltStack LaunchPad team.
  33. https://launchpad.net/~saltstack/+archive/salt
  34. .. _`@seanchannel`: https://github.com/seanchannel
  35. Authentication information on login
  36. -----------------------------------
  37. .. warning:: Backward incompatible change
  38. The :py:class:`/login <salt.netapi.rest_cherrypy.app.Login>` URL no
  39. longer responds with a 302 redirect for success.
  40. Although this is behavior is common in the browser world it is not useful
  41. from an API so we have changed it to return a 200 response in this release.
  42. We take backward compatibility very seriously and we apologize for the
  43. inconvenience. In this case we felt the previous behavior was limiting.
  44. Changes such as this will be rare.
  45. New in this release is displaying information about the current session and the
  46. current user. For example:
  47. .. code-block:: bash
  48. % curl -sS localhost:8000/login \
  49. -H 'Accept: application/x-yaml'
  50. -d username='saltdev'
  51. -d password='saltdev'
  52. -d eauth='pam'
  53. return:
  54. - eauth: pam
  55. expire: 1365508324.359403
  56. perms:
  57. - '@wheel'
  58. - grains.*
  59. - state.*
  60. - status.*
  61. - sys.*
  62. - test.*
  63. start: 1365465124.359402
  64. token: caa7aa2b9dbc4a8adb6d2e19c3e52be68995ef4b
  65. user: saltdev
  66. Bypass session handling
  67. -----------------------
  68. A convenience URL has been added
  69. (:py:class:`/run <salt.netapi.rest_cherrypy.app.Run>`) to bypass the normal
  70. session-handling process.
  71. The REST interface uses the concept of "lowstate" data to specify what function
  72. should be executed in Salt (plus where that function is and any arguments to
  73. the function). This is a thin wrapper around Salt's various "client"
  74. interfaces, for example Salt's :ref:`LocalClient() <python-api>` which can
  75. accept authentication credentials directly.
  76. Authentication with the REST API typically goes through the login URL and a
  77. session is generated that is tied to a Salt external_auth token. That token is
  78. then automatically added to the lowstate for subsequent requests that match the
  79. current session.
  80. It is sometimes useful to handle authentication or token management manually
  81. from another program or script. For example:
  82. .. code-block:: bash
  83. curl -sS localhost:8000/run \
  84. -d client='local' \
  85. -d tgt='*' \
  86. -d fun='test.ping' \
  87. -d eauth='pam' \
  88. -d username='saltdev' \
  89. -d password='saltdev'
  90. It is a Bad Idea (TM) to do this unless you have a very good reason and a well
  91. thought out security model.
  92. Logout
  93. ------
  94. An URL has been added
  95. (:py:class:`/logout <salt.netapi.rest_cherrypy.app.Logout>`) that will cause
  96. the client-side to expire the session cookie and the server-side session to be
  97. invalidated.
  98. Running the REST interface via any WSGI-compliant server
  99. --------------------------------------------------------
  100. The :py:mod:`rest_cherrypy <salt.netapi.rest_cherrypy.app>` netapi module is
  101. a regular WSGI application written using the CherryPy framework. It was written
  102. with the intent of also running from any WSGI-compliant server such as Apache
  103. and mod_wsgi, Gunicorn, uWSGI, Nginx, and FastCGI, etc.
  104. The WSGI application entry point has been factored out into a stand-alone file
  105. in this release suitable for calling from an external server.
  106. :program:`salt-api` does not need to be running in this scenario.
  107. For example, an Apache virtual host configuration:
  108. .. code-block:: text
  109. <VirtualHost *:80>
  110. ServerName example.com
  111. ServerAlias *.example.com
  112. ServerAdmin webmaster@example.com
  113. LogLevel warn
  114. ErrorLog /var/www/example.com/logs/error.log
  115. CustomLog /var/www/example.com/logs/access.log combined
  116. DocumentRoot /var/www/example.com/htdocs
  117. WSGIScriptAlias / /path/to/salt/netapi/rest_cherrypy/wsgi.py
  118. </VirtualHost>
  119. Participation
  120. =============
  121. Please get involved by `filing issues`__ on GitHub, `discussing on the mailing
  122. list`__, and chatting in ``#salt-devel`` on Freenode.
  123. .. __: https://github.com/saltstack/salt-api/issues
  124. .. __: https://groups.google.com/forum/#!forum/salt-users