-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path99_install_deep_security.config
63 lines (57 loc) · 2.21 KB
/
99_install_deep_security.config
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
52
53
54
55
56
57
58
59
60
61
62
63
files:
"/tmp/install-ds.sh":
mode: "00555"
owner: root
group: root
encoding: plain
content: |
#!/bin/bash
logMsg()
{
INITPID=$$
PROG="DS-install"
logger -t ${PROG}[$INITPID] $1
echo $1
}
if [ ! -z "${DS_ENABLE}" ] && [ "${DS_ENABLE}" == "yes" ]; then
if [ ! -e /opt/ds_agent ]; then
logMsg "Downloading Deep Security Agent"
wget https://app.deepsecurity.trendmicro.com:443/software/agent/amzn1/x86_64/ -O /tmp/agent.rpm --quiet
RET=$?
if [ $RET -ne 0 ]; then
logMsg "Failed to download the Deep Security Agent"
else
logMsg "Successfully downloaded the Deep Security Agent to /tmp/agent.rpm"
if [ ! -z "${DS_POLICY}" ] && [ ! -z "${DS_TENANTID}" ] && [ ! -z "${DS_TENANTPW}" ]; then
BEANSTALKENV=`{ "Ref" : "AWSEBEnvironmentName" }`
INSTANCEID=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`
if [ "${BEANSTALKENV}" = "" ]; then
BEANSTALKENV=UNKNOWN_EB_ENV
fi
DESC=${BEANSTALKENV}_${INSTANCEID}
logMsg "Installing DS agent from /tmp/agent.rpm"
rpm --replacepkgs -ihv /tmp/agent.rpm
sleep 15
/opt/ds_agent/dsa_control -r
logMsg "Activating DS agent"
/opt/ds_agent/dsa_control -a dsm://agents.deepsecurity.trendmicro.com:443 \
"tenantID:${DS_TENANTID}" \
"tenantPassword:${DS_TENANTPW}" \
"policy:${DS_POLICY}" "description:${DESC}"
logMsg "DS agent activated"
else
logMsg "Deep Security policy/tenantid/tenantpw not provided - unable to activate agent"
fi
fi
else
logMsg "Deep Security agent already installed - triggering recommendation scan"
/opt/ds_agent/dsa_control -m "RecommendationScan:true"
fi
else
logMsg "Deep Security not selected to be enabled"
fi
logMsg "DS install script completes ${RET}"
exit $RET
container_commands:
00_install:
command: '/tmp/install-ds.sh'