OverviewChef-client and knife both communicate with the Chef Server using a REST API.Chef-clients make API requests to retrieve their run list, download their cookbooks, and save their state after a successful run.When developing cookbooks and managing your infrastructure, you will regularly use Knife commands which make API request to the Chef Server.
After your initial configuration of nodes and your workstations, these processes are largely transparent. However, understanding both of these processes is often important when debugging potential problems. Since Chef-Solo does not communicate with a Chef Server, authentication and authorization do not play a role in the normal use of chef-solo. This article covers how a given API client's requests are authenticated and authorized. For information about specific errors see Common Errors. AuthenticationThe authentication process in Chef uses public key encryption, and is the same for users of the Open Source Chef Server as well as Hosted Chef and Private Chef. When an API client is created, private and public encryption keys are created. The public key is stored on the Chef Server, while the private key is returned to the user for safe keeping. The private key is the ".pem" file that you put in your local .chef directory or in /etc/chef. Chef executables such as chef-client and knife authenticate requests to the Chef Server by encrypting a specially crafted set of HTTP Headers with the private key. The Chef Server then uses the public key to de-crypt the headers and verifies their content. This process helps ensure that requests are only accepted from known API clients. For technical details on how API requests are authentication see Making Authenticated API Requests. To debug common problems that can result in Authorization errors, see Common Errors. Initial Chef-client run
The validator client's key pair is created when you first install an Chef Server or create a Hosted Chef organization and is moved onto clients by the Knife Bootstrap process or manually during the chef-client install process. This validator client creates a new API client that the node can then use for all future request. A check is done to see if a client key exists on the node (typically, /etc/chef/client.pem)
If we were issued a new API Client Key, we start using it to sign subsequent requests. Debugging Authentication ProblemsAuthentication problems are situations in which chef-client receives HTTP Status 401 in response to its request. If you are receiving HTTP Status 403, the problem is with Authorization. An authentication error error may look like the following: To debug authentication problems, the first piece of information to determine is the API client that chef-client is attempting to authenticate as. You can usually see this in the log messages emitted by chef-client. For instance if you turn on debug logging (chef-client -l debug) you will see a line such as: If the authentication is happening with your validator client, the problem is most likely with your validation key. If the authentication is happening with the nodes API client, there are a number of common causes.
WebUIThe WebUI also uses Chef Server's REST API to perform most operations. As such requests from the API are also authenticated. The WebUI authenticates using a keypair that is generated during the installation. Hosted Chef users need not worry about the management of the WebUIs authentication keys, as Opscode handles that for you. Private Chef users WebUI authentication keys are managed by the internal administrator(s) responsible for the Private Chef server. AuthorizationOpen Source Chef has a single tenant access control model, which is very different from the role-based access control (RBAC) model of Hosted Chef and Private Chef. See Hosted Chef Authorization for the Hosted Chef and Private Chef authorization model. Authorization in the Open Source Chef Server is governed by the designation of API clients as non-admin, admin, or validator clients. Admin clients are created by setting the client's admin attribute to true. Validator clients are created during the Chef Server installation. Admin Clients Only
Admin Clients or Validator Client
Note that only admin clients can create other admin clients. Admin Clients or Clients Acting on Themselves
Any functions not listed in the above tables can be performed by any API client that has made a properly authenticated request. SummaryOpen Source Chef Server has a single tenant access control model.
The role-based access control (RBAC) model of Hosted and Private Chef is detailed at Hosted Chef Authorization.
|
|
|



