KL 020.13 KHCS en Labs v0.9.15
KL 020.13 KHCS en Labs v0.9.15
KL 020.13 KHCS en Labs v0.9.15
KL 020.13
Kaspersky Hybrid
Cloud Security
Lab guide
1
KL 020.13: Kaspersky Hybrid Cloud Security.
Public Clouds & DevOps
Table of contents
Lab 1. Prepare Amazon Web Services environment .................................................................................... 2
Task A: Go to Amazon Web Services console and configure it ....................................................... 2
Task B: Start your EC2 instances .................................................................................................... 3
Task C: Open S3 Bucket console and copy credentials of the service account .............................. 4
Lab 2. Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services . 6
Task A: Connect to Kaspersky Security Center Cloud Console ...................................................... 6
Task B: Set up a task to synchronize inventory information with the Amazon Web Services cloud
........................................................................................................................................................10
Task C: Prepare installation packages and policies to protect cloud resources ............................11
Lab 3. Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services .............16
Task A: Install Network Agent for Linux using Run Command in Systems Manager ....................16
Task B: Install Network Agent for Windows using a script in User Data ........................................18
Task C: Install Kaspersky Endpoint Security and Kaspersky Endpoint Security for Linux on EC2
instances.........................................................................................................................................22
Lab 4. Configuring Kaspersky Endpoint Security for Linux to protect containers .......................................27
Set up a container environment protection policy, start a malicious container and make sure
Kaspersky Endpoint Security for Linux protects the container environment ..................................27
Lab 5. Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins ....................................32
Task A: Configure a container environment protection policy for CI/CD ........................................32
Task B: Configure Jenkins and integration with Kaspersky Endpoint Security for Linux ...............34
Task C: Create a job to scan containers for malicious code ..........................................................36
Lab 6. Automation of new container image scanning with GitHub..............................................................39
Task A: Set up a webhook between Jenkins and GitHub ..............................................................40
Task B: Test automatic launch of the job that builds and scans a container image ......................44
Lab 7. Scanning third-party container images and uploading trusted images to a private repository via KESL
container ......................................................................................................................................................45
Task A: Build a KESL container using Docker Build ......................................................................46
Task B: Prepare the configuration files and run KESL container ...................................................48
Task C: Send POST requests to the KESL container service to scan container images ..............50
1
KL 020.13: Kaspersky Hybrid Cloud Security.
Public Clouds & DevOps
Lab 1.
Prepare Amazon Web Services environment
Scenario. Kaspersky Hybrid Cloud Security solution is designed to protect hybrid cloud environments. Your
company has decided to deploy some of its resources in Amazon Web Services. To protect them, we’ll use
Kaspersky Security Center Cloud Console with a Kaspersky Hybrid Cloud Security license. First of all, you will
need to prepare the Amazon Web Services console, start EC2 instances and copy the authorization data of the
KCSA service account.
We will use:
– Virtual Private Cloud (VPC)
– Elastic Compute Cloud (EC2)
– Simple Storage Service (S3)
– Simple Systems Manager (SSM)
– Secrets Manager
2
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 1.
Public Clouds & DevOps Prepare Amazon Web Services environment
6. In the search box, type names of the following services (one by one), pause on the name of each service
and click the star to add it to your Favorites list:
– Virtual Private Cloud (VPC)
– Elastic Compute Cloud (EC2)
– Simple Storage Service (S3)
– Simple Systems Manager (SSM)
– Secrets Manager
3
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 1.
Public Clouds & DevOps Prepare Amazon Web Services environment
Task C: Open S3 Bucket console and copy credentials of the service account
Ask the trainer for a direct link to your S3 bucket and check access to your folder. Open the Secrets Manager
console from the Favorites list, open the available secret with credentials of the KCSA service account and copy
them into a text file.
4
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 1.
Public Clouds & DevOps Prepare Amazon Web Services environment
5
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
Conclusion
In this lab, you’ve got acquainted with the Amazon Web Services environment, configured quick access to the
necessary services and set up a filter for your EC2 instances. Also, you’ve saved credentials of your KCSA service
account.
Lab 2.
Preparing Kaspersky Security Center Cloud Console
and connecting it to Amazon Web Services
Scenario. You will connect to Kaspersky Security Center Cloud Console from which you will manage protection of
your cloud and DevOps resources. You will complete the quick start wizard, enter a test license key and connect to
the Amazon Web Services cloud. You will also generate standalone installation packages for Kaspersky Endpoint
Security for Windows and Linux, create a security policy and upload them to your folder on S3 Bucket.
6
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
5. Click Next
7
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
8
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
14. Click the installation packages one by one and select Download and create installation package
9
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
10
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
7. Go to Devices | Managed
Devices and make sure three
EC2 instances are there
11
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
12
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
22. Go to Devices |
Policies & Profiles
23. Click Add
13
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
14
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 2.
Public Clouds & DevOps Preparing Kaspersky Security Center Cloud Console and connecting it to Amazon Web Services
15
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
Conclusion
In this lab, we’ve configured the Cloud Console environment: completed its setup wizard and connected to Amazon
Web Services. We’ve also prepared standalone installation packages and uploaded them to S3 bucket. Each
installation package is accessible via a unique link.
Lab 3.
Installing Network Agent and Kaspersky Endpoint
Security using Amazon Web Services
Scenario. You’ve prepared Network Agent installation packages and uploaded them to S3 bucket. Now, let’s install
them on EC2 instances using standard Amazon Web Services tools, check the agents’ health and run the tasks to
install Kaspersky Endpoint Security for Windows and Linux.
1. Install Network Agent for Linux using Run Command in Systems Manager
2. Install Network Agent for Windows using a script in User Data
3. Install Kaspersky Endpoint Security and Kaspersky Endpoint Security for Linux on EC2 instances
Task A: Install Network Agent for Linux using Run Command in Systems
Manager
Log on to the Amazon Web Services console using your account and run the Network Agent installation task.
16
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
17
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
Task B: Install Network Agent for Windows using a script in User Data
By default, user data scripts only run when you start an EC2 instance for the first time. Log on to the Amazon Web
Services console using your account, configure another run for the EC2 user data script, shut down the instance
and edit the PowerShell script in user data so that it installs Network Agent.
18
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
5. A new tab with the command prompt will open. Carry out the following command:
C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 –Schedule
This command will make the virtual machine process user data next time when its OS starts.
19
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
20
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
13. In the New user data area, select Modify user data as text
14. Enter the following script. Replace <your link> with the link to the Installer.exe file that you created and
saved:
<powershell>
$url = "<your link>"
$outpath = "C:/installer.exe"
Invoke-WebRequest -Uri $url -OutFile $outpath
Start-Process -Wait -FilePath $outpath -ArgumentList "/s" -PassThru
net user administrator Ka5per5Ky
</powershell>
15. Click Save
The net user command additionally sets the administrator’s password. We will need it later for RDP connections
to the virtual machine.
21
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
22
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
2. Go to
Discovery & Deployment |
Deployment & Assignment |
Installation Packages
3. Select Kaspersky Endpoint
Security for Linux (English)
4. Click Deploy
23
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
24
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
19. Return to
Discovery & Deployment |
Deployment & Assignment |
Installation Packages
20. Select Kaspersky Endpoint
Security for Windows
(English)
21. Click Deploy
25
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 3.
Public Clouds & DevOps Installing Network Agent and Kaspersky Endpoint Security using Amazon Web Services
The restart is required because updates are additionally downloaded and installed after the main installation of
security components.
Conclusion
In this lab, we installed the Network Agent on EC2 instances using standard Amazon Web Services tools and then
installed security applications on Linux and Windows instances using Network Agent.
26
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 4.
Public Clouds & DevOps Configuring Kaspersky Endpoint Security for Linux to protect containers
Lab 4.
Configuring Kaspersky Endpoint Security for Linux to
protect containers
Scenario. You’ve installed Kaspersky Endpoint Security on an EC2 DevOps instance. Docker engine was pre-
installed on the instance. Now, you will configure a container protection policy and run a container with malicious
files. An application will try to unpack malicious archives within the container, but the container will be automatically
stopped and deleted.
27
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 4.
Public Clouds & DevOps Configuring Kaspersky Endpoint Security for Linux to protect containers
9. In Application Settings |
General Settings, click
Container scan settings
28
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 4.
Public Clouds & DevOps Configuring Kaspersky Endpoint Security for Linux to protect containers
29
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 4.
Public Clouds & DevOps Configuring Kaspersky Endpoint Security for Linux to protect containers
22. A new tab with the command prompt will open. Carry out the following commands one by one:
sudo docker run -ti techedu/alpine:1.0
wget https://secure.eicar.org/eicar.com -O eicar.com
ls
cat eicar.com
ls
23. Make sure that the file eicar.com hasn’t opened and has been deleted
24. Stop the container using the command
exit
32. Return to the Amazon Web Services tab with the connection to the DevOps instance
33. Carry out the following command:
sudo docker run -ti techedu/docker-eicar:1.0
30
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 4.
Public Clouds & DevOps Configuring Kaspersky Endpoint Security for Linux to protect containers
34. Note that the archived files with test pseudo-malicious code were neither detected nor deleted
41. Go to Devices |
Managed devices
42. Click ip-10-28-0-50
31
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 5.
Public Clouds & DevOps Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins
44. Return to the Amazon Web Services tab with the connection to the DevOps instance
45. Carry out the following command:
sudo docker run -ti techedu/docker-eicar:1.0
46. Note that the archived files with test pseudo-malicious code are deleted immediately
51. Make sure Kaspersky Endpoint Security for Linux deleted the pseudo-malicious test archive eicar.tar.gz
Conclusion
In this lab, we’ve set up container environment protection policies and checked how Kaspersky Endpoint Security
for Linux protects containers against malware.
Lab 5.
Integrating Kaspersky Endpoint Security for Linux
into CI/CD with Jenkins
Scenario. You’ve installed Kaspersky Endpoint Security on an EC2 Jenkins instance. Now, you need to add a
container scanning job to the CI/CD pipeline to be able to detect malware at any stage. Docker engine and Jenkins
were pre-installed on the instance. You will create a new container environment protection policy to enable Jenkins
to run container scanning jobs. You will also configure Jenkins and create a container scanning job.
32
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 5.
Public Clouds & DevOps Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins
33
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 5.
Public Clouds & DevOps Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins
34
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 5.
Public Clouds & DevOps Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins
35
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 5.
Public Clouds & DevOps Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins
20. A new tab with the command prompt will open. Carry out:
sudo kesl-control --grant-role admin jenkins
sudo usermod -aG docker jenkins
sudo systemctl restart docker.service
sudo chown jenkins /var/run/docker.sock
sudo sed -i -e '$ajenkins ALL=(ALL) NOPASSWD: ALL' /etc/sudoers
We enable the jenkins user to run docker commands with root privileges
36
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 5.
Public Clouds & DevOps Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins
37
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 5.
Public Clouds & DevOps Integrating Kaspersky Endpoint Security for Linux into CI/CD with Jenkins
38
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 6.
Public Clouds & DevOps Automation of new container image scanning with GitHub
Conclusion
In this lab, we’ve configured Jenkins integration with Kaspersky Endpoint Security for Linux to scan container images.
We created a project to scan container images on demand and tested it.
Lab 6.
Automation of new container image scanning with
GitHub
Scenario. CI/CD automation significantly speeds up the development process. GitHub is a version control
repository popular among developers and DevOps engineers. Containers are described and created using a
Dockerfile. Any modification of a Dockerfile requires creating a new container to take into account the changes. In
39
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 6.
Public Clouds & DevOps Automation of new container image scanning with GitHub
this lab, you will set up integration between Jenkins and GitHub using a webhook and thus automate the process of
creating and scanning new containers when the Dockerfile changes.
40
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 6.
Public Clouds & DevOps Automation of new container image scanning with GitHub
41
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 6.
Public Clouds & DevOps Automation of new container image scanning with GitHub
We are creating a new Dockerfile, which we will edit in the future. Any change will send a Jenkins command to
build a container image with the new version of Dockerfile and scan this image for malicious code.
42
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 6.
Public Clouds & DevOps Automation of new container image scanning with GitHub
43
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 6.
Public Clouds & DevOps Automation of new container image scanning with GitHub
Task B: Test automatic launch of the job that builds and scans a container
image
In the GitHub console, add a command that will download a pseudo-malicious file to the Dockerfile and check if the
job to build and test the container starts automatically.
44
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
8. Make sure the image was built with the new version of Dockerfile and Total detected objects=1
Conclusion
In this lab, we’ve set up integration between Jenkins and GitHub, automated the process of building container images
and scanning them for malware.
Lab 7.
Scanning third-party container images and uploading
trusted images to a private repository via KESL
container
Scenario. You need to maintain a private repository of containers with trusted malware-free images. We will build
Kaspersky Endpoint Security for Linux as a container, run it as a service and send it POST requests to download a
45
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
container image from a public repository and scan it. If the container does not contain malicious code, it will be
considered trusted and uploaded into a private repository with trusted contents.
46
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
6. In the command line tab that opens, go to the user's home folder
cd ~
7. Download the prepared build files from S3 Bucket
wget https://khcs-ted-s3.s3.us-west-1.amazonaws.com/docker-service-kesl64-
11.2.0-4528.tgz -O docker-service-kesl64-11.2.0-4528.tgz
8. Unpack the archive
tar -xvf docker-service-kesl64-11.2.0-4528.tgz
47
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
48
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
4. Download the license file prepared in advance to the /home/ssm-user/config folder using the command
wget https://khcs-ted-s3.s3.us-west-1.amazonaws.com/configl -O /home/ssm-
user/config/configl
5. Edit the kesl-service.config file and add your Docker Hub credentials to it
nano config/kesl-service.config
6. In the string user: khcslabuser, replace khcslabuser with your Docker Hub username
7. To save and close the file, press CTRL+O and CTRL+X
We created a Docker Hub user account for you with the same username as in Amazon Web Services. The
screenshot shows an example configuration for khcslabuser1
49
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
During the first start, KESL container downloads signature databases, which takes some time. To speed up
subsequent starts, the databases are stored in the /home/ssm-user/.../volume folder mounted inside the
container.
Task C: Send POST requests to the KESL container service to scan container
images
Install Postman on your Windows instance and send POST requests to the KESL container to scan container
images. If a container does not contain malicious code, it will be uploaded to your private repository of Docker Hub
container images.
50
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
51
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
16. Download the ready POST1 file with the basic POST request from
https://khcs-ted-s3.s3.us-west-1.amazonaws.com/POST1.txt
17. Copy the file contents to the
Postman request field
18. Click Send
23. Download a ready POST2 file with the a complex POST request from
https://khcs-ted-s3.s3.us-west-1.amazonaws.com/POST2.txt
24. Return to the tab with the
POST request and copy the
file contents to the Postman
request field
25. In the destination line,
replace <login> with your
Docker Hub username
26. Click Send
52
KL 020.13: Kaspersky Hybrid Cloud Security. Lab 7.
Public Clouds & DevOps Scanning third-party container images and uploading trusted images to a private repository via KESL container
Conclusion
In this lab, we run the KESL container service, used it to scan a container image from an external untrusted repository
for malicious code and uploaded the verified clean image to a private repository of container images.
v.1.0
53