@@ -19,7 +19,7 @@ Optional Flags:
19
19
-c, --copy <REGISTRY/NAMESPACE> registry to copy image e.g. myregistry.com/mynamespace
20
20
-v, --version <SENSOR_VERSION> specify sensor version to retrieve from the registry
21
21
-p, --platform <SENSOR_PLATFORM> specify sensor platform to retrieve e.g x86_64, aarch64
22
- -t, --type <SENSOR_TYPE> specify which sensor to download [falcon-container|falcon-sensor|falcon-kac|kpagent]
22
+ -t, --type <SENSOR_TYPE> specify which sensor to download [falcon-container|falcon-sensor|falcon-kac|falcon-snapshot| kpagent]
23
23
Default is falcon-container.
24
24
25
25
--runtime use a different container runtime [docker, podman, skopeo]. Default is docker.
@@ -222,7 +222,7 @@ format_tags_to_json() {
222
222
)
223
223
# The output should mimic the same format as the Docker (curl) output
224
224
echo " {
225
- \" name\" : \" ${SENSOR_TYPE } \" ,
225
+ \" name\" : \" ${IMAGE_NAME } \" ,
226
226
${tags_json}
227
227
}"
228
228
}
@@ -256,7 +256,7 @@ format_tags() {
256
256
# Formats tags and handles sorting for KPA
257
257
local all_tags=$1
258
258
259
- if [ " ${SENSOR_TYPE} " = " kpagent" ]; then
259
+ if [ " ${SENSOR_TYPE} " = " kpagent" ] || [ " ${SENSOR_TYPE} " = " falcon-snapshot " ] ; then
260
260
echo " $all_tags " |
261
261
sed -n ' s/.*"tags" : \[\(.*\)\].*/\1/p' |
262
262
tr -d ' "' | tr ' ,' ' \n' |
@@ -274,7 +274,7 @@ print_formatted_tags() {
274
274
local formatted_tags=$1
275
275
276
276
# Print a JSON object with tags properly formatted
277
- printf " {\n \" name\" : \" %s\" ,\n \" tags\" : [\n" " ${SENSOR_TYPE } "
277
+ printf " {\n \" name\" : \" %s\" ,\n \" tags\" : [\n" " ${IMAGE_NAME } "
278
278
first=true
279
279
echo " $formatted_tags " | while IFS= read -r tag; do
280
280
if [ " $first " = true ]; then
@@ -291,7 +291,7 @@ list_tags() {
291
291
all_tags=$( fetch_tags " ${CONTAINER_TOOL} " )
292
292
formatted_tags=$( format_tags " $all_tags " )
293
293
294
- print_formatted_tags " $formatted_tags " " ${SENSOR_TYPE} "
294
+ print_formatted_tags " $formatted_tags "
295
295
}
296
296
297
297
# shellcheck disable=SC2086
329
329
330
330
# Check if SENSOR_TYPE is set to a valid value
331
331
case " ${SENSOR_TYPE} " in
332
- falcon-container | falcon-sensor | falcon-kac | kpagent) ;;
332
+ falcon-container | falcon-sensor | falcon-kac | falcon-snapshot | kpagent) ;;
333
333
* ) die " " "
334
334
Unrecognized sensor type: ${SENSOR_TYPE}
335
- Valid values are [falcon-container|falcon-sensor|falcon-kac|kpagent]" " " ;;
335
+ Valid values are [falcon-container|falcon-sensor|falcon-kac|falcon-snapshot| kpagent]" " " ;;
336
336
esac
337
337
338
338
# Check all mandatory variables set
@@ -410,27 +410,35 @@ if [ ! "$LISTTAGS" ] && [ ! "$PULLTOKEN" ]; then
410
410
fi
411
411
412
412
ART_USERNAME=" fc-$cs_falcon_cid "
413
- sensor_name =" falcon-sensor"
413
+ IMAGE_NAME =" falcon-sensor"
414
414
repository_name=" release/falcon-sensor"
415
+ registry_type=" container-security"
415
416
416
417
if [ " ${SENSOR_TYPE} " = " falcon-kac" ]; then
417
418
# overrides for KAC
418
- sensor_name =" falcon-kac"
419
+ IMAGE_NAME =" falcon-kac"
419
420
repository_name=" release/falcon-kac"
421
+ elif [ " ${SENSOR_TYPE} " = " falcon-snapshot" ]; then
422
+ # overrides for Snapshot
423
+ ART_USERNAME=" fs-$cs_falcon_cid "
424
+ IMAGE_NAME=" cs-snapshotscanner"
425
+ repository_name=" release/cs-snapshotscanner"
426
+ registry_type=" snapshots"
420
427
elif [ " ${SENSOR_TYPE} " = " kpagent" ]; then
421
428
# overrides for KPA
422
429
ART_USERNAME=" kp-$cs_falcon_cid "
423
- sensor_name =" kpagent"
430
+ IMAGE_NAME =" kpagent"
424
431
repository_name=" kpagent"
432
+ registry_type=" kubernetes-protection"
425
433
registry_opts=" kubernetes_protection"
426
434
fi
427
435
428
436
# Set Docker token using the BEARER token captured earlier
429
437
if [ " ${SENSOR_TYPE} " = " kpagent" ]; then
430
- raw_docker_api_token=$( curl_command " $cs_falcon_oauth_token " " https://$( cs_cloud) /kubernetes-protection /entities/integration/agent/v1?cluster_name=clustername&is_self_managed_cluster=true" )
438
+ raw_docker_api_token=$( curl_command " $cs_falcon_oauth_token " " https://$( cs_cloud) /$registry_type /entities/integration/agent/v1?cluster_name=clustername&is_self_managed_cluster=true" )
431
439
docker_api_token=$( echo " $raw_docker_api_token " | awk ' /dockerAPIToken:/ {print $2}' )
432
440
else
433
- raw_docker_api_token=$( curl_command " $cs_falcon_oauth_token " " https://$( cs_cloud) /container-security /entities/image-registry-credentials/v1" )
441
+ raw_docker_api_token=$( curl_command " $cs_falcon_oauth_token " " https://$( cs_cloud) /$registry_type /entities/image-registry-credentials/v1" )
434
442
docker_api_token=$( echo " $raw_docker_api_token " | json_value " token" )
435
443
fi
436
444
ART_PASSWORD=$( echo " $docker_api_token " | sed ' s/ *$//g' | sed ' s/^ *//g' )
@@ -456,7 +464,7 @@ $raw_docker_api_token
456
464
457
465
Ensure the following:
458
466
- Credentials are valid.
459
- - Correct API Scopes are assigned (Falcon Images Download [read], Sensor Download [read], Kubernetes Protection [read])
467
+ - Correct API Scopes are assigned (Falcon Images Download [read], Sensor Download [read], Snapshot Scanner Image Download [read], Snapshot [read/write], Kubernetes Protection [read])
460
468
- Cloud Security is enabled in your tenant."
461
469
fi
462
470
497
505
498
506
# For those that don't want to use skopeo to copy
499
507
if [ -n " $COPY " ]; then
500
- " $CONTAINER_TOOL " tag " $FULLIMAGEPATH " " $COPY /$sensor_name :$LATESTSENSOR "
501
- " $CONTAINER_TOOL " push " $COPY /$sensor_name :$LATESTSENSOR "
508
+ " $CONTAINER_TOOL " tag " $FULLIMAGEPATH " " $COPY /$IMAGE_NAME :$LATESTSENSOR "
509
+ " $CONTAINER_TOOL " push " $COPY /$IMAGE_NAME :$LATESTSENSOR "
502
510
fi
503
511
fi
0 commit comments