added warning about installing and ensure can only install workstation on centos

This commit is contained in:
m0duspwnens
2022-04-13 13:39:39 -04:00
parent 2389d3fac9
commit 6477e6c5a2

View File

@@ -14,7 +14,9 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
{# if this is a manager #} {# we only want the script to install the workstation if it is CentOS #}
{% if grains.os == 'CentOS' -%}
{# if this is a manager -#}
{% if grains.master == grains.id.split('_')|first -%} {% if grains.master == grains.id.split('_')|first -%}
source /usr/sbin/so-common source /usr/sbin/so-common
@@ -23,6 +25,33 @@ pillar_file="/opt/so/saltstack/local/pillar/minions/{{grains.id}}.sls"
if [ -f "$pillar_file" ]; then if [ -f "$pillar_file" ]; then
if ! grep -q "^workstation:$" "$pillar_file"; then if ! grep -q "^workstation:$" "$pillar_file"; then
FIRSTPASS=yes
while [[ $INSTALL != "yes" ]] && [[ $INSTALL != "no" ]]; do
if [[ "$FIRSTPASS" == "yes" ]]; then
echo "###########################################"
echo "## ** W A R N I N G ** ##"
echo "## _______________________________ ##"
echo "## ##"
echo "## Installing the Security Onion ##"
echo "## analyst node on this device will ##"
echo "## make permanent changes to ##"
echo "## the system. ##"
echo "## ##"
echo "###########################################"
echo "Do you wish to continue? (Type the entire word 'yes' to proceed or 'no' to exit)"
FIRSTPASS=no
else
echo "Please type 'yes' to continue or 'no' to exit."
fi
read INSTALL
done
if [[ $INSTALL == "no" ]]; then
echo "Exiting analyst node installation."
exit 0
fi
# Add workstation pillar to the minion's pillar file # Add workstation pillar to the minion's pillar file
printf '%s\n'\ printf '%s\n'\
"workstation:"\ "workstation:"\
@@ -42,11 +71,20 @@ else # if the pillar file doesn't exist
echo "Could not find $pillar_file and add the workstation pillar." echo "Could not find $pillar_file and add the workstation pillar."
fi fi
{#- if this is not a manager#} {#- if this is not a manager #}
{% else -%} {% else -%}
echo "Since this is not a manager, the pillar values to enable analyst workstation must be set manually. Please follow the documention at $doc_workstation_url." echo "Since this is not a manager, the pillar values to enable analyst workstation must be set manually. Please view the documention at $doc_workstation_url."
{#- endif if this is a manager #}
{% endif -%}
{#- if not CentOS #}
{%- else %}
echo "The Analyst Workstation can only be installed on CentOS. Please view the documention at $doc_workstation_url."
{#- endif grains.os == CentOS #}
{% endif -%} {% endif -%}
exit 0 exit 0