Skip to content

Add information about public ca key, access key, and secret key. #4419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 69 additions & 10 deletions content/360/saas/get_started/enroll_nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ To enroll a Windows node, follow these steps:

## Cookbook-based enrollment

With cookbook-based enrollment, you enroll nodes from the client side by uploading a [cookbook](https://docs.chef.io/cookbooks/) with enrollment settings to Chef Infra Server and then Chef Infra Client enrolls the node with Chef 360 SaaS.
With cookbook-based enrollment, you enroll nodes from the client side by uploading a [cookbook](/cookbooks/) with enrollment settings to Chef Infra Server and then Chef Infra Client enrolls the node with Chef 360 SaaS.

### Enroll nodes
### Enroll nodes with a cookbook

The `chef-cookbook-enroll` cookbook uses the `node_management_enroll` custom resource and a [wrapper cookbook](https://www.chef.io/blog/writing-wrapper-cookbooks) to define enrollment settings.

Expand All @@ -144,23 +144,82 @@ To configure the cookbooks and define enrollment settings, follow these steps:
chef generate cookbook <COOKBOOK_NAME>
```

In the [`metadata.rb` file](https://docs.chef.io/config_rb_metadata/) of your wrapper cookbook, add the following dependency to include the `chef-cookbook-enroll` cookbook:
In the [`metadata.rb` file](/config_rb_metadata/) of your wrapper cookbook, add the following dependency to include the `chef-cookbook-enroll` cookbook:

```ruby
depends 'chef360-node-enroll', '~> 1.0.0'
```

1. Copy of the Chef 360 SaaS public key and add it to your wrapper cookbook:

```plaintext
-----BEGIN CERTIFICATE-----
MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4
GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjM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ERTIFICATE-----
```

This public key expires on March 18, 2029.

1. Generate an access key and secret key:

```bash
chef-platform-auth-cli user-account self create-token --body '{"expiration": "<EXPIRATION_DATE>", "name": "<TOKEN_NAME>"}' --profile <PROFILE_NAME>
```

Replace:

- `<EXPIRATION_DATE>` with a date and time in ISO 8601 format (for example, `2027-12-31T11:42:23-05:00`).
- `<TOKEN_NAME>` with a meaningful token name for easy identification.
- `<PROFILE_NAME>` with a profile that has the node-manager role assigned to it.

The response includes an access key and secret key and is similar to the following:

```json
{
"item": {
"accessKey": "6QIUKP4WIXD4RVAF0BQ3",
"expiration": "2027-12-31T11:42:23-05:00",
"id": "bcba5b7a-fb0b-4a62-b442-7ba7bda5e05a",
"name": "CI-CD Token",
"role": {
"id": "5fcb0235-1e56-4ece-8857-404a5d39a290",
"name": "tenant-admin"
},
"secretKey": "x6aCg1NckQoLsQnere26fmGgD0RiWOrf4RNXBhlg"
}
}
```

1. Define the `node_management_enroll` resource in your wrapper cookbook's recipe:

```ruby
node_management_enroll 'Enroll Node' do
chef_platform_url '<CHEF_360_FQDN>'
enroll_type '<ENROLLMENT_TYPE>'
api_port '<API_PORT>'
api_port '443'
access_key '<ACCESS_KEY>'
secret_key '<SECRET_KEY>'
cohort_id '<COHORT_ID>'
hab_builder_url '<HABITAT_BUILDER_URL>'
root_ca <CHEF_360_SAAS_PUBLIC_KEY>
working_dir_path '<VALID_DIR_PATH>'
upgrade_skills <UPGRADE_SKILLS>
end
Expand All @@ -170,30 +229,30 @@ To configure the cookbooks and define enrollment settings, follow these steps:

- `<CHEF_360_FQDN>` with the fully qualified domain name (FQDN) for your Chef 360 SaaS deployment.
- `<ENROLLMENT_TYPE>` with either `full` or `partial` depending on the form of enrollment. Use `full` unless you must `partial`.
- `<API_PORT>` with the API port configured in Chef 360 SaaS. The default value is `31000`.
- `<ACCESS_KEY>` with an access key for secure communication with Chef 360 SaaS. Store securely using an [encrypted Chef data bag](https://docs.chef.io/data_bags/) or a [secrets manager](https://docs.chef.io/infra_language/secrets/).
- `<SECRET_KEY>` with a secret key for secure communication with Chef 360 SaaS. Store securely using an [encrypted Chef data bag](https://docs.chef.io/data_bags/) or a [secrets manager](https://docs.chef.io/infra_language/secrets/).
- `<ACCESS_KEY>` with the access key for secure communication with Chef 360 SaaS. This should be stored using an [encrypted Chef data bag](/data_bags/) or [secrets manager](/infra_language/secrets/).
- `<SECRET_KEY>` with the secret key for secure communication with Chef 360 SaaS. This should be stored using an [encrypted Chef data bag](/data_bags/) or [secrets manager](/infra_language/secrets/).
- `<COHORT_ID>` with a valid cohort UUID. The cohort defines all skills and settings installed on the node.
- `<HABITAT_BUILDER_URL>` with the URL of the Chef Habitat Builder used by your organization. Default value: `https://bldr.habitat.sh`
- `<CHEF_360_SAAS_PUBLIC_KEY>` if TLS is enabled, with the root CA public key. For example, `node['enroll']['root_ca']`.
- `<VALID_DIR_PATH>` with a temporary working directory where all required builds are downloaded. Specify a valid path based on the OS. Default value: `/tmp`.
- `<UPGRADE_SKILLS>` with `true` or `false`. If `true`, Chef 360 SaaS checks for the latest skill versions and installs them if found. Default value: `false`.

1. Push the wrapper cookbook or policy to the Chef Infra Server.

1. If you're using a role, [upload](https://docs.chef.io/workstation/knife_cookbook/#upload) the wrapper cookbook to the Chef Infra Server:
1. If you're using a role, [upload](/workstation/knife_cookbook/#upload) the wrapper cookbook to the Chef Infra Server:

```bash
knife cookbook upload <WRAPPER_COOKBOOK_NAME> --cookbook-path <WRAPPER_COOKBOOK_DIR_PATH>
```

1. If you're using a Policyfile, [create `Policyfile.lock.json` file](https://docs.chef.io/workstation/ctl_chef/#chef-install) and [push](https://docs.chef.io/workstation/ctl_chef/#chef-push) the Policyfile to Chef Infra Server:
1. If you're using a Policyfile, [create `Policyfile.lock.json` file](/workstation/ctl_chef/#chef-install) and [push](/workstation/ctl_chef/#chef-push) the Policyfile to Chef Infra Server:

```bash
chef install
chef push <POLICY_GROUP> <POLICYFILE>
```

1. Include the wrapper cookbook in your node's run-list by adding it to a role or Policyfile. See the [run-list](https://docs.chef.io/run_lists/) and [role](https://docs.chef.io/roles/#manage-roles) documentation for more information.
1. Include the wrapper cookbook in your node's run-list by adding it to a role or Policyfile. See the [run-list](/run_lists/) and [role](/roles/#manage-roles) documentation for more information.

The next time Chef Infra Client runs, it executes the `node_management_enroll` resource and the node is enrolled with Chef 360 SaaS.

Expand Down