File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ watch_for_failure(){
67
67
echo Ansible playbook complete, will begin streaming ${SPLUNK_TAIL_FILE}
68
68
${RUN_AS_SPLUNK} tail -n 0 -f ${SPLUNK_TAIL_FILE} &
69
69
fi
70
+ if [[ " $DISABLE_ENTIRE_SHELL_ACCESS " == " true" ]]; then
71
+ disable_entire_shell_access_for_container
72
+ fi
70
73
wait
71
74
}
72
75
@@ -90,6 +93,12 @@ start() {
90
93
watch_for_failure
91
94
}
92
95
96
+ secure_start () {
97
+ start_and_exit
98
+ export DISABLE_ENTIRE_SHELL_ACCESS=" true"
99
+ watch_for_failure
100
+ }
101
+
93
102
configure_multisite () {
94
103
prep_ansible
95
104
ansible-playbook $ANSIBLE_EXTRA_FLAGS -i inventory/environ.py -l localhost multisite.yml
@@ -103,6 +112,16 @@ restart(){
103
112
watch_for_failure
104
113
}
105
114
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
+
106
125
user_permission_change (){
107
126
if [[ " $STEPDOWN_ANSIBLE_USER " == " true" ]]; then
108
127
bash -c " sudo deluser -q ansible sudo"
@@ -175,6 +194,10 @@ case "$1" in
175
194
tail -n 0 -f /etc/hosts &
176
195
wait
177
196
;;
197
+ secure-start|secure-start-service)
198
+ shift
199
+ secure_start $@
200
+ ;;
178
201
bash|splunk-bash)
179
202
/bin/bash --init-file ${SPLUNK_HOME} /bin/setSplunkEnv
180
203
;;
You can’t perform that action at this time.
0 commit comments