How can enabling selinux be done programmatically in a bash script that has root access?
I already know I can install the necessary packages like this:
if sestatus | grep -q disabled; then
yum -y install selinux-policy selinux-policy-targeted policycoreutils-python
fi
But how do I script the following steps:
- in
/boot/grub/menu.lst
append"selinux=1 security=selinux"
to kernel line - create an empty
.autorelabel
file in the root directory
Is there a script someone has put together on GitHub somewhere? We are using Amazon Linux, but I think the steps are the same for CentOS or RHEL.