-
Notifications
You must be signed in to change notification settings - Fork 23
/
entrypoint.sh
executable file
·51 lines (46 loc) · 1.47 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
set -e
CSROOT=/opt/CrowdStrike
FALCONCTL=$CSROOT/falconctl
FALCON_SENSOR=$CSROOT/falcon-sensor
CLOUDSIM_CID="YOURCID"
#
# Initialize ``opts`` as one-dimensional array
#
declare -A opts
#
# Pull options from the environment (passed to us through a Kubernetes
# config map). If $CLOUDSIM_CID is defined assume a local build.
#
# Reference output of ``falconctl --help`` for option descriptions.
#
opts['--cid']="${FALCONCTL_OPT_CID:-$CLOUDSIM_CID}"
opts['--aid']="$FALCONCTL_OPT_AID"
opts['--apd']="$FALCONCTL_OPT_APD"
opts['--aph']="$FALCONCTL_OPT_APH"
opts['--app']="$FALCONCTL_OPT_APP"
opts['--trace']="$FALCONCTL_OPT_TRACE"
opts['--feature']="$FALCONCTL_OPT_FEATURE"
opts['--message-log']="$FALCONCTL_OPT_MESSAGE_LOG"
opts['--billing']="$FALCONCTL_OPT_BILLING"
opts['--assert']="$FALCONCTL_OPT_ASSERT"
opts['--memfail-grace-period']="$FALCONCTL_OPT_MEMFAIL_GRACE_PERIOD"
opts['--memfail-every-n']="$FALCONCTL_OPT_MEMFAIL_EVERY_N"
#
# Iterate through the ``opts`` array and pull out defined options. Build a unified
# ``falconctl -s -f [OPTS]`` style command.
#
cmd="$FALCONCTL -s -f"
for opt in "${!opts[@]}"
do
[ -z ${opts[$opt]} ] || cmd+=" $opt=${opts[$opt]}"
done
#
# Set the sensor config by running $cmd, and then
# exec the sensor ($FALCON_SENSOR)
#
# Note this is why the ``set -e`` line earlier is so important. If $cmd fails
# we do not want the sensor daemon to initiate, as that would mean the sensor
# was not properly initiated.
echo $cmd
$cmd && exec $FALCON_SENSOR