File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ watch_for_failure(){
6767 echo Ansible playbook complete, will begin streaming ${SPLUNK_TAIL_FILE}
6868 ${RUN_AS_SPLUNK} tail -n 0 -f ${SPLUNK_TAIL_FILE} &
6969 fi
70+ if [[ " $DISABLE_ENTIRE_SHELL_ACCESS " == " true" ]]; then
71+ disable_entire_shell_access_for_container
72+ fi
7073 wait
7174}
7275
@@ -90,6 +93,12 @@ start() {
9093 watch_for_failure
9194}
9295
96+ secure_start () {
97+ start_and_exit
98+ export DISABLE_ENTIRE_SHELL_ACCESS=" true"
99+ watch_for_failure
100+ }
101+
93102configure_multisite () {
94103 prep_ansible
95104 ansible-playbook $ANSIBLE_EXTRA_FLAGS -i inventory/environ.py -l localhost multisite.yml
@@ -103,6 +112,16 @@ restart(){
103112 watch_for_failure
104113}
105114
115+ disable_entire_shell_access_for_container () {
116+ if [[ " $DISABLE_ENTIRE_SHELL_ACCESS " == " true" ]]; then
117+ bash -c " sudo usermod -s /sbin/nologin splunk"
118+ bash -c " sudo usermod -s /sbin/nologin ansible"
119+ sudo rm /bin/sh
120+ sudo rm /bin/bash
121+ sudo ln -s /bin/busybox /bin/sh
122+ fi
123+ }
124+
106125user_permission_change (){
107126 if [[ " $STEPDOWN_ANSIBLE_USER " == " true" ]]; then
108127 bash -c " sudo deluser -q ansible sudo"
@@ -175,6 +194,10 @@ case "$1" in
175194 tail -n 0 -f /etc/hosts &
176195 wait
177196 ;;
197+ secure-start|secure-start-service)
198+ shift
199+ secure_start $@
200+ ;;
178201 bash|splunk-bash)
179202 /bin/bash --init-file ${SPLUNK_HOME} /bin/setSplunkEnv
180203 ;;
You can’t perform that action at this time.
0 commit comments