-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathentrypoint.sh
50 lines (39 loc) · 1.26 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
#!/bin/bash
trap "exit 130" SIGINT
trap "exit 137" SIGKILL
trap "exit 143" SIGTERM
set -o errexit
set -o nounset
set -o pipefail
main () {
DEBUG=${DEBUG:-false}
if [[ ${DEBUG} == "true" ]]
then
set -o xtrace
fi
# Register this host with CHN if needed
chn-register.py \
-p rdphoney \
-d "${DEPLOY_KEY}" \
-u "${CHN_SERVER}" -k \
-o "${RDPHONEY_JSON}" \
-i "${REPORTED_IP}"
local uid="$(cat ${RDPHONEY_JSON} | jq -r .identifier)"
local secret="$(cat ${RDPHONEY_JSON} | jq -r .secret)"
# Keep old var names, but create also create some new ones that
# containedenv can understand
export RDPHONEY_output_hpfeeds__server="${FEEDS_SERVER}"
export RDPHONEY_output_hpfeeds__port="${FEEDS_SERVER_PORT:-10000}"
export RDPHONEY_output_hpfeeds__identifier="${uid}"
export RDPHONEY_output_hpfeeds__secret="${secret}"
export RDPHONEY_output_hpfeeds__tags="${TAGS}"
export RDPHONEY_output_hpfeeds__reported_ip="${REPORTED_IP}"
# Write out custom conpot config
containedenv-config-writer.py \
-p RDPHONEY_ \
-f ini \
-r /opt/rdphoney.cfg.dist \
-o /opt/rdphoney.cfg
python /opt/rdphoney/rdp_honeyscript.py --config /opt/rdphoney.cfg
}
main "$@"