Turning off SELinux should be replaced with user input variables, but that's fine.
==========================================
#! Bin/bash
Clear
echo "--------------------"
Echo-e "\033[34mthis file controls the state of SELinux on the system.\033[0m"
Echo-e "\033[33m selinux\033[0m = can take one of these three values:"
ECHO-E "\033[4me\033[0mnforcing-selinux security policy is enforced."
Echo-e "\033[4mp\033[0mermissive-selinux prints warnings instead of enforcing."
Echo-e "\033[4md\033[0misabled-no SELinux policy is loaded."
Echo-e "\033[33mselinuxtype\033[0m = can take one of the These values:"
ECHO-E "\033[4mt\033[0margeted-targeted processes is protected,"
Echo-e "\033[4mm\033[0mls-multi level Security protection."
echo "--------------------"
echo "Select SElinux mode (e,p,d):"
While:
Do
Read Sel
Case $sel in
"E" | "E")
selt= "Selinux=enforcig"
Break
;;
"P" | "P")
selt= "Selinux=permissive"
Break
;;
"D" | "D")
selt= "Selinux=disabled"
Break
;;
*)
echo "Re input"
;;
Esac
Done
echo "Select Selinuxtype mode (t,m):"
While:
Do
Read Sele
Case $sele in
"T" | "T")
selet= "Selinuxtype=targeted"
Break
;;
"M" | "M")
selet= "SELINUX=MLS"
Break
;;
*)
echo "Re input"
;;
Esac
Done
echo "Press any key to continue ... (Ctrl + C to Exit) "
Read-n 1
echo "#SELINUX =enforcig/permissive/disabled" >/etc/sysconfig/selinux
echo $selt >>/etc/sysconfig/selinux
echo "#SELINUX =tmargeted/mls" >>/etc/sysconfig/selinux
echo $selet >>/etc/sysconfig/selinux
echo "------------------------"
Sed-n ' 2p '/etc/sysconfig/selinux
Sed-n ' 4p '/etc/sysconfig/selinux
echo "------------------------"
========================================================
Not efficient.
Initial shell, set SELinux parameters