File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,11 @@ function prepare_source_code() {
229
229
create_overlay_mount_unit
230
230
fi
231
231
232
+ # disable ssh and unsafe cloud-init modules
233
+ if [[ " $CONFIDENTIAL_COMPUTE_ENABLED " == " yes" ]] || [[ -n " $CUSTOM_CLOUD_INIT_MODULES " ]]; then
234
+ [[ " $CUSTOM_CLOUD_INIT_MODULES " != " no" ]] && [[ " $CLOUD_PROVIDER " != " libvirt" ]] && set_custom_cloud_init_modules
235
+ fi
236
+
232
237
# Validate and copy HKD for IBM Z Secure Enablement
233
238
if [[ " $SE_BOOT " == " true" ]]; then
234
239
if [[ -z " $HOST_KEY_CERTS " ]]; then
@@ -283,6 +288,35 @@ function download_and_extract_pause_image() {
283
288
284
289
}
285
290
291
+ # These are cloud-init modules we allow for the CoCo case, it's mostly used to disable ssh
292
+ # and other unsafe modules
293
+ function set_custom_cloud_init_modules() {
294
+ local cfg_file=" ${podvm_dir} /files/etc/cloud/cloud.cfg.d/99_coco_only_allow.cfg"
295
+ mkdir -p $( dirname " ${cfg_file} " )
296
+ cat << EOF >"${cfg_file} "
297
+ cloud_init_modules:
298
+ - migrator
299
+ - set_hostname
300
+ - update_hostname
301
+
302
+ cloud_config_modules:
303
+ - locale
304
+ - rh_subscription
305
+ - ntp
306
+ - timezone
307
+ - disable_ec2_metadata
308
+
309
+ cloud_final_modules:
310
+ #- reset_rmc # needed for ibm power?
311
+ #- install_hotplug ?
312
+ - phone_home
313
+ - final_message
314
+ - power_state_change
315
+ EOF
316
+ echo " sudo cp -a /tmp/files/etc/cloud/cloud.cfg.d/* /etc/cloud/cloud.cfg.d/" >> " ${podvm_dir} " /qcow2/copy-files.sh
317
+ echo " Inject cloud-init configuration file:" && cat " ${cfg_file} "
318
+ }
319
+
286
320
# Function to create overlay mount unit in the podvm files
287
321
# this ensures rw (overlay) layer for the container images are in memory (encrypted)
288
322
function create_overlay_mount_unit() {
You can’t perform that action at this time.
0 commit comments