forked from neuvector/neuvector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
168 lines (144 loc) · 7.55 KB
/
Makefile
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
.PHONY: fleet
REPO_URL = 10.1.127.3:5000
REPO_REL_URL = 10.1.127.12:5000
STAGE_DIR = stage
S_DATA_FILE = ubistage.tgz
copy_scan:
mkdir -p ${STAGE_DIR}/usr/local/bin/
mkdir -p ${STAGE_DIR}/etc/neuvector/db
#
cp neuvector/monitor/monitor ${STAGE_DIR}/usr/local/bin/
cp neuvector/scanner/scanner ${STAGE_DIR}/usr/local/bin/
cp neuvector/scanner/task/scannerTask ${STAGE_DIR}/usr/local/bin/
cp neuvector/scanner/rpmparser/rpmparser ${STAGE_DIR}/usr/local/bin/
cp neuvector/data/cvedb.regular ${STAGE_DIR}/etc/neuvector/db/cvedb
copy_ctrl:
mkdir -p ${STAGE_DIR}/usr/local/bin/
mkdir -p ${STAGE_DIR}/etc/
#
cp neuvector/monitor/monitor ${STAGE_DIR}/usr/local/bin/
cp neuvector/controller/controller ${STAGE_DIR}/usr/local/bin/
cp neuvector/tools/nstools/nstools ${STAGE_DIR}/usr/local/bin/
cp neuvector/tools/sidekick/sidekick ${STAGE_DIR}/usr/local/bin/
#
cp neuvector/scripts/sysctl.conf ${STAGE_DIR}/etc/
cp neuvector/scripts/teardown.sh ${STAGE_DIR}/usr/local/bin/
cp neuvector/scripts/runtime-gdb.py ${STAGE_DIR}/usr/local/bin/
copy_enf:
mkdir -p ${STAGE_DIR}/usr/local/bin/
mkdir -p ${STAGE_DIR}/etc/
#
cp neuvector/monitor/monitor ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/agent ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/workerlet/pathWalker/pathWalker ${STAGE_DIR}/usr/local/bin/
cp neuvector/scanner/rpmparser/rpmparser ${STAGE_DIR}/usr/local/bin/
cp neuvector/dp/dp ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/host.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/container.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/check_kube_version.sh ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_1_0_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_1_0_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_1_2_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_1_2_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_1_4_1.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_1_4_1.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_1_5_1.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_1_5_1.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_1_6_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_1_6_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_gke_1_0_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_gke_1_0_0.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_ocp_4_3.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_ocp_4_3.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_master_ocp_4_5.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kube_worker_ocp_4_5.tmpl ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_1_0_0.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_1_2_0.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_1_4_1.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_1_5_1.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_1_6_0.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_gke_1_0_0.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_ocp_4_5.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/nvbench/kubecis_ocp_4_3.rem ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/tools/host_package.sh ${STAGE_DIR}/usr/local/bin/
cp neuvector/agent/tools/container_package.sh ${STAGE_DIR}/usr/local/bin/
cp neuvector/tools/nstools/nstools ${STAGE_DIR}/usr/local/bin/
cp neuvector/tools/sidekick/sidekick ${STAGE_DIR}/usr/local/bin/
#
cp neuvector/scripts/sysctl.conf ${STAGE_DIR}/etc/
cp neuvector/scripts/configure.sh ${STAGE_DIR}/usr/local/bin/
cp neuvector/scripts/teardown.sh ${STAGE_DIR}/usr/local/bin/
cp neuvector/scripts/runtime-gdb.py ${STAGE_DIR}/usr/local/bin/
copy_dp:
mkdir -p ${STAGE_DIR}/usr/local/bin/
mkdir -p ${STAGE_DIR}/etc/
#
cp neuvector/dp/dp ${STAGE_DIR}/usr/local/bin/
copy_mgr:
mkdir -p ${STAGE_DIR}/usr/local/bin/
mkdir -p ${STAGE_DIR}/licenses/
mkdir -p ${STAGE_DIR}/usr/lib/jvm/java-11-openjdk/lib/security/
#
cp manager/licenses/* ${STAGE_DIR}/licenses/
#
cp manager/cli/cli ${STAGE_DIR}/usr/local/bin/
cp -r manager/cli/prog ${STAGE_DIR}/usr/local/bin/
cp manager/scripts/* ${STAGE_DIR}/usr/local/bin/
cp manager/java.security ${STAGE_DIR}/usr/lib/jvm/java-11-openjdk/lib/security/java.security
cp manager/admin/target/scala-2.11/admin-assembly-1.0.jar ${STAGE_DIR}/usr/local/bin/
stage_init:
rm -rf ${STAGE_DIR}; mkdir -p ${STAGE_DIR}
#
mkdir -p ${STAGE_DIR}/licenses/
cd neuvector/vendor && ../genlic.sh > ../../${STAGE_DIR}/licenses/neuvector-license.txt
cd ../..
cd neuvector/dp && ../genlic.sh >> ../../${STAGE_DIR}/licenses/neuvector-license.txt
cd ../..
stage_scan: stage_init copy_scan
stage_ctrl: stage_init copy_ctrl
stage_enf: stage_init copy_enf
stage_all: stage_init copy_ctrl copy_enf copy_mgr
mkdir -p ${STAGE_DIR}/etc/supervisor/conf.d
cp neuvector/build/supervisord.all.conf ${STAGE_DIR}/etc/supervisor/conf.d/supervisord.conf
pull_fleet_base:
docker pull $(REPO_REL_URL)/neuvector/fleet_base:latest
docker pull $(REPO_REL_URL)/neuvector/controller_base:latest
docker pull $(REPO_REL_URL)/neuvector/enforcer_base:latest
pull_all_base:
docker pull $(REPO_REL_URL)/neuvector/all_base:jdk11
api_image:
docker build -t neuvector/api -f neuvector/build/Dockerfile.api .
ctrl_image: pull_fleet_base stage_ctrl
docker build --build-arg NV_TAG=$(NV_TAG) -t neuvector/controller -f neuvector/build/Dockerfile.controller .
enf_image: pull_fleet_base stage_enf
docker build --build-arg NV_TAG=$(NV_TAG) -t neuvector/enforcer -f neuvector/build/Dockerfile.enforcer .
scanner_image: pull_fleet_base stage_scan
docker build -t neuvector/scanner -f neuvector/build/Dockerfile.scanner .
all_image: pull_all_base stage_all
docker build --build-arg NV_TAG=$(NV_TAG) -t neuvector/allinone -f neuvector/build/Dockerfile.all .
ubi_scanner:
rm -rf ${STAGE_DIR}; mkdir -p ${STAGE_DIR}
mkdir -p ${STAGE_DIR}/licenses/
mkdir -p ${STAGE_DIR}/usr/local/bin/
mkdir -p ${STAGE_DIR}/etc/neuvector/certs/
mkdir -p ${STAGE_DIR}/etc/neuvector/certs/internal/
mkdir -p ${STAGE_DIR}/etc/neuvector/db/
docker run -itd --name cache --entrypoint true ${REPO_URL}/neuvector/scanner:latest
docker cp cache:/licenses/. ${STAGE_DIR}/licenses/
docker cp cache:/etc/neuvector/certs/internal/. ${STAGE_DIR}/etc/neuvector/certs/internal/
docker cp cache:/usr/local/bin/. ${STAGE_DIR}/usr/local/bin/
docker cp cache:/etc/neuvector/db/cvedb ${STAGE_DIR}/etc/neuvector/db/cvedb
docker stop cache; docker rm cache
rm -f ${S_DATA_FILE} || true
cd stage; tar -czvf ../${S_DATA_FILE} *; cd ..
docker build --build-arg DATA_FILE=${S_DATA_FILE} -t neuvector/scanner.ubi -f neuvector/build/Dockerfile.scanner.ubi .
fleet:
# This is running in neuvector/
@echo "Making $@ ..."
@docker pull $(REPO_REL_URL)/neuvector/build
@docker run --rm -ia STDOUT --name build -e NV_BUILD_TARGET=$(NV_BUILD_TARGET) --net=none -v $(CURDIR):/go/src/github.com/neuvector/neuvector -w /go/src/github.com/neuvector/neuvector --entrypoint ./make_fleet.sh $(REPO_REL_URL)/neuvector/build
db:
# This is running in neuvector/
@echo "Making $@ ..."
@docker pull $(REPO_REL_URL)/neuvector/build
@docker run --rm -ia STDOUT --name build -e VULN_VER=$(VULN_VER) -v $(CURDIR):/go/src/github.com/neuvector/neuvector -w /go/src/github.com/neuvector/neuvector --entrypoint ./make_db.sh $(REPO_REL_URL)/neuvector/build