Note - We provide a base SELinux policy that allows basic Amazon-CloudWatch-agent functionality. If users want more permissions, then they should review the SELinux documentation to understand how to update the policy to allow additional access, and scope it appropriately for their use case.
Note - This policy has been tested to work on AL2 and AL2023 only for now. Please make sure that the OS you are using is AL2 or AL2023.
This is the SELinux policy for AWS CWA agent. Install this policy to confine your CloudWatch Agent processes.
Installation instructions
Note - It is recommended to start SELinux in permissive mode before enabling it in enforcement mode.
Make sure Amazon CWA agent service is installed and running before compiling and installing the SELinux policy:
To build and install the SELinux policy, make sure that SELinux config file is in permissive or enforcing mode in /etc/selinux/config file:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Clone the repository, build and install using the commands below:
git clone https://github.com/aws/amazon-cloudwatch-agent-selinux.git
cd amazon-cloudwatch-agent-selinux
chmod +x amazon_cloudwatch_agent.sh
sudo ./amazon_cloudwatch_agent.sh
If you need to enable it, please enable the repository, reboot the instance, and verify that it is in either enforcing or permissive mode, depending on your selection.
Otherwise, you can simply restart the agent to ensure it runs in the confined context.
sudo systemctl restart amazon-cloudwatch-agent
Run sudo sestatus in order to see if SELinux is enabled:
AMAZON-CLOUDWATCH-AGENT-SELINUX POLICY
Note - We provide a base SELinux policy that allows basic Amazon-CloudWatch-agent functionality. If users want more permissions, then they should review the SELinux documentation to understand how to update the policy to allow additional access, and scope it appropriately for their use case.
Note - This policy has been tested to work on AL2 and AL2023 only for now. Please make sure that the OS you are using is AL2 or AL2023.
This is the SELinux policy for AWS CWA agent. Install this policy to confine your CloudWatch Agent processes.
Installation instructions
Note - It is recommended to start SELinux in permissive mode before enabling it in enforcement mode.
Make sure Amazon CWA agent service is installed and running before compiling and installing the SELinux policy:
Run the following commands:
To build and install the SELinux policy, make sure that SELinux config file is in
permissiveorenforcingmode in/etc/selinux/configfile:Clone the repository, build and install using the commands below:
If you need to enable it, please enable the repository, reboot the instance, and verify that it is in either enforcing or permissive mode, depending on your selection.
Otherwise, you can simply restart the agent to ensure it runs in the confined context.
Run
sudo sestatusin order to see if SELinux is enabled:List the CWA processes to check that they are confined:
Security
See CONTRIBUTING for more information.
License
This library is licensed under the GNU GPL v2 License.