NOTE: This is not a recommended architecture but rather meant to help you get started on your journey with Chef.
After working through the Assumptions and Prerequisities you will need to provision the server.bootstrap machine using the accompanying Vagrantfile, then adjust your /etc/hosts or HOSTS file on your machine to include a reference to server.bootstrap on 10.11.12.13, then proceed to provision your client.bootstrap machine using the
accompanying Vagrantfile. Note that before you provision either of these machines you will need to create a settings.rb file from the settings.rb.EXAMPLE in both the client/ and server/ directories. You will then need to adjust the value of the SHARED_DIRECTORY variable in each file to match the location of where you checked out this repository on your machine. This is important because both the server and client you are configuring will use this directory to created and consume key and settings files used to configure the two machines for this exercise.
After you've provisioned each machine you will then use the address you added to your /etc/hosts or HOSTS file to access Chef Automate through your browser using the credentials found in the automate-credentials.toml file in the SHARED_DIRECTORY location. This credentials file was generated during the server bootstrap process.
- The following distributions have been tested:
generic/ubuntu1804
We assume the following:
- You have unrestricted access to the Internet.
- You have a computer capable of hosting virtual machines (e.g. at least two cores, at least 8GB of free RAM and at least 60 GB of disk available).
- You have administrative rights to install software on your computer.
We assume you have the following software installed and/or available to you:
- The latest version of Virtual Box is installed.
- The latest version of Vagrant is installed.
- You have access to the latest
genericvagrant box images or an unrestricted connection to the Internet to download the boxes. - You've successfully run the command
vagrant box addwith the distribution you want to use for the exercises described in this README.-
All free
genericboxes can be found through vagrantup or in the following list:generic/rhel7generic/rhel8generic/centos7generic/ubuntu1804
-
- You plan to use the Ubuntu 18.04 version as that was the only version tested in this process. Please submit a PR once you've successfully tested against other distributions or if you'd like to add directions for Windows.
The first step we're taking in this exercise is to install Chef Automate with Chef Infra Server using Vagrant. To accomplish this task you will need to do the following:
- Change the
serverdirectory. - Update the
Vagrantfilewith theBOXyou want to use.- For example an Ubuntu box,
BOX=generic/ubuntu1804
- For example an Ubuntu box,
- Run
vagrant up
The provision.sh script will then:
- Install the Chef Infra Server version and Automated version specified,
- Adjust the local
/etc/hostsfile, - Create a user on the
server.bootstrapmachine with the namevagrantand the passwordvagrant, - Create a chef org called
bootstrapand add an administrative and billing user with the namesouschef, - Place both the user and validator pem files in the
SHARED_DIRECTORYdirectory, - Assign the IP of
10.11.12.13to the chef infra server on the private network,NOTE:You will need to update theBOX_IPif this IP address is in use on the network
- No signed certificates are installed during this process which means when you attempt to access
Chef Automatethrough your browser you will be greeted with an untrusted site/certificate warning. You will need to ignore this warning to proceed to the sign up page where you will enter your information and accept the license to sign-in, - Once the
vagrant upfinishes you will need to confirm theChef Infra Serveris installed. Do the following to accomplish this task:- In the same directory where the
Vagrantfileis located, runvagrant ssh, - Once in, run
head -n1 /opt/opscode/version-manifest.txtto verify the chef server version you expected to be installed is actually installed.
- In the same directory where the
NOTE: There are many ways to bootstrap nodes and this is but one where we co-mingle a workstation with a node. Usually you will not have a workstation as a node.
The next step we're taking in this exercise is to install the Chef Workstation code on your client and then bootstrap the client as a node with the Chef Infra Server with a default run list including audit cookbook and default recipe. To accomplish this task you will need to do the following:
- Change to the
clientdirectory. - Update the
Vagrantfilewith theBOXyou want to use.- For example an Ubuntu box,
BOX=generic/ubuntu1804
- For example an Ubuntu box,
- Select which
config.rb.absoluteorconfig.rb.relativeyou want to link toconfig.rb. It is suggested you use theconfig.rb.absolutefile. - Run
vagrant up
The provision.sh script will then:
- Create a user on the
client.bootstrapmachine with the namevagrantand the passwordvagrant, - Install the Chef Workstation Version specified.
- Adjust the local
/etc/hostsfile, - Create a
bootstrapdirectory containing the clientconfig.rband required credentials, - bootstrap the node,
- fetch the SSL certificates from the Chef Infra Server,
- upload the
auditcookbook to the Chef Infra Server - run the default audit recipe using the
chef-client. - login to the Chef Automate server to confirm the node is connected and working as expected.
If and when you'd like to destroy the server.bootstrap and client.bootstrap machines simple do the following:
adam@hostie onboarding % cd server
adam@hostie server % vagrant destroy
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...and then
adam@hostie onboarding % cd client
adam@hostie client % vagrant destroy
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...Thank to those who helped with ideas or code to get this started. This work was based on the work Dina already started. Thank you Dina!
- Daniel Bright
- Adam M Dutko
- Dina Muscanell
- Steven Tan
The purpose of this project is to help you become comfortable with leveraging the Chef toolkit to identify and remediate a compliance issue on a node. During this exercise you will provision two vagrant boxes. On the bootstrap.server you will provision Chef Automate and Chef Infra Server. On the bootstrap.client you will provision Chef Workstation, the box will be bootstrapped and Inspec will be run against the node after bootstrapping to reveal some of the shortcomings of a standard installation of an Operating Systems. If you find something you think should be changed, updated, added or removed please submit a Pull Request (PR). Enjoy!