Skip to main content
McAfee MVISION Cloud

Install the McAfee Agent via Chef Script

Prerequisites

Configure MVISION Cloud for CWP

See the instructions in Configure MVISION Cloud for CWP.

Configure the Chef Infrastructure

If you haven't already, configure the Chef infrastructure. For details, see Configure the Chef Infrastructure

Download the Chef Script to Install the McAfee Agent

Click here to Download the Chef Script.

Install the McAfee Agent

  1. Log in to the Chef controller system where you want to install the McAfee Agent.
  2. Unzip the file cwsDevOps.zip, which contains the files and folders required to install the McAfee Agent. 
  3. Run the following command to create a databag on the server and a secret key in cwsDevOps/files/encrypted_data_bag_secret:
ruby CreateMvisionCloudDataBag.rb <MVC_username> <MVC_password> <MVC_URL>
  1. Run the following command to create a cookbook:
chef generate cookbook <cookbook_name>
  1. Go to the folder cwsDevOps and copy the recipes, files, and libraries folders to the cookbook.
  2. Run the following command:
cp ./recipes/ <cookbook_name>/ -r && ./libraries/ <cookbook_name>/ -r && ./files/ <cookbook_name>/ -r
  1. Push the cookbook using the following commands:
cd <cookbook_name>
chef install
chef push <cookbook_name>
knife node policy set <chef_client_name> POLICY_GROUP POLICY_NAME

Configure the Chef Infrastructure

Use the following instructions to create a Chef controller and server. Then link the controller and the server. Finally, create a Chef client. These instructions focus on Microsoft Azure. 

Create the Chef Controller

  1. In Azure, create a virtual machine to act as your Chef controller.
  2. Provide a username and password for authentication, then enable the SSH port. 
  3. Log in to the virtual machine. 
  4. Generate the SSH keys using the following command:
ssh-keygen -t rsa -b 2048
  1. Copy the public key from <Root_Dir>/.ssh/id_rsa.pub

Create the Chef Server

  1. Log in to the Azure Portal
  2. Click Create a new resource. Then search for Chef Automate, select it, and click Create.
  3. The first blade contains a summary of the Chef Automate solution. Click Create

NOTE: If you don’t have a license, you can deploy and use Chef with a free 30-day trial. Just leave the license field empty.

  1. In the Basics blade, define a username, and paste the previously copied public key.
  2. To provision a Chef server, use a new or empty Resource Group.
  3. Click OK to create the server.
  4. Note the following settings of the Chef server:
    • Chef Automate FQDN DNS Label. This is the name of this server. It is publicly available.
    • Virtual Network. This is where the server is located. Use the same segment of the current production servers. 
    • Subnets. Use an existing subnet where this server can communicate with existing servers (if any).
  5. Once the provisioning process is complete, check the Chef Automate VM on the Resource Group that you created.
  6. In the Overview tab, copy the DNS Name.

Link the Chef Controller to the Chef Server

  1. Connect to the Chef server from Chef controller machine.
  2. Copy the file \starterkit-trial.zip.
  3. Unzip the file starterkit-trial.zip
  4. Run the following commands:
cd .chef/
wget https://packages.chef.io/files/stable/chefdk/4.5.0/ubuntu/18.04/chefdk_4.5.0-1_amd64.deb
sudo dpkg -i chefdk_4.5.0-1_amd64.deb
chef verify
knife ssl fetch
knife ssl check

Create the Chef Client

  1. In Azure, create a virtual machine to act as your Chef client.
  2. Provide a username and password for authentication, then enable the SSH port. 
  3. Copy the FQDN/IP of the VM you created as the Chef controller. 
  4. Run following command:
knife bootstrap <FQDN/IP of client> --ssh-user <username of chef client> --ssh-password <password of chef client> --node-name <provide a name to chef client>
  1. Verify that the new Chef client is created by logging into the Chef Automate dashboard.
  • Was this article helpful?